Commit 90679878 authored by Andy Grover's avatar Andy Grover Committed by Linus Torvalds

[PATCH] ACPI patch 5/9

This is the update to the core interpreter code.
parent 3177bcb8
# #
# Makefile for all Linux ACPI interpreter subdirectories # Makefile for all Linux ACPI interpreter subdirectories
# EXCEPT for the ospm directory
# #
O_TARGET := $(notdir $(CURDIR)).o O_TARGET := $(notdir $(CURDIR)).o
obj-$(CONFIG_ACPI) := $(patsubst %.c,%.o,$(wildcard *.c)) obj-$(CONFIG_ACPI_INTERPRETER) := $(patsubst %.c,%.o,$(wildcard *.c))
EXTRA_CFLAGS += $(ACPI_CFLAGS) EXTRA_CFLAGS += $(ACPI_CFLAGS)
......
This diff is collapsed.
/******************************************************************************* /*******************************************************************************
* *
* Module Name: dbdisasm - parser op tree display routines * Module Name: dbdisasm - parser op tree display routines
* $Revision: 50 $ * $Revision: 61 $
* *
******************************************************************************/ ******************************************************************************/
/* /*
* Copyright (C) 2000, 2001 R. Byron Moore * Copyright (C) 2000 - 2002, R. Byron Moore
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
...@@ -34,10 +34,9 @@ ...@@ -34,10 +34,9 @@
#ifdef ENABLE_DEBUGGER #ifdef ENABLE_DEBUGGER
#define _COMPONENT ACPI_DEBUGGER #define _COMPONENT ACPI_DEBUGGER
MODULE_NAME ("dbdisasm") ACPI_MODULE_NAME ("dbdisasm")
#define MAX_SHOW_ENTRY 128
#define BLOCK_PAREN 1 #define BLOCK_PAREN 1
#define BLOCK_BRACE 2 #define BLOCK_BRACE 2
#define DB_NO_OP_INFO " [%2.2d] " #define DB_NO_OP_INFO " [%2.2d] "
...@@ -67,14 +66,12 @@ acpi_db_block_type ( ...@@ -67,14 +66,12 @@ acpi_db_block_type (
switch (op->opcode) { switch (op->opcode) {
case AML_METHOD_OP: case AML_METHOD_OP:
return (BLOCK_BRACE); return (BLOCK_BRACE);
break;
default: default:
break; break;
} }
return (BLOCK_PAREN); return (BLOCK_PAREN);
} }
...@@ -101,11 +98,23 @@ acpi_ps_display_object_pathname ( ...@@ -101,11 +98,23 @@ acpi_ps_display_object_pathname (
acpi_parse_object *op) acpi_parse_object *op)
{ {
acpi_parse_object *target_op; acpi_parse_object *target_op;
char *name;
if (op->flags & ACPI_PARSEOP_GENERIC) {
name = op->value.name;
if (name[0] == '\\') {
acpi_os_printf (" (Fully Qualified Pathname)");
return (AE_OK);
}
}
else {
name = (char *) &((acpi_parse2_object *) op)->name;
}
/* Search parent tree up to the root if necessary */ /* Search parent tree up to the root if necessary */
target_op = acpi_ps_find (op, op->value.name, 0, 0); target_op = acpi_ps_find (op, name, 0, 0);
if (!target_op) { if (!target_op) {
/* /*
* Didn't find the name in the parse tree. This may be * Didn't find the name in the parse tree. This may be
...@@ -115,7 +124,6 @@ acpi_ps_display_object_pathname ( ...@@ -115,7 +124,6 @@ acpi_ps_display_object_pathname (
*/ */
acpi_os_printf (" **** Path not found in parse tree"); acpi_os_printf (" **** Path not found in parse tree");
} }
else { else {
/* The target was found, print the name and complete path */ /* The target was found, print the name and complete path */
...@@ -136,8 +144,7 @@ acpi_ps_display_object_pathname ( ...@@ -136,8 +144,7 @@ acpi_ps_display_object_pathname (
{ {
acpi_status status; acpi_status status;
acpi_namespace_node *node; acpi_namespace_node *node;
NATIVE_CHAR buffer[MAX_SHOW_ENTRY]; acpi_buffer buffer;
u32 buffer_size = MAX_SHOW_ENTRY;
u32 debug_level; u32 debug_level;
...@@ -153,7 +160,7 @@ acpi_ps_display_object_pathname ( ...@@ -153,7 +160,7 @@ acpi_ps_display_object_pathname (
/* Node not defined in this scope, look it up */ /* Node not defined in this scope, look it up */
status = acpi_ns_lookup (walk_state->scope_info, op->value.string, ACPI_TYPE_ANY, status = acpi_ns_lookup (walk_state->scope_info, op->value.string, ACPI_TYPE_ANY,
IMODE_EXECUTE, NS_SEARCH_PARENT, walk_state, &(node)); ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, walk_state, &(node));
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
/* /*
...@@ -172,13 +179,15 @@ acpi_ps_display_object_pathname ( ...@@ -172,13 +179,15 @@ acpi_ps_display_object_pathname (
/* Convert Named_desc/handle to a full pathname */ /* Convert Named_desc/handle to a full pathname */
status = acpi_ns_handle_to_pathname (node, &buffer_size, buffer); buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER;
status = acpi_ns_handle_to_pathname (node, &buffer);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
acpi_os_printf ("****Could not get pathname****)"); acpi_os_printf ("****Could not get pathname****)");
goto exit; goto exit;
} }
acpi_os_printf (" (Path %s)", buffer); acpi_os_printf (" (Path %s)", buffer.pointer);
ACPI_MEM_FREE (buffer.pointer);
exit: exit:
...@@ -219,9 +228,14 @@ acpi_db_display_op ( ...@@ -219,9 +228,14 @@ acpi_db_display_op (
u32 j; u32 j;
if (op) { if (!op) {
acpi_db_display_opcode (walk_state, op);
return;
}
while (op) { while (op) {
/* indentation */ /* Indentation */
depth_count = 0; depth_count = 0;
if (!acpi_gbl_db_opt_verbose) { if (!acpi_gbl_db_opt_verbose) {
...@@ -243,7 +257,6 @@ acpi_db_display_op ( ...@@ -243,7 +257,6 @@ acpi_db_display_op (
depth_count++; depth_count++;
} }
/* Open a new block if we are nested further than last time */ /* Open a new block if we are nested further than last time */
if (depth_count > last_depth) { if (depth_count > last_depth) {
...@@ -289,7 +302,6 @@ acpi_db_display_op ( ...@@ -289,7 +302,6 @@ acpi_db_display_op (
acpi_os_printf ("%s", acpi_gbl_db_disasm_indent); acpi_os_printf ("%s", acpi_gbl_db_disasm_indent);
} }
/* Now print the opcode */ /* Now print the opcode */
acpi_db_display_opcode (walk_state, op); acpi_db_display_opcode (walk_state, op);
...@@ -326,12 +338,6 @@ acpi_db_display_op ( ...@@ -326,12 +338,6 @@ acpi_db_display_op (
acpi_os_printf ("}\n"); acpi_os_printf ("}\n");
depth_count--; depth_count--;
} }
}
else {
acpi_db_display_opcode (walk_state, op);
}
} }
...@@ -352,7 +358,6 @@ acpi_db_display_namestring ( ...@@ -352,7 +358,6 @@ acpi_db_display_namestring (
NATIVE_CHAR *name) NATIVE_CHAR *name)
{ {
u32 seg_count; u32 seg_count;
u8 do_dot = FALSE;
if (!name) { if (!name) {
...@@ -360,21 +365,27 @@ acpi_db_display_namestring ( ...@@ -360,21 +365,27 @@ acpi_db_display_namestring (
return; return;
} }
if (acpi_ps_is_prefix_char (GET8 (name))) { /* Handle all Scope Prefix operators */
/* append prefix character */
acpi_os_printf ("%1c", GET8 (name)); while (acpi_ps_is_prefix_char (ACPI_GET8 (name))) {
/* Append prefix character */
acpi_os_printf ("%1c", ACPI_GET8 (name));
name++; name++;
} }
switch (GET8 (name)) { switch (ACPI_GET8 (name)) {
case 0:
seg_count = 0;
break;
case AML_DUAL_NAME_PREFIX: case AML_DUAL_NAME_PREFIX:
seg_count = 2; seg_count = 2;
name++; name++;
break; break;
case AML_MULTI_NAME_PREFIX_OP: case AML_MULTI_NAME_PREFIX_OP:
seg_count = (u32) GET8 (name + 1); seg_count = (u32) ACPI_GET8 (name + 1);
name += 2; name += 2;
break; break;
...@@ -383,19 +394,18 @@ acpi_db_display_namestring ( ...@@ -383,19 +394,18 @@ acpi_db_display_namestring (
break; break;
} }
while (seg_count--) { while (seg_count) {
/* append Name segment */ /* Append Name segment */
if (do_dot) { acpi_os_printf ("%4.4s", name);
/* append dot */
seg_count--;
if (seg_count) {
/* Not last name, append dot separator */
acpi_os_printf ("."); acpi_os_printf (".");
} }
name += ACPI_NAME_SIZE;
acpi_os_printf ("%4.4s", name);
do_dot = TRUE;
name += 4;
} }
} }
...@@ -433,7 +443,6 @@ acpi_db_display_path ( ...@@ -433,7 +443,6 @@ acpi_db_display_path (
return; return;
} }
if (op_info->flags & AML_CREATE) { if (op_info->flags & AML_CREATE) {
/* Field creation - check for a fully qualified namepath */ /* Field creation - check for a fully qualified namepath */
...@@ -492,7 +501,6 @@ acpi_db_display_path ( ...@@ -492,7 +501,6 @@ acpi_db_display_path (
acpi_os_printf ("%4.4s", name_path->value.string); acpi_os_printf ("%4.4s", name_path->value.string);
} }
} }
else { else {
name = acpi_ps_get_name (search); name = acpi_ps_get_name (search);
acpi_os_printf ("%4.4s", &name); acpi_os_printf ("%4.4s", &name);
...@@ -538,21 +546,17 @@ acpi_db_display_opcode ( ...@@ -538,21 +546,17 @@ acpi_db_display_opcode (
acpi_os_printf ("<NULL OP PTR>"); acpi_os_printf ("<NULL OP PTR>");
} }
/* op and arguments */ /* op and arguments */
switch (op->opcode) { switch (op->opcode) {
case AML_BYTE_OP: case AML_BYTE_OP:
if (acpi_gbl_db_opt_verbose) { if (acpi_gbl_db_opt_verbose) {
acpi_os_printf ("(u8) 0x%2.2X", op->value.integer8); acpi_os_printf ("(u8) 0x%2.2X", op->value.integer8);
} }
else { else {
acpi_os_printf ("0x%2.2X", op->value.integer8); acpi_os_printf ("0x%2.2X", op->value.integer8);
} }
break; break;
...@@ -561,11 +565,9 @@ acpi_db_display_opcode ( ...@@ -561,11 +565,9 @@ acpi_db_display_opcode (
if (acpi_gbl_db_opt_verbose) { if (acpi_gbl_db_opt_verbose) {
acpi_os_printf ("(u16) 0x%4.4X", op->value.integer16); acpi_os_printf ("(u16) 0x%4.4X", op->value.integer16);
} }
else { else {
acpi_os_printf ("0x%4.4X", op->value.integer16); acpi_os_printf ("0x%4.4X", op->value.integer16);
} }
break; break;
...@@ -574,11 +576,9 @@ acpi_db_display_opcode ( ...@@ -574,11 +576,9 @@ acpi_db_display_opcode (
if (acpi_gbl_db_opt_verbose) { if (acpi_gbl_db_opt_verbose) {
acpi_os_printf ("(u32) 0x%8.8X", op->value.integer32); acpi_os_printf ("(u32) 0x%8.8X", op->value.integer32);
} }
else { else {
acpi_os_printf ("0x%8.8X", op->value.integer32); acpi_os_printf ("0x%8.8X", op->value.integer32);
} }
break; break;
...@@ -588,12 +588,10 @@ acpi_db_display_opcode ( ...@@ -588,12 +588,10 @@ acpi_db_display_opcode (
acpi_os_printf ("(u64) 0x%8.8X%8.8X", op->value.integer64.hi, acpi_os_printf ("(u64) 0x%8.8X%8.8X", op->value.integer64.hi,
op->value.integer64.lo); op->value.integer64.lo);
} }
else { else {
acpi_os_printf ("0x%8.8X%8.8X", op->value.integer64.hi, acpi_os_printf ("0x%8.8X%8.8X", op->value.integer64.hi,
op->value.integer64.lo); op->value.integer64.lo);
} }
break; break;
...@@ -602,11 +600,9 @@ acpi_db_display_opcode ( ...@@ -602,11 +600,9 @@ acpi_db_display_opcode (
if (op->value.string) { if (op->value.string) {
acpi_os_printf ("\"%s\"", op->value.string); acpi_os_printf ("\"%s\"", op->value.string);
} }
else { else {
acpi_os_printf ("<\"NULL STRING PTR\">"); acpi_os_printf ("<\"NULL STRING PTR\">");
} }
break; break;
...@@ -615,11 +611,9 @@ acpi_db_display_opcode ( ...@@ -615,11 +611,9 @@ acpi_db_display_opcode (
if (op->value.string) { if (op->value.string) {
acpi_os_printf ("\"%s\"", op->value.string); acpi_os_printf ("\"%s\"", op->value.string);
} }
else { else {
acpi_os_printf ("\"<NULL STATIC STRING PTR>\""); acpi_os_printf ("\"<NULL STATIC STRING PTR>\"");
} }
break; break;
...@@ -652,7 +646,6 @@ acpi_db_display_opcode ( ...@@ -652,7 +646,6 @@ acpi_db_display_opcode (
if (acpi_gbl_db_opt_verbose) { if (acpi_gbl_db_opt_verbose) {
acpi_os_printf ("Byte_list (Length 0x%8.8X) ", op->value.integer32); acpi_os_printf ("Byte_list (Length 0x%8.8X) ", op->value.integer32);
} }
else { else {
acpi_os_printf ("0x%2.2X", op->value.integer32); acpi_os_printf ("0x%2.2X", op->value.integer32);
...@@ -663,7 +656,6 @@ acpi_db_display_opcode ( ...@@ -663,7 +656,6 @@ acpi_db_display_opcode (
acpi_os_printf (", 0x%2.2X", byte_data[i]); acpi_os_printf (", 0x%2.2X", byte_data[i]);
} }
} }
break; break;
...@@ -682,7 +674,6 @@ acpi_db_display_opcode ( ...@@ -682,7 +674,6 @@ acpi_db_display_opcode (
acpi_db_decode_internal_object (walk_state->results->results.obj_desc [walk_state->results->results.num_results-1]); acpi_db_decode_internal_object (walk_state->results->results.obj_desc [walk_state->results->results.num_results-1]);
} }
#endif #endif
break; break;
} }
...@@ -702,14 +693,11 @@ acpi_db_display_opcode ( ...@@ -702,14 +693,11 @@ acpi_db_display_opcode (
name = acpi_ps_get_name (op); name = acpi_ps_get_name (op);
acpi_os_printf (" %4.4s", &name); acpi_os_printf (" %4.4s", &name);
if (acpi_gbl_db_opt_verbose) { if ((acpi_gbl_db_opt_verbose) && (op->opcode != AML_INT_NAMEDFIELD_OP)) {
acpi_os_printf (" (Path \\"); acpi_ps_display_object_pathname (walk_state, op);
acpi_db_display_path (op);
acpi_os_printf (")");
} }
} }
} }
#endif /* ENABLE_DEBUGGER */ #endif /* ENABLE_DEBUGGER */
/******************************************************************************* /*******************************************************************************
* *
* Module Name: dbdisply - debug display commands * Module Name: dbdisply - debug display commands
* $Revision: 57 $ * $Revision: 66 $
* *
******************************************************************************/ ******************************************************************************/
/* /*
* Copyright (C) 2000, 2001 R. Byron Moore * Copyright (C) 2000 - 2002, R. Byron Moore
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
#define _COMPONENT ACPI_DEBUGGER #define _COMPONENT ACPI_DEBUGGER
MODULE_NAME ("dbdisply") ACPI_MODULE_NAME ("dbdisply")
/****************************************************************************** /******************************************************************************
...@@ -75,8 +75,7 @@ acpi_db_get_pointer ( ...@@ -75,8 +75,7 @@ acpi_db_get_pointer (
/* Simple flat pointer */ /* Simple flat pointer */
obj_ptr = (void *) STRTOUL (target, NULL, 16); obj_ptr = ACPI_TO_POINTER (ACPI_STRTOUL (target, NULL, 16));
#endif #endif
return (obj_ptr); return (obj_ptr);
...@@ -107,7 +106,7 @@ acpi_db_dump_parser_descriptor ( ...@@ -107,7 +106,7 @@ acpi_db_dump_parser_descriptor (
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->opcode);
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->value);
acpi_os_printf ("%20.20s : %p\n", "Parent", op->parent); acpi_os_printf ("%20.20s : %p\n", "Parent", op->parent);
...@@ -136,6 +135,7 @@ acpi_db_decode_and_display_object ( ...@@ -136,6 +135,7 @@ acpi_db_decode_and_display_object (
{ {
void *obj_ptr; void *obj_ptr;
acpi_namespace_node *node; acpi_namespace_node *node;
acpi_operand_object *obj_desc;
u32 display = DB_BYTE_DISPLAY; u32 display = DB_BYTE_DISPLAY;
NATIVE_CHAR buffer[80]; NATIVE_CHAR buffer[80];
acpi_buffer ret_buf; acpi_buffer ret_buf;
...@@ -150,7 +150,7 @@ acpi_db_decode_and_display_object ( ...@@ -150,7 +150,7 @@ acpi_db_decode_and_display_object (
/* Decode the output type */ /* Decode the output type */
if (output_type) { if (output_type) {
STRUPR (output_type); ACPI_STRUPR (output_type);
if (output_type[0] == 'W') { if (output_type[0] == 'W') {
display = DB_WORD_DISPLAY; display = DB_WORD_DISPLAY;
} }
...@@ -162,7 +162,6 @@ acpi_db_decode_and_display_object ( ...@@ -162,7 +162,6 @@ acpi_db_decode_and_display_object (
} }
} }
ret_buf.length = sizeof (buffer); ret_buf.length = sizeof (buffer);
ret_buf.pointer = buffer; ret_buf.pointer = buffer;
...@@ -177,8 +176,10 @@ acpi_db_decode_and_display_object ( ...@@ -177,8 +176,10 @@ acpi_db_decode_and_display_object (
/* Decode the object type */ /* Decode the object type */
if (VALID_DESCRIPTOR_TYPE ((obj_ptr), ACPI_DESC_TYPE_NAMED)) { switch (ACPI_GET_DESCRIPTOR_TYPE (obj_ptr)) {
/* This is a Node */ case ACPI_DESC_TYPE_NAMED:
/* This is a namespace Node */
if (!acpi_os_readable (obj_ptr, sizeof (acpi_namespace_node))) { if (!acpi_os_readable (obj_ptr, sizeof (acpi_namespace_node))) {
acpi_os_printf ("Cannot read entire Named object at address %p\n", obj_ptr); acpi_os_printf ("Cannot read entire Named object at address %p\n", obj_ptr);
...@@ -187,10 +188,11 @@ acpi_db_decode_and_display_object ( ...@@ -187,10 +188,11 @@ acpi_db_decode_and_display_object (
node = obj_ptr; node = obj_ptr;
goto dump_nte; goto dump_nte;
}
else if (VALID_DESCRIPTOR_TYPE ((obj_ptr), ACPI_DESC_TYPE_INTERNAL)) {
/* This is an ACPI OBJECT */ case ACPI_DESC_TYPE_INTERNAL:
/* This is a ACPI OPERAND OBJECT */
if (!acpi_os_readable (obj_ptr, sizeof (acpi_operand_object))) { if (!acpi_os_readable (obj_ptr, sizeof (acpi_operand_object))) {
acpi_os_printf ("Cannot read entire ACPI object at address %p\n", obj_ptr); acpi_os_printf ("Cannot read entire ACPI object at address %p\n", obj_ptr);
...@@ -199,22 +201,27 @@ acpi_db_decode_and_display_object ( ...@@ -199,22 +201,27 @@ acpi_db_decode_and_display_object (
acpi_ut_dump_buffer (obj_ptr, sizeof (acpi_operand_object), display, ACPI_UINT32_MAX); acpi_ut_dump_buffer (obj_ptr, sizeof (acpi_operand_object), display, ACPI_UINT32_MAX);
acpi_ex_dump_object_descriptor (obj_ptr, 1); acpi_ex_dump_object_descriptor (obj_ptr, 1);
} break;
else if (VALID_DESCRIPTOR_TYPE ((obj_ptr), ACPI_DESC_TYPE_PARSER)) {
/* This is an Parser Op object */ case ACPI_DESC_TYPE_PARSER:
/* This is a Parser Op object */
if (!acpi_os_readable (obj_ptr, sizeof (acpi_parse_object))) { if (!acpi_os_readable (obj_ptr, sizeof (acpi_parse_object))) {
acpi_os_printf ("Cannot read entire Parser object at address %p\n", obj_ptr); acpi_os_printf ("Cannot read entire Parser object at address %p\n", obj_ptr);
return; return;
} }
acpi_ut_dump_buffer (obj_ptr, sizeof (acpi_parse_object), display, ACPI_UINT32_MAX); acpi_ut_dump_buffer (obj_ptr, sizeof (acpi_parse_object), display, ACPI_UINT32_MAX);
acpi_db_dump_parser_descriptor ((acpi_parse_object *) obj_ptr); acpi_db_dump_parser_descriptor ((acpi_parse_object *) obj_ptr);
} break;
default:
/* Is not a recognizeable object */
else {
size = 16; size = 16;
if (acpi_os_readable (obj_ptr, 64)) { if (acpi_os_readable (obj_ptr, 64)) {
size = 64; size = 64;
...@@ -223,12 +230,12 @@ acpi_db_decode_and_display_object ( ...@@ -223,12 +230,12 @@ acpi_db_decode_and_display_object (
/* Just dump some memory */ /* Just dump some memory */
acpi_ut_dump_buffer (obj_ptr, size, display, ACPI_UINT32_MAX); acpi_ut_dump_buffer (obj_ptr, size, display, ACPI_UINT32_MAX);
break;
} }
return; return;
} }
/* The parameter is a name string that must be resolved to a Named obj */ /* The parameter is a name string that must be resolved to a Named obj */
node = acpi_db_local_ns_lookup (target); node = acpi_db_local_ns_lookup (target);
...@@ -257,15 +264,16 @@ acpi_db_decode_and_display_object ( ...@@ -257,15 +264,16 @@ acpi_db_decode_and_display_object (
acpi_ut_dump_buffer ((void *) node, sizeof (acpi_namespace_node), display, ACPI_UINT32_MAX); acpi_ut_dump_buffer ((void *) node, sizeof (acpi_namespace_node), display, ACPI_UINT32_MAX);
acpi_ex_dump_node (node, 1); acpi_ex_dump_node (node, 1);
if (node->object) { obj_desc = acpi_ns_get_attached_object (node);
acpi_os_printf ("\n_attached Object (%p):\n", node->object); if (obj_desc) {
if (!acpi_os_readable (node->object, sizeof (acpi_operand_object))) { acpi_os_printf ("\n_attached Object (%p):\n", obj_desc);
acpi_os_printf ("Invalid internal ACPI Object at address %p\n", node->object); if (!acpi_os_readable (obj_desc, sizeof (acpi_operand_object))) {
acpi_os_printf ("Invalid internal ACPI Object at address %p\n", obj_desc);
return; return;
} }
acpi_ut_dump_buffer ((void *) node->object, sizeof (acpi_operand_object), display, ACPI_UINT32_MAX); acpi_ut_dump_buffer ((void *) obj_desc, sizeof (acpi_operand_object), display, ACPI_UINT32_MAX);
acpi_ex_dump_object_descriptor (node->object, 1); acpi_ex_dump_object_descriptor (obj_desc, 1);
} }
} }
...@@ -298,8 +306,8 @@ acpi_db_decode_internal_object ( ...@@ -298,8 +306,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", HIDWORD (obj_desc->integer.value), acpi_os_printf (" %.8X%.8X", ACPI_HIDWORD (obj_desc->integer.value),
LODWORD (obj_desc->integer.value)); ACPI_LODWORD (obj_desc->integer.value));
break; break;
...@@ -358,26 +366,32 @@ acpi_db_display_internal_object ( ...@@ -358,26 +366,32 @@ acpi_db_display_internal_object (
return; return;
} }
/* Decode the object type */ /* Decode the object type */
else if (VALID_DESCRIPTOR_TYPE (obj_desc, ACPI_DESC_TYPE_PARSER)) { switch (ACPI_GET_DESCRIPTOR_TYPE (obj_desc)) {
case ACPI_DESC_TYPE_PARSER:
acpi_os_printf ("<Parser> "); acpi_os_printf ("<Parser> ");
} break;
case ACPI_DESC_TYPE_NAMED:
else if (VALID_DESCRIPTOR_TYPE (obj_desc, 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,
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) {
acpi_os_printf (" [Method Arg]"); acpi_os_printf (" [Method Arg]");
} }
if (((acpi_namespace_node *) obj_desc)->flags & ANOBJ_METHOD_LOCAL) { if (((acpi_namespace_node *) obj_desc)->flags & ANOBJ_METHOD_LOCAL) {
acpi_os_printf (" [Method Local]"); acpi_os_printf (" [Method Local]");
} }
} break;
case ACPI_DESC_TYPE_INTERNAL:
else if (VALID_DESCRIPTOR_TYPE (obj_desc, ACPI_DESC_TYPE_INTERNAL)) {
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 %x [Invalid Type]", type);
...@@ -444,12 +458,16 @@ acpi_db_display_internal_object ( ...@@ -444,12 +458,16 @@ acpi_db_display_internal_object (
acpi_db_decode_internal_object (obj_desc); acpi_db_decode_internal_object (obj_desc);
break; break;
} }
} break;
default:
else {
acpi_os_printf ("<Not a valid ACPI Object Descriptor> "); acpi_os_printf ("<Not a valid ACPI Object Descriptor> ");
break;
} }
acpi_os_printf ("\n"); acpi_os_printf ("\n");
} }
...@@ -546,7 +564,6 @@ acpi_db_display_method_info ( ...@@ -546,7 +564,6 @@ acpi_db_display_method_info (
break; break;
} }
op = acpi_ps_get_depth_next (start_op, op); op = acpi_ps_get_depth_next (start_op, op);
} }
...@@ -587,8 +604,6 @@ acpi_db_display_locals (void) ...@@ -587,8 +604,6 @@ 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);
for (i = 0; i < MTH_NUM_LOCALS; i++) { for (i = 0; i < MTH_NUM_LOCALS; i++) {
...@@ -634,7 +649,8 @@ acpi_db_display_arguments (void) ...@@ -634,7 +649,8 @@ acpi_db_display_arguments (void)
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 ("Method [%4.4s] has %X arguments, max concurrency = %X\n", &node->name, num_args, concurrency); acpi_os_printf ("Method [%4.4s] has %X arguments, max concurrency = %X\n",
&node->name, 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;
...@@ -679,7 +695,8 @@ acpi_db_display_results (void) ...@@ -679,7 +695,8 @@ acpi_db_display_results (void)
num_results = walk_state->results->results.num_results; num_results = walk_state->results->results.num_results;
} }
acpi_os_printf ("Method [%4.4s] has %X stacked result objects\n", &node->name, num_results); acpi_os_printf ("Method [%4.4s] has %X stacked result objects\n",
&node->name, 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];
...@@ -716,7 +733,6 @@ acpi_db_display_calling_tree (void) ...@@ -716,7 +733,6 @@ 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++) { for (i = 0; walk_state; i++) {
...@@ -740,6 +756,10 @@ acpi_db_display_calling_tree (void) ...@@ -740,6 +756,10 @@ acpi_db_display_calling_tree (void)
* *
* DESCRIPTION: Display the result of an AML opcode * DESCRIPTION: Display the result of an AML opcode
* *
* Note: Curently only displays the result object if we are single stepping.
* However, this output may be useful in other contexts and could be enabled
* to do so if needed.
*
******************************************************************************/ ******************************************************************************/
void void
...@@ -748,10 +768,8 @@ acpi_db_display_result_object ( ...@@ -748,10 +768,8 @@ acpi_db_display_result_object (
acpi_walk_state *walk_state) acpi_walk_state *walk_state)
{ {
/* TBD: [Future] We don't always want to display the result. /* Only display if single stepping */
* For now, only display if single stepping
* however, this output is very useful in other contexts also
*/
if (!acpi_gbl_cm_single_step) { if (!acpi_gbl_cm_single_step) {
return; return;
} }
...@@ -781,7 +799,6 @@ acpi_db_display_argument_object ( ...@@ -781,7 +799,6 @@ acpi_db_display_argument_object (
acpi_walk_state *walk_state) acpi_walk_state *walk_state)
{ {
if (!acpi_gbl_cm_single_step) { if (!acpi_gbl_cm_single_step) {
return; return;
} }
......
/******************************************************************************* /*******************************************************************************
* *
* Module Name: dbexec - debugger control method execution * Module Name: dbexec - debugger control method execution
* $Revision: 34 $ * $Revision: 39 $
* *
******************************************************************************/ ******************************************************************************/
/* /*
* Copyright (C) 2000, 2001 R. Byron Moore * Copyright (C) 2000 - 2002, R. Byron Moore
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
...@@ -38,10 +38,10 @@ ...@@ -38,10 +38,10 @@
#ifdef ENABLE_DEBUGGER #ifdef ENABLE_DEBUGGER
#define _COMPONENT ACPI_DEBUGGER #define _COMPONENT ACPI_DEBUGGER
MODULE_NAME ("dbexec") ACPI_MODULE_NAME ("dbexec")
db_method_info acpi_gbl_db_method_info; acpi_db_method_info acpi_gbl_db_method_info;
/******************************************************************************* /*******************************************************************************
...@@ -59,7 +59,7 @@ db_method_info acpi_gbl_db_method_info; ...@@ -59,7 +59,7 @@ db_method_info acpi_gbl_db_method_info;
acpi_status acpi_status
acpi_db_execute_method ( acpi_db_execute_method (
db_method_info *info, acpi_db_method_info *info,
acpi_buffer *return_obj) acpi_buffer *return_obj)
{ {
acpi_status status; acpi_status status;
...@@ -77,13 +77,12 @@ acpi_db_execute_method ( ...@@ -77,13 +77,12 @@ acpi_db_execute_method (
if (info->args && info->args[0]) { if (info->args && info->args[0]) {
for (i = 0; info->args[i] && i < MTH_NUM_ARGS; i++) { for (i = 0; info->args[i] && i < MTH_NUM_ARGS; i++) {
params[i].type = ACPI_TYPE_INTEGER; params[i].type = ACPI_TYPE_INTEGER;
params[i].integer.value = STRTOUL (info->args[i], NULL, 16); params[i].integer.value = ACPI_STRTOUL (info->args[i], NULL, 16);
} }
param_objects.pointer = params; param_objects.pointer = params;
param_objects.count = i; param_objects.count = i;
} }
else { else {
/* Setup default parameters */ /* Setup default parameters */
...@@ -103,7 +102,6 @@ acpi_db_execute_method ( ...@@ -103,7 +102,6 @@ acpi_db_execute_method (
return_obj->pointer = acpi_gbl_db_buffer; return_obj->pointer = acpi_gbl_db_buffer;
return_obj->length = ACPI_DEBUG_BUFFER_SIZE; return_obj->length = ACPI_DEBUG_BUFFER_SIZE;
/* Do the actual method execution */ /* Do the actual method execution */
status = acpi_evaluate_object (NULL, info->pathname, &param_objects, return_obj); status = acpi_evaluate_object (NULL, info->pathname, &param_objects, return_obj);
...@@ -129,7 +127,7 @@ acpi_db_execute_method ( ...@@ -129,7 +127,7 @@ acpi_db_execute_method (
void void
acpi_db_execute_setup ( acpi_db_execute_setup (
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 */
...@@ -137,24 +135,24 @@ acpi_db_execute_setup ( ...@@ -137,24 +135,24 @@ acpi_db_execute_setup (
info->pathname[0] = 0; info->pathname[0] = 0;
if ((info->name[0] != '\\') && if ((info->name[0] != '\\') &&
(info->name[0] != '/')) { (info->name[0] != '/')) {
STRCAT (info->pathname, acpi_gbl_db_scope_buf); ACPI_STRCAT (info->pathname, acpi_gbl_db_scope_buf);
} }
STRCAT (info->pathname, info->name); ACPI_STRCAT (info->pathname, info->name);
acpi_db_prep_namestring (info->pathname); acpi_db_prep_namestring (info->pathname);
acpi_db_set_output_destination (DB_DUPLICATE_OUTPUT); acpi_db_set_output_destination (ACPI_DB_DUPLICATE_OUTPUT);
acpi_os_printf ("Executing %s\n", info->pathname); acpi_os_printf ("Executing %s\n", info->pathname);
if (info->flags & EX_SINGLE_STEP) { if (info->flags & EX_SINGLE_STEP) {
acpi_gbl_cm_single_step = TRUE; acpi_gbl_cm_single_step = TRUE;
acpi_db_set_output_destination (DB_CONSOLE_OUTPUT); acpi_db_set_output_destination (ACPI_DB_CONSOLE_OUTPUT);
} }
else { else {
/* No single step, allow redirection to a file */ /* No single step, allow redirection to a file */
acpi_db_set_output_destination (DB_REDIRECTABLE_OUTPUT); acpi_db_set_output_destination (ACPI_DB_REDIRECTABLE_OUTPUT);
} }
} }
...@@ -176,11 +174,11 @@ acpi_db_execute_setup ( ...@@ -176,11 +174,11 @@ acpi_db_execute_setup (
u32 u32
acpi_db_get_outstanding_allocations (void) acpi_db_get_outstanding_allocations (void)
{ {
u32 i;
u32 outstanding = 0; u32 outstanding = 0;
#ifdef ACPI_DBG_TRACK_ALLOCATIONS #ifdef ACPI_DBG_TRACK_ALLOCATIONS
u32 i;
for (i = ACPI_MEM_LIST_FIRST_CACHE_LIST; i < ACPI_NUM_MEM_LISTS; i++) { for (i = ACPI_MEM_LIST_FIRST_CACHE_LIST; i < ACPI_NUM_MEM_LISTS; i++) {
outstanding += (acpi_gbl_memory_lists[i].total_allocated - outstanding += (acpi_gbl_memory_lists[i].total_allocated -
...@@ -248,7 +246,7 @@ acpi_db_execute ( ...@@ -248,7 +246,7 @@ acpi_db_execute (
allocations = acpi_db_get_outstanding_allocations () - previous_allocations; allocations = acpi_db_get_outstanding_allocations () - previous_allocations;
acpi_db_set_output_destination (DB_DUPLICATE_OUTPUT); acpi_db_set_output_destination (ACPI_DB_DUPLICATE_OUTPUT);
if (allocations > 0) { if (allocations > 0) {
acpi_os_printf ("Outstanding: %ld allocations after execution\n", acpi_os_printf ("Outstanding: %ld allocations after execution\n",
...@@ -271,7 +269,7 @@ acpi_db_execute ( ...@@ -271,7 +269,7 @@ acpi_db_execute (
} }
} }
acpi_db_set_output_destination (DB_CONSOLE_OUTPUT); acpi_db_set_output_destination (ACPI_DB_CONSOLE_OUTPUT);
} }
...@@ -288,12 +286,12 @@ acpi_db_execute ( ...@@ -288,12 +286,12 @@ acpi_db_execute (
* *
******************************************************************************/ ******************************************************************************/
void void ACPI_SYSTEM_XFACE
acpi_db_method_thread ( acpi_db_method_thread (
void *context) void *context)
{ {
acpi_status status; acpi_status status;
db_method_info *info = context; acpi_db_method_info *info = context;
u32 i; u32 i;
acpi_buffer return_obj; acpi_buffer return_obj;
...@@ -344,15 +342,14 @@ acpi_db_create_execution_threads ( ...@@ -344,15 +342,14 @@ acpi_db_create_execution_threads (
/* Get the arguments */ /* Get the arguments */
num_threads = STRTOUL (num_threads_arg, NULL, 0); num_threads = ACPI_STRTOUL (num_threads_arg, NULL, 0);
num_loops = STRTOUL (num_loops_arg, NULL, 0); num_loops = ACPI_STRTOUL (num_loops_arg, NULL, 0);
if (!num_threads || !num_loops) { if (!num_threads || !num_loops) {
acpi_os_printf ("Bad argument: Threads %X, Loops %X\n", num_threads, num_loops); acpi_os_printf ("Bad argument: Threads %X, Loops %X\n", num_threads, num_loops);
return; return;
} }
/* Create the synchronization semaphore */ /* Create the synchronization semaphore */
status = acpi_os_create_semaphore (1, 0, &thread_gate); status = acpi_os_create_semaphore (1, 0, &thread_gate);
...@@ -371,7 +368,6 @@ acpi_db_create_execution_threads ( ...@@ -371,7 +368,6 @@ acpi_db_create_execution_threads (
acpi_db_execute_setup (&acpi_gbl_db_method_info); acpi_db_execute_setup (&acpi_gbl_db_method_info);
/* Create the threads */ /* Create the 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);
...@@ -380,7 +376,6 @@ acpi_db_create_execution_threads ( ...@@ -380,7 +376,6 @@ acpi_db_create_execution_threads (
acpi_os_queue_for_execution (OSD_PRIORITY_MED, acpi_db_method_thread, &acpi_gbl_db_method_info); acpi_os_queue_for_execution (OSD_PRIORITY_MED, acpi_db_method_thread, &acpi_gbl_db_method_info);
} }
/* Wait for all threads to complete */ /* Wait for all threads to complete */
i = num_threads; i = num_threads;
...@@ -393,9 +388,9 @@ acpi_db_create_execution_threads ( ...@@ -393,9 +388,9 @@ acpi_db_create_execution_threads (
acpi_os_delete_semaphore (thread_gate); acpi_os_delete_semaphore (thread_gate);
acpi_db_set_output_destination (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);
acpi_db_set_output_destination (DB_CONSOLE_OUTPUT); acpi_db_set_output_destination (ACPI_DB_CONSOLE_OUTPUT);
} }
......
...@@ -2,12 +2,12 @@ ...@@ -2,12 +2,12 @@
* *
* 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: 53 $ * $Revision: 59 $
* *
******************************************************************************/ ******************************************************************************/
/* /*
* Copyright (C) 2000, 2001 R. Byron Moore * Copyright (C) 2000 - 2002, R. Byron Moore
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
#ifdef ENABLE_DEBUGGER #ifdef ENABLE_DEBUGGER
#define _COMPONENT ACPI_DEBUGGER #define _COMPONENT ACPI_DEBUGGER
MODULE_NAME ("dbfileio") ACPI_MODULE_NAME ("dbfileio")
/* /*
...@@ -64,7 +64,7 @@ acpi_table_header *acpi_gbl_db_table_ptr = NULL; ...@@ -64,7 +64,7 @@ acpi_table_header *acpi_gbl_db_table_ptr = NULL;
* *
******************************************************************************/ ******************************************************************************/
acpi_object_type8 acpi_object_type
acpi_db_match_argument ( acpi_db_match_argument (
NATIVE_CHAR *user_argument, NATIVE_CHAR *user_argument,
ARGUMENT_INFO *arguments) ARGUMENT_INFO *arguments)
...@@ -77,8 +77,8 @@ acpi_db_match_argument ( ...@@ -77,8 +77,8 @@ acpi_db_match_argument (
} }
for (i = 0; arguments[i].name; i++) { for (i = 0; arguments[i].name; i++) {
if (STRSTR (arguments[i].name, user_argument) == arguments[i].name) { if (ACPI_STRSTR (arguments[i].name, user_argument) == arguments[i].name) {
return ((acpi_object_type8) i); return (i);
} }
} }
...@@ -141,7 +141,7 @@ acpi_db_open_debug_file ( ...@@ -141,7 +141,7 @@ acpi_db_open_debug_file (
acpi_gbl_debug_file = fopen (name, "w+"); acpi_gbl_debug_file = fopen (name, "w+");
if (acpi_gbl_debug_file) { if (acpi_gbl_debug_file) {
acpi_os_printf ("Debug output file %s opened\n", name); acpi_os_printf ("Debug output file %s opened\n", name);
STRCPY (acpi_gbl_db_debug_filename, name); ACPI_STRCPY (acpi_gbl_db_debug_filename, name);
acpi_gbl_db_output_to_file = TRUE; acpi_gbl_db_output_to_file = TRUE;
} }
else { else {
...@@ -200,11 +200,11 @@ acpi_db_load_table( ...@@ -200,11 +200,11 @@ acpi_db_load_table(
/* We only support a limited number of table types */ /* We only support a limited number of table types */
if (STRNCMP ((char *) table_header.signature, DSDT_SIG, 4) && if (ACPI_STRNCMP ((char *) table_header.signature, DSDT_SIG, 4) &&
STRNCMP ((char *) table_header.signature, PSDT_SIG, 4) && ACPI_STRNCMP ((char *) table_header.signature, PSDT_SIG, 4) &&
STRNCMP ((char *) table_header.signature, SSDT_SIG, 4)) { ACPI_STRNCMP ((char *) table_header.signature, SSDT_SIG, 4)) {
acpi_os_printf ("Table signature is invalid\n"); acpi_os_printf ("Table signature is invalid\n");
DUMP_BUFFER (&table_header, sizeof (acpi_table_header)); ACPI_DUMP_BUFFER (&table_header, sizeof (acpi_table_header));
return (AE_ERROR); return (AE_ERROR);
} }
...@@ -224,7 +224,7 @@ acpi_db_load_table( ...@@ -224,7 +224,7 @@ acpi_db_load_table(
/* Copy the header to the buffer */ /* Copy the header to the buffer */
MEMCPY (*table_ptr, &table_header, sizeof (table_header)); ACPI_MEMCPY (*table_ptr, &table_header, sizeof (table_header));
/* Get the rest of the table */ /* Get the rest of the table */
...@@ -275,7 +275,7 @@ ae_local_load_table ( ...@@ -275,7 +275,7 @@ ae_local_load_table (
acpi_table_desc table_info; acpi_table_desc table_info;
FUNCTION_TRACE ("Ae_local_load_table"); ACPI_FUNCTION_TRACE ("Ae_local_load_table");
if (!table_ptr) { if (!table_ptr) {
return_ACPI_STATUS (AE_BAD_PARAMETER); return_ACPI_STATUS (AE_BAD_PARAMETER);
...@@ -354,7 +354,7 @@ acpi_db_load_acpi_table ( ...@@ -354,7 +354,7 @@ acpi_db_load_acpi_table (
status = ae_local_load_table (acpi_gbl_db_table_ptr); status = ae_local_load_table (acpi_gbl_db_table_ptr);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
if (status == AE_EXIST) { 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);
} }
...@@ -363,7 +363,6 @@ acpi_db_load_acpi_table ( ...@@ -363,7 +363,6 @@ acpi_db_load_acpi_table (
acpi_format_exception (status)); acpi_format_exception (status));
} }
acpi_os_free (acpi_gbl_db_table_ptr);
return (status); return (status);
} }
......
/****************************************************************************** /******************************************************************************
* *
* Module Name: dbhistry - debugger HISTORY command * Module Name: dbhistry - debugger HISTORY command
* $Revision: 19 $ * $Revision: 22 $
* *
*****************************************************************************/ *****************************************************************************/
/* /*
* Copyright (C) 2000, 2001 R. Byron Moore * Copyright (C) 2000 - 2002, R. Byron Moore
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
#ifdef ENABLE_DEBUGGER #ifdef ENABLE_DEBUGGER
#define _COMPONENT ACPI_DEBUGGER #define _COMPONENT ACPI_DEBUGGER
MODULE_NAME ("dbhistry") ACPI_MODULE_NAME ("dbhistry")
#define HI_NO_HISTORY 0 #define HI_NO_HISTORY 0
...@@ -78,10 +78,9 @@ acpi_db_add_to_history ( ...@@ -78,10 +78,9 @@ acpi_db_add_to_history (
NATIVE_CHAR *command_line) NATIVE_CHAR *command_line)
{ {
/* Put command into the next available slot */ /* Put command into the next available slot */
STRCPY (acpi_gbl_history_buffer[acpi_gbl_next_history_index].command, command_line); ACPI_STRCPY (acpi_gbl_history_buffer[acpi_gbl_next_history_index].command, command_line);
acpi_gbl_history_buffer[acpi_gbl_next_history_index].cmd_num = acpi_gbl_next_cmd_num; acpi_gbl_history_buffer[acpi_gbl_next_history_index].cmd_num = acpi_gbl_next_cmd_num;
...@@ -100,12 +99,10 @@ acpi_db_add_to_history ( ...@@ -100,12 +99,10 @@ acpi_db_add_to_history (
acpi_gbl_next_history_index = 0; acpi_gbl_next_history_index = 0;
} }
acpi_gbl_next_cmd_num++; acpi_gbl_next_cmd_num++;
if (acpi_gbl_num_history < HISTORY_SIZE) { if (acpi_gbl_num_history < HISTORY_SIZE) {
acpi_gbl_num_history++; acpi_gbl_num_history++;
} }
} }
...@@ -171,10 +168,9 @@ acpi_db_get_from_history ( ...@@ -171,10 +168,9 @@ acpi_db_get_from_history (
} }
else { else {
cmd_num = STRTOUL (command_num_arg, NULL, 0); cmd_num = ACPI_STRTOUL (command_num_arg, NULL, 0);
} }
/* Search history buffer */ /* Search history buffer */
history_index = acpi_gbl_lo_history; history_index = acpi_gbl_lo_history;
......
/******************************************************************************* /*******************************************************************************
* *
* Module Name: dbinput - user front-end to the AML debugger * Module Name: dbinput - user front-end to the AML debugger
* $Revision: 72 $ * $Revision: 81 $
* *
******************************************************************************/ ******************************************************************************/
/* /*
* Copyright (C) 2000, 2001 R. Byron Moore * Copyright (C) 2000 - 2002, R. Byron Moore
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
...@@ -35,56 +35,14 @@ ...@@ -35,56 +35,14 @@
#ifdef ENABLE_DEBUGGER #ifdef ENABLE_DEBUGGER
#define _COMPONENT ACPI_DEBUGGER #define _COMPONENT ACPI_DEBUGGER
MODULE_NAME ("dbinput") ACPI_MODULE_NAME ("dbinput")
/*
* Globals that are specific to the debugger
*/
NATIVE_CHAR acpi_gbl_db_line_buf[80];
NATIVE_CHAR acpi_gbl_db_parsed_buf[80];
NATIVE_CHAR acpi_gbl_db_scope_buf[40];
NATIVE_CHAR acpi_gbl_db_debug_filename[40];
NATIVE_CHAR *acpi_gbl_db_args[DB_MAX_ARGS];
NATIVE_CHAR *acpi_gbl_db_buffer = NULL;
NATIVE_CHAR *acpi_gbl_db_filename = NULL;
u8 acpi_gbl_db_output_to_file = FALSE;
u32 acpi_gbl_db_debug_level = ACPI_LV_VERBOSITY2;
u32 acpi_gbl_db_console_debug_level = NORMAL_DEFAULT | ACPI_LV_TABLES;
u8 acpi_gbl_db_output_flags = DB_CONSOLE_OUTPUT;
u8 acpi_gbl_db_opt_tables = FALSE;
u8 acpi_gbl_db_opt_disasm = FALSE;
u8 acpi_gbl_db_opt_stats = FALSE;
u8 acpi_gbl_db_opt_parse_jit = FALSE;
u8 acpi_gbl_db_opt_verbose = TRUE;
u8 acpi_gbl_db_opt_ini_methods = TRUE;
/*
* Statistic globals
*/
u16 acpi_gbl_obj_type_count[INTERNAL_TYPE_NODE_MAX+1];
u16 acpi_gbl_node_type_count[INTERNAL_TYPE_NODE_MAX+1];
u16 acpi_gbl_obj_type_count_misc;
u16 acpi_gbl_node_type_count_misc;
u32 acpi_gbl_num_nodes;
u32 acpi_gbl_num_objects;
u32 acpi_gbl_size_of_parse_tree;
u32 acpi_gbl_size_of_method_trees;
u32 acpi_gbl_size_of_node_entries;
u32 acpi_gbl_size_of_acpi_objects;
/* /*
* Top-level debugger commands. * Top-level debugger commands.
* *
* This list of commands must match the string table below it * This list of commands must match the string table below it
*/ */
enum acpi_ex_debugger_commands enum acpi_ex_debugger_commands
{ {
CMD_NOT_FOUND = 0, CMD_NOT_FOUND = 0,
...@@ -224,13 +182,11 @@ acpi_db_display_help ( ...@@ -224,13 +182,11 @@ acpi_db_display_help (
} }
/* /*
* Parameter is the command class * Parameter is the command class
* *
* The idea here is to keep each class of commands smaller than a screenful * The idea here is to keep each class of commands smaller than a screenful
*/ */
switch (help_type[0]) switch (help_type[0])
{ {
case 'G': case 'G':
...@@ -321,6 +277,7 @@ acpi_db_get_next_token ( ...@@ -321,6 +277,7 @@ acpi_db_get_next_token (
{ {
NATIVE_CHAR *start; NATIVE_CHAR *start;
/* At end of buffer? */ /* At end of buffer? */
if (!string || !(*string)) if (!string || !(*string))
...@@ -328,7 +285,6 @@ acpi_db_get_next_token ( ...@@ -328,7 +285,6 @@ acpi_db_get_next_token (
return (NULL); return (NULL);
} }
/* Get rid of any spaces at the beginning */ /* Get rid of any spaces at the beginning */
if (*string == ' ') if (*string == ' ')
...@@ -353,12 +309,10 @@ acpi_db_get_next_token ( ...@@ -353,12 +309,10 @@ acpi_db_get_next_token (
string++; string++;
} }
if (!(*string)) if (!(*string))
{ {
*next = NULL; *next = NULL;
} }
else else
{ {
*string = 0; *string = 0;
...@@ -392,11 +346,11 @@ acpi_db_get_line ( ...@@ -392,11 +346,11 @@ acpi_db_get_line (
NATIVE_CHAR *this; NATIVE_CHAR *this;
STRCPY (acpi_gbl_db_parsed_buf, input_buffer); ACPI_STRCPY (acpi_gbl_db_parsed_buf, input_buffer);
STRUPR (acpi_gbl_db_parsed_buf); ACPI_STRUPR (acpi_gbl_db_parsed_buf);
this = acpi_gbl_db_parsed_buf; this = acpi_gbl_db_parsed_buf;
for (i = 0; i < DB_MAX_ARGS; i++) for (i = 0; i < ACPI_DEBUGGER_MAX_ARGS; i++)
{ {
acpi_gbl_db_args[i] = acpi_db_get_next_token (this, &next); acpi_gbl_db_args[i] = acpi_db_get_next_token (this, &next);
if (!acpi_gbl_db_args[i]) if (!acpi_gbl_db_args[i])
...@@ -407,12 +361,11 @@ acpi_db_get_line ( ...@@ -407,12 +361,11 @@ acpi_db_get_line (
this = next; this = next;
} }
/* Uppercase the actual command */ /* Uppercase the actual command */
if (acpi_gbl_db_args[0]) if (acpi_gbl_db_args[0])
{ {
STRUPR (acpi_gbl_db_args[0]); ACPI_STRUPR (acpi_gbl_db_args[0]);
} }
count = i; count = i;
...@@ -451,7 +404,8 @@ acpi_db_match_command ( ...@@ -451,7 +404,8 @@ acpi_db_match_command (
for (i = CMD_FIRST_VALID; acpi_gbl_db_commands[i].name; i++) for (i = CMD_FIRST_VALID; acpi_gbl_db_commands[i].name; i++)
{ {
if (STRSTR (acpi_gbl_db_commands[i].name, user_command) == acpi_gbl_db_commands[i].name) if (ACPI_STRSTR (acpi_gbl_db_commands[i].name, user_command) ==
acpi_gbl_db_commands[i].name)
{ {
return (i); return (i);
} }
...@@ -601,7 +555,6 @@ acpi_db_command_dispatch ( ...@@ -601,7 +555,6 @@ acpi_db_command_dispatch (
status = AE_CTRL_TRUE; status = AE_CTRL_TRUE;
} }
return (status); return (status);
break;
case CMD_HISTORY_LAST: case CMD_HISTORY_LAST:
command_line = acpi_db_get_from_history (NULL); command_line = acpi_db_get_from_history (NULL);
...@@ -625,9 +578,6 @@ acpi_db_command_dispatch ( ...@@ -625,9 +578,6 @@ acpi_db_command_dispatch (
if (op) if (op)
{ {
acpi_gbl_cm_single_step = TRUE; acpi_gbl_cm_single_step = TRUE;
/* TBD: Must get current walk state */
/* Acpi_gbl_Method_breakpoint = 0; */
return (AE_OK); return (AE_OK);
} }
break; break;
...@@ -641,13 +591,13 @@ acpi_db_command_dispatch ( ...@@ -641,13 +591,13 @@ acpi_db_command_dispatch (
else if (param_count == 2) else if (param_count == 2)
{ {
temp = acpi_gbl_db_console_debug_level; temp = acpi_gbl_db_console_debug_level;
acpi_gbl_db_console_debug_level = STRTOUL (acpi_gbl_db_args[1], NULL, 16); acpi_gbl_db_console_debug_level = ACPI_STRTOUL (acpi_gbl_db_args[1], NULL, 16);
acpi_os_printf ("Debug Level for console output was %8.8lX, now %8.8lX\n", temp, acpi_gbl_db_console_debug_level); acpi_os_printf ("Debug Level for console output was %8.8lX, now %8.8lX\n", temp, acpi_gbl_db_console_debug_level);
} }
else else
{ {
temp = acpi_gbl_db_debug_level; temp = acpi_gbl_db_debug_level;
acpi_gbl_db_debug_level = STRTOUL (acpi_gbl_db_args[1], NULL, 16); acpi_gbl_db_debug_level = ACPI_STRTOUL (acpi_gbl_db_args[1], NULL, 16);
acpi_os_printf ("Debug Level for file output was %8.8lX, now %8.8lX\n", temp, acpi_gbl_db_debug_level); acpi_os_printf ("Debug Level for file output was %8.8lX, now %8.8lX\n", temp, acpi_gbl_db_debug_level);
} }
break; break;
...@@ -681,12 +631,12 @@ acpi_db_command_dispatch ( ...@@ -681,12 +631,12 @@ acpi_db_command_dispatch (
break; break;
case CMD_NOTIFY: case CMD_NOTIFY:
temp = STRTOUL (acpi_gbl_db_args[2], NULL, 0); temp = ACPI_STRTOUL (acpi_gbl_db_args[2], NULL, 0);
acpi_db_send_notify (acpi_gbl_db_args[1], temp); acpi_db_send_notify (acpi_gbl_db_args[1], temp);
break; break;
case CMD_OBJECT: case CMD_OBJECT:
acpi_db_display_objects (STRUPR (acpi_gbl_db_args[1]), acpi_gbl_db_args[2]); acpi_db_display_objects (ACPI_STRUPR (acpi_gbl_db_args[1]), acpi_gbl_db_args[2]);
break; break;
case CMD_OPEN: case CMD_OPEN:
...@@ -723,14 +673,13 @@ acpi_db_command_dispatch ( ...@@ -723,14 +673,13 @@ acpi_db_command_dispatch (
case CMD_STOP: case CMD_STOP:
return (AE_AML_ERROR); return (AE_AML_ERROR);
break;
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]);
break; break;
case CMD_TERMINATE: case CMD_TERMINATE:
acpi_db_set_output_destination (DB_REDIRECTABLE_OUTPUT); acpi_db_set_output_destination (ACPI_DB_REDIRECTABLE_OUTPUT);
acpi_ut_subsystem_shutdown (); acpi_ut_subsystem_shutdown ();
/* TBD: [Restructure] Need some way to re-initialize without re-creating the semaphores! */ /* TBD: [Restructure] Need some way to re-initialize without re-creating the semaphores! */
...@@ -798,11 +747,12 @@ acpi_db_command_dispatch ( ...@@ -798,11 +747,12 @@ acpi_db_command_dispatch (
* *
******************************************************************************/ ******************************************************************************/
void void ACPI_SYSTEM_XFACE
acpi_db_execute_thread ( acpi_db_execute_thread (
void *context) void *context)
{ {
acpi_status status = AE_OK; acpi_status status = AE_OK;
acpi_status Mstatus;
while (status != AE_CTRL_TERMINATE) while (status != AE_CTRL_TERMINATE)
...@@ -810,9 +760,19 @@ acpi_db_execute_thread ( ...@@ -810,9 +760,19 @@ acpi_db_execute_thread (
acpi_gbl_method_executing = FALSE; acpi_gbl_method_executing = FALSE;
acpi_gbl_step_to_next_call = FALSE; acpi_gbl_step_to_next_call = FALSE;
acpi_ut_acquire_mutex (ACPI_MTX_DEBUG_CMD_READY); Mstatus = acpi_ut_acquire_mutex (ACPI_MTX_DEBUG_CMD_READY);
if (ACPI_FAILURE (Mstatus))
{
return;
}
status = acpi_db_command_dispatch (acpi_gbl_db_line_buf, NULL, NULL); status = acpi_db_command_dispatch (acpi_gbl_db_line_buf, NULL, NULL);
acpi_ut_release_mutex (ACPI_MTX_DEBUG_CMD_COMPLETE);
Mstatus = acpi_ut_release_mutex (ACPI_MTX_DEBUG_CMD_COMPLETE);
if (ACPI_FAILURE (Mstatus))
{
return;
}
} }
} }
...@@ -834,7 +794,7 @@ void ...@@ -834,7 +794,7 @@ void
acpi_db_single_thread ( acpi_db_single_thread (
void) void)
{ {
acpi_status status = AE_OK; acpi_status status;
acpi_gbl_method_executing = FALSE; acpi_gbl_method_executing = FALSE;
...@@ -872,17 +832,17 @@ acpi_db_user_commands ( ...@@ -872,17 +832,17 @@ acpi_db_user_commands (
{ {
/* Force output to console until a command is entered */ /* Force output to console until a command is entered */
acpi_db_set_output_destination (DB_CONSOLE_OUTPUT); acpi_db_set_output_destination (ACPI_DB_CONSOLE_OUTPUT);
/* Different prompt if method is executing */ /* Different prompt if method is executing */
if (!acpi_gbl_method_executing) if (!acpi_gbl_method_executing)
{ {
acpi_os_printf ("%1c ", DB_COMMAND_PROMPT); acpi_os_printf ("%1c ", ACPI_DEBUGGER_COMMAND_PROMPT);
} }
else else
{ {
acpi_os_printf ("%1c ", DB_EXECUTE_PROMPT); acpi_os_printf ("%1c ", ACPI_DEBUGGER_EXECUTE_PROMPT);
} }
/* Get the user input line */ /* Get the user input line */
...@@ -898,10 +858,18 @@ acpi_db_user_commands ( ...@@ -898,10 +858,18 @@ acpi_db_user_commands (
* Signal the debug thread that we have a command to execute, * Signal the debug thread that we have a command to execute,
* and wait for the command to complete. * and wait for the command to complete.
*/ */
acpi_ut_release_mutex (ACPI_MTX_DEBUG_CMD_READY); status = acpi_ut_release_mutex (ACPI_MTX_DEBUG_CMD_READY);
acpi_ut_acquire_mutex (ACPI_MTX_DEBUG_CMD_COMPLETE); if (ACPI_FAILURE (status))
{
return (status);
} }
status = acpi_ut_acquire_mutex (ACPI_MTX_DEBUG_CMD_COMPLETE);
if (ACPI_FAILURE (status))
{
return (status);
}
}
else else
{ {
/* Just call to the command line interpreter */ /* Just call to the command line interpreter */
...@@ -910,7 +878,6 @@ acpi_db_user_commands ( ...@@ -910,7 +878,6 @@ 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
......
/******************************************************************************* /*******************************************************************************
* *
* Module Name: dbstats - Generation and display of ACPI table statistics * Module Name: dbstats - Generation and display of ACPI table statistics
* $Revision: 47 $ * $Revision: 55 $
* *
******************************************************************************/ ******************************************************************************/
/* /*
* Copyright (C) 2000, 2001 R. Byron Moore * Copyright (C) 2000 - 2002, R. Byron Moore
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
#ifdef ENABLE_DEBUGGER #ifdef ENABLE_DEBUGGER
#define _COMPONENT ACPI_DEBUGGER #define _COMPONENT ACPI_DEBUGGER
MODULE_NAME ("dbstats") ACPI_MODULE_NAME ("dbstats")
/* /*
* Statistics subcommands * Statistics subcommands
...@@ -67,9 +67,8 @@ ARGUMENT_INFO acpi_db_stat_types [] = ...@@ -67,9 +67,8 @@ ARGUMENT_INFO acpi_db_stat_types [] =
* RETURN: None * RETURN: None
* *
* DESCRIPTION: Add this object to the global counts, by object type. * DESCRIPTION: Add this object to the global counts, by object type.
* Recursively handles subobjects and packages. * Limited recursion handles subobjects and packages, and this
* * is probably acceptable within the AML debugger only.
* [TBD] Restructure - remove recursion.
* *
******************************************************************************/ ******************************************************************************/
...@@ -77,7 +76,6 @@ void ...@@ -77,7 +76,6 @@ void
acpi_db_enumerate_object ( acpi_db_enumerate_object (
acpi_operand_object *obj_desc) acpi_operand_object *obj_desc)
{ {
u32 type;
u32 i; u32 i;
...@@ -91,22 +89,21 @@ acpi_db_enumerate_object ( ...@@ -91,22 +89,21 @@ acpi_db_enumerate_object (
acpi_gbl_num_objects++; acpi_gbl_num_objects++;
type = obj_desc->common.type; if (obj_desc->common.type > INTERNAL_TYPE_NODE_MAX)
if (type > INTERNAL_TYPE_NODE_MAX)
{ {
acpi_gbl_obj_type_count_misc++; acpi_gbl_obj_type_count_misc++;
} }
else else
{ {
acpi_gbl_obj_type_count [type]++; acpi_gbl_obj_type_count [obj_desc->common.type]++;
} }
/* Count the sub-objects */ /* Count the sub-objects */
switch (type) switch (obj_desc->common.type)
{ {
case ACPI_TYPE_PACKAGE: case ACPI_TYPE_PACKAGE:
for (i = 0; i< obj_desc->package.count; i++) for (i = 0; i < obj_desc->package.count; i++)
{ {
acpi_db_enumerate_object (obj_desc->package.elements[i]); acpi_db_enumerate_object (obj_desc->package.elements[i]);
} }
...@@ -118,7 +115,15 @@ acpi_db_enumerate_object ( ...@@ -118,7 +115,15 @@ acpi_db_enumerate_object (
acpi_db_enumerate_object (obj_desc->device.addr_handler); acpi_db_enumerate_object (obj_desc->device.addr_handler);
break; break;
case ACPI_TYPE_BUFFER_FIELD:
if (acpi_ns_get_secondary_object (obj_desc))
{
acpi_gbl_obj_type_count [ACPI_TYPE_BUFFER_FIELD]++;
}
break;
case ACPI_TYPE_REGION: case ACPI_TYPE_REGION:
acpi_gbl_obj_type_count [INTERNAL_TYPE_REGION_FIELD ]++;
acpi_db_enumerate_object (obj_desc->region.addr_handler); acpi_db_enumerate_object (obj_desc->region.addr_handler);
break; break;
...@@ -172,7 +177,7 @@ acpi_db_classify_one_object ( ...@@ -172,7 +177,7 @@ acpi_db_classify_one_object (
acpi_gbl_num_nodes++; acpi_gbl_num_nodes++;
node = (acpi_namespace_node *) obj_handle; node = (acpi_namespace_node *) obj_handle;
obj_desc = ((acpi_namespace_node *) obj_handle)->object; obj_desc = acpi_ns_get_attached_object (node);
acpi_db_enumerate_object (obj_desc); acpi_db_enumerate_object (obj_desc);
...@@ -271,8 +276,10 @@ acpi_db_display_statistics ( ...@@ -271,8 +276,10 @@ acpi_db_display_statistics (
{ {
u32 i; u32 i;
u32 type; u32 type;
u32 outstanding;
u32 size; u32 size;
#ifdef ACPI_DBG_TRACK_ALLOCATIONS
u32 outstanding;
#endif
if (!acpi_gbl_DSDT) if (!acpi_gbl_DSDT)
...@@ -286,7 +293,7 @@ acpi_db_display_statistics ( ...@@ -286,7 +293,7 @@ acpi_db_display_statistics (
return (AE_OK); return (AE_OK);
} }
STRUPR (type_arg); ACPI_STRUPR (type_arg);
type = acpi_db_match_argument (type_arg, acpi_db_stat_types); type = acpi_db_match_argument (type_arg, acpi_db_stat_types);
if (type == (u32) -1) if (type == (u32) -1)
{ {
...@@ -368,11 +375,11 @@ acpi_db_display_statistics ( ...@@ -368,11 +375,11 @@ acpi_db_display_statistics (
if (acpi_gbl_memory_lists[i].object_size) if (acpi_gbl_memory_lists[i].object_size)
{ {
size = ROUND_UP_TO_1K (outstanding * acpi_gbl_memory_lists[i].object_size); size = ACPI_ROUND_UP_TO_1K (outstanding * acpi_gbl_memory_lists[i].object_size);
} }
else else
{ {
size = ROUND_UP_TO_1K (acpi_gbl_memory_lists[i].current_total_size); size = ACPI_ROUND_UP_TO_1K (acpi_gbl_memory_lists[i].current_total_size);
} }
acpi_os_printf (" Mem: [Alloc Free Outstanding Size] % 7d % 7d % 7d % 7d Kb\n", acpi_os_printf (" Mem: [Alloc Free Outstanding Size] % 7d % 7d % 7d % 7d Kb\n",
...@@ -425,6 +432,7 @@ acpi_db_display_statistics ( ...@@ -425,6 +432,7 @@ acpi_db_display_statistics (
acpi_os_printf ("Notify_handler %3d\n", sizeof (ACPI_OBJECT_NOTIFY_HANDLER)); acpi_os_printf ("Notify_handler %3d\n", sizeof (ACPI_OBJECT_NOTIFY_HANDLER));
acpi_os_printf ("Addr_handler %3d\n", sizeof (ACPI_OBJECT_ADDR_HANDLER)); acpi_os_printf ("Addr_handler %3d\n", sizeof (ACPI_OBJECT_ADDR_HANDLER));
acpi_os_printf ("Extra %3d\n", sizeof (ACPI_OBJECT_EXTRA)); acpi_os_printf ("Extra %3d\n", sizeof (ACPI_OBJECT_EXTRA));
acpi_os_printf ("Data %3d\n", sizeof (ACPI_OBJECT_DATA));
acpi_os_printf ("\n"); acpi_os_printf ("\n");
......
/******************************************************************************* /*******************************************************************************
* *
* Module Name: dbutils - AML debugger utilities * Module Name: dbutils - AML debugger utilities
* $Revision: 45 $ * $Revision: 51 $
* *
******************************************************************************/ ******************************************************************************/
/* /*
* Copyright (C) 2000, 2001 R. Byron Moore * Copyright (C) 2000 - 2002, R. Byron Moore
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
#ifdef ENABLE_DEBUGGER #ifdef ENABLE_DEBUGGER
#define _COMPONENT ACPI_DEBUGGER #define _COMPONENT ACPI_DEBUGGER
MODULE_NAME ("dbutils") ACPI_MODULE_NAME ("dbutils")
/******************************************************************************* /*******************************************************************************
...@@ -61,11 +61,9 @@ acpi_db_set_output_destination ( ...@@ -61,11 +61,9 @@ acpi_db_set_output_destination (
acpi_gbl_db_output_flags = (u8) output_flags; acpi_gbl_db_output_flags = (u8) output_flags;
if (output_flags & DB_REDIRECTABLE_OUTPUT) { if ((output_flags & ACPI_DB_REDIRECTABLE_OUTPUT) && acpi_gbl_db_output_to_file) {
if (acpi_gbl_db_output_to_file) {
acpi_dbg_level = acpi_gbl_db_debug_level; acpi_dbg_level = acpi_gbl_db_debug_level;
} }
}
else { else {
acpi_dbg_level = acpi_gbl_db_console_debug_level; acpi_dbg_level = acpi_gbl_db_console_debug_level;
} }
...@@ -92,7 +90,7 @@ acpi_db_dump_buffer ( ...@@ -92,7 +90,7 @@ acpi_db_dump_buffer (
acpi_os_printf ("\n_location %X:\n", address); acpi_os_printf ("\n_location %X:\n", address);
acpi_dbg_level |= ACPI_LV_TABLES; acpi_dbg_level |= ACPI_LV_TABLES;
acpi_ut_dump_buffer ((u8 *) address, 64, DB_BYTE_DISPLAY, ACPI_UINT32_MAX); acpi_ut_dump_buffer (ACPI_TO_POINTER (address), 64, DB_BYTE_DISPLAY, ACPI_UINT32_MAX);
} }
...@@ -135,8 +133,9 @@ acpi_db_dump_object ( ...@@ -135,8 +133,9 @@ acpi_db_dump_object (
case ACPI_TYPE_INTEGER: case ACPI_TYPE_INTEGER:
acpi_os_printf ("[Integer] = %8.8X%8.8X\n", HIDWORD (obj_desc->integer.value), acpi_os_printf ("[Integer] = %8.8X%8.8X\n",
LODWORD (obj_desc->integer.value)); ACPI_HIDWORD (obj_desc->integer.value),
ACPI_LODWORD (obj_desc->integer.value));
break; break;
...@@ -215,7 +214,7 @@ acpi_db_prep_namestring ( ...@@ -215,7 +214,7 @@ acpi_db_prep_namestring (
return; return;
} }
STRUPR (name); ACPI_STRUPR (name);
/* Convert a leading forward slash to a backslash */ /* Convert a leading forward slash to a backslash */
...@@ -268,7 +267,7 @@ acpi_db_second_pass_parse ( ...@@ -268,7 +267,7 @@ acpi_db_second_pass_parse (
acpi_walk_state *walk_state; acpi_walk_state *walk_state;
FUNCTION_ENTRY (); ACPI_FUNCTION_ENTRY ();
acpi_os_printf ("Pass two parse ....\n"); acpi_os_printf ("Pass two parse ....\n");
...@@ -339,6 +338,9 @@ acpi_db_second_pass_parse ( ...@@ -339,6 +338,9 @@ acpi_db_second_pass_parse (
* *
* DESCRIPTION: Lookup a name in the ACPI namespace * DESCRIPTION: Lookup a name in the ACPI namespace
* *
* Note: Currently begins search from the root. Could be enhanced to use
* the current prefix (scope) node as the search beginning point.
*
******************************************************************************/ ******************************************************************************/
acpi_namespace_node * acpi_namespace_node *
...@@ -360,21 +362,17 @@ acpi_db_local_ns_lookup ( ...@@ -360,21 +362,17 @@ acpi_db_local_ns_lookup (
return (NULL); return (NULL);
} }
/* Lookup the name */ /*
* Lookup the name.
/* TBD: [Investigate] what scope do we use? */ * (Uses root node as the search starting point)
/* Use the root scope for the start of the search */ */
status = acpi_ns_lookup (NULL, internal_path, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
status = acpi_ns_lookup (NULL, internal_path, ACPI_TYPE_ANY, IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE, NULL, &node);
NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE, NULL, &node);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
acpi_os_printf ("Could not locate name: %s %s\n", name, acpi_format_exception (status)); acpi_os_printf ("Could not locate name: %s %s\n", name, acpi_format_exception (status));
} }
ACPI_MEM_FREE (internal_path); ACPI_MEM_FREE (internal_path);
return (node); return (node);
} }
......
/******************************************************************************* /*******************************************************************************
* *
* Module Name: dbxface - AML Debugger external interfaces * Module Name: dbxface - AML Debugger external interfaces
* $Revision: 45 $ * $Revision: 55 $
* *
******************************************************************************/ ******************************************************************************/
/* /*
* Copyright (C) 2000, 2001 R. Byron Moore * Copyright (C) 2000 - 2002, R. Byron Moore
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
#ifdef ENABLE_DEBUGGER #ifdef ENABLE_DEBUGGER
#define _COMPONENT ACPI_DEBUGGER #define _COMPONENT ACPI_DEBUGGER
MODULE_NAME ("dbxface") ACPI_MODULE_NAME ("dbxface")
/******************************************************************************* /*******************************************************************************
...@@ -64,16 +64,15 @@ acpi_db_single_step ( ...@@ -64,16 +64,15 @@ acpi_db_single_step (
acpi_status status = AE_OK; acpi_status status = AE_OK;
u32 original_debug_level; u32 original_debug_level;
acpi_parse_object *display_op; acpi_parse_object *display_op;
acpi_parse_object *parent_op;
FUNCTION_ENTRY (); ACPI_FUNCTION_ENTRY ();
/* Is there a breakpoint set? */ /* Check for single-step breakpoint */
if (walk_state->method_breakpoint) { if (walk_state->method_breakpoint && (walk_state->method_breakpoint <= op->aml_offset)) {
/* Check if the breakpoint has been reached or passed */ /* Check if the breakpoint has been reached or passed */
if (walk_state->method_breakpoint <= op->aml_offset) {
/* 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->aml_offset);
...@@ -81,8 +80,17 @@ acpi_db_single_step ( ...@@ -81,8 +80,17 @@ acpi_db_single_step (
acpi_gbl_step_to_next_call = FALSE; acpi_gbl_step_to_next_call = FALSE;
walk_state->method_breakpoint = 0; walk_state->method_breakpoint = 0;
} }
/* Check for user breakpoint (Must be on exact Aml offset) */
else if (walk_state->user_breakpoint && (walk_state->user_breakpoint == op->aml_offset)) {
acpi_os_printf ("***User_breakpoint*** at AML offset %X\n", op->aml_offset);
acpi_gbl_cm_single_step = TRUE;
acpi_gbl_step_to_next_call = FALSE;
walk_state->method_breakpoint = 0;
} }
/* /*
* 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
...@@ -95,7 +103,6 @@ acpi_db_single_step ( ...@@ -95,7 +103,6 @@ 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);
break;
} }
/* /*
...@@ -121,10 +128,36 @@ acpi_db_single_step ( ...@@ -121,10 +128,36 @@ acpi_db_single_step (
display_op = op; display_op = op;
if (op->parent) { parent_op = op->parent;
if ((op->parent->opcode == AML_IF_OP) || if (parent_op) {
(op->parent->opcode == AML_WHILE_OP)) { if ((walk_state->control_state) &&
display_op = op->parent; (walk_state->control_state->common.state == ACPI_CONTROL_PREDICATE_EXECUTING)) {
/*
* We are executing the predicate of an IF or WHILE statement
* Search upwards for the containing IF or WHILE so that the
* entire predicate can be displayed.
*/
while (parent_op) {
if ((parent_op->opcode == AML_IF_OP) ||
(parent_op->opcode == AML_WHILE_OP)) {
display_op = parent_op;
break;
}
parent_op = parent_op->parent;
}
}
else {
while (parent_op) {
if ((parent_op->opcode == AML_IF_OP) ||
(parent_op->opcode == AML_ELSE_OP) ||
(parent_op->opcode == AML_SCOPE_OP) ||
(parent_op->opcode == AML_METHOD_OP) ||
(parent_op->opcode == AML_WHILE_OP)) {
break;
}
display_op = parent_op;
parent_op = parent_op->parent;
}
} }
} }
...@@ -135,15 +168,15 @@ acpi_db_single_step ( ...@@ -135,15 +168,15 @@ acpi_db_single_step (
if ((op->opcode == AML_IF_OP) || if ((op->opcode == AML_IF_OP) ||
(op->opcode == AML_WHILE_OP)) { (op->opcode == AML_WHILE_OP)) {
if (walk_state->control_state->common.value) { if (walk_state->control_state->common.value) {
acpi_os_printf ("Predicate was TRUE, executed block\n"); acpi_os_printf ("Predicate = [True], IF block was executed\n");
} }
else { else {
acpi_os_printf ("Predicate is FALSE, skipping block\n"); acpi_os_printf ("Predicate = [False], Skipping IF block\n");
} }
} }
else if (op->opcode == AML_ELSE_OP) { else if (op->opcode == AML_ELSE_OP) {
/* TBD */ acpi_os_printf ("Predicate = [False], ELSE block was executed\n");
} }
/* Restore everything */ /* Restore everything */
...@@ -159,7 +192,6 @@ acpi_db_single_step ( ...@@ -159,7 +192,6 @@ acpi_db_single_step (
return (AE_OK); return (AE_OK);
} }
/* /*
* If we are executing a step-to-call command, * If we are executing a step-to-call command,
* Check if this is a method call. * Check if this is a method call.
...@@ -176,7 +208,6 @@ acpi_db_single_step ( ...@@ -176,7 +208,6 @@ acpi_db_single_step (
acpi_gbl_step_to_next_call = FALSE; acpi_gbl_step_to_next_call = FALSE;
} }
/* /*
* 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.
...@@ -184,11 +215,9 @@ acpi_db_single_step ( ...@@ -184,11 +215,9 @@ acpi_db_single_step (
if (op->opcode == AML_INT_METHODCALL_OP) { if (op->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 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 */
/* TBD: [Future] don't kill the user breakpoint! */
walk_state->method_breakpoint = /* Op->Aml_offset + */ 1; /* Must be non-zero! */ walk_state->method_breakpoint = 1; /* Must be non-zero! */
} }
...@@ -204,8 +233,14 @@ acpi_db_single_step ( ...@@ -204,8 +233,14 @@ acpi_db_single_step (
if (acpi_gbl_debugger_configuration == DEBUGGER_MULTI_THREADED) { if (acpi_gbl_debugger_configuration == DEBUGGER_MULTI_THREADED) {
/* Handshake with the front-end that gets user command lines */ /* Handshake with the front-end that gets user command lines */
acpi_ut_release_mutex (ACPI_MTX_DEBUG_CMD_COMPLETE); status = acpi_ut_release_mutex (ACPI_MTX_DEBUG_CMD_COMPLETE);
acpi_ut_acquire_mutex (ACPI_MTX_DEBUG_CMD_READY); if (ACPI_FAILURE (status)) {
return (status);
}
status = acpi_ut_acquire_mutex (ACPI_MTX_DEBUG_CMD_READY);
if (ACPI_FAILURE (status)) {
return (status);
}
} }
else { else {
...@@ -213,15 +248,15 @@ acpi_db_single_step ( ...@@ -213,15 +248,15 @@ acpi_db_single_step (
/* Force output to console until a command is entered */ /* Force output to console until a command is entered */
acpi_db_set_output_destination (DB_CONSOLE_OUTPUT); acpi_db_set_output_destination (ACPI_DB_CONSOLE_OUTPUT);
/* Different prompt if method is executing */ /* Different prompt if method is executing */
if (!acpi_gbl_method_executing) { if (!acpi_gbl_method_executing) {
acpi_os_printf ("%1c ", DB_COMMAND_PROMPT); acpi_os_printf ("%1c ", ACPI_DEBUGGER_COMMAND_PROMPT);
} }
else { else {
acpi_os_printf ("%1c ", DB_EXECUTE_PROMPT); acpi_os_printf ("%1c ", ACPI_DEBUGGER_EXECUTE_PROMPT);
} }
/* Get the user input line */ /* Get the user input line */
...@@ -256,16 +291,33 @@ int ...@@ -256,16 +291,33 @@ int
acpi_db_initialize (void) acpi_db_initialize (void)
{ {
/* Init globals */ /* Init globals */
acpi_gbl_db_buffer = acpi_os_callocate (ACPI_DEBUG_BUFFER_SIZE); acpi_gbl_db_buffer = NULL;
acpi_gbl_db_filename = NULL;
acpi_gbl_db_output_to_file = FALSE;
acpi_gbl_db_debug_level = ACPI_LV_VERBOSITY2;
acpi_gbl_db_console_debug_level = NORMAL_DEFAULT | ACPI_LV_TABLES;
acpi_gbl_db_output_flags = ACPI_DB_CONSOLE_OUTPUT;
acpi_gbl_db_opt_tables = FALSE;
acpi_gbl_db_opt_disasm = FALSE;
acpi_gbl_db_opt_stats = FALSE;
acpi_gbl_db_opt_verbose = TRUE;
acpi_gbl_db_opt_ini_methods = TRUE;
acpi_gbl_db_buffer = acpi_os_allocate (ACPI_DEBUG_BUFFER_SIZE);
if (!acpi_gbl_db_buffer) {
return 0;
}
ACPI_MEMSET (acpi_gbl_db_buffer, 0, ACPI_DEBUG_BUFFER_SIZE);
/* Initial scope is the root */ /* Initial scope is the root */
acpi_gbl_db_scope_buf [0] = '\\'; acpi_gbl_db_scope_buf [0] = '\\';
acpi_gbl_db_scope_buf [1] = 0; acpi_gbl_db_scope_buf [1] = 0;
acpi_gbl_db_scope_node = acpi_gbl_root_node;
/* /*
* If configured for multi-thread support, the debug executor runs in * If configured for multi-thread support, the debug executor runs in
......
# #
# Makefile for all Linux ACPI interpreter subdirectories # Makefile for all Linux ACPI interpreter subdirectories
# EXCEPT for the ospm directory
# #
O_TARGET := $(notdir $(CURDIR)).o O_TARGET := $(notdir $(CURDIR)).o
obj-$(CONFIG_ACPI) := $(patsubst %.c,%.o,$(wildcard *.c)) obj-$(CONFIG_ACPI_INTERPRETER) := $(patsubst %.c,%.o,$(wildcard *.c))
EXTRA_CFLAGS += $(ACPI_CFLAGS) EXTRA_CFLAGS += $(ACPI_CFLAGS)
......
This diff is collapsed.
/****************************************************************************** /******************************************************************************
* *
* Module Name: dsmethod - Parser/Interpreter interface - control method parsing * Module Name: dsmethod - Parser/Interpreter interface - control method parsing
* $Revision: 69 $ * $Revision: 79 $
* *
*****************************************************************************/ *****************************************************************************/
/* /*
* Copyright (C) 2000, 2001 R. Byron Moore * Copyright (C) 2000 - 2002, R. Byron Moore
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
#define _COMPONENT ACPI_DISPATCHER #define _COMPONENT ACPI_DISPATCHER
MODULE_NAME ("dsmethod") ACPI_MODULE_NAME ("dsmethod")
/******************************************************************************* /*******************************************************************************
...@@ -68,7 +68,7 @@ acpi_ds_parse_method ( ...@@ -68,7 +68,7 @@ acpi_ds_parse_method (
acpi_walk_state *walk_state; acpi_walk_state *walk_state;
FUNCTION_TRACE_PTR ("Ds_parse_method", obj_handle); ACPI_FUNCTION_TRACE_PTR ("Ds_parse_method", obj_handle);
/* Parameter Validation */ /* Parameter Validation */
...@@ -78,13 +78,12 @@ acpi_ds_parse_method ( ...@@ -78,13 +78,12 @@ acpi_ds_parse_method (
} }
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "**** Parsing [%4.4s] **** Named_obj=%p\n", ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "**** Parsing [%4.4s] **** Named_obj=%p\n",
(char*)&((acpi_namespace_node *)obj_handle)->name, obj_handle)); (char *) &((acpi_namespace_node *) obj_handle)->name, obj_handle));
/* Extract the method object from the method Node */ /* Extract the method object from the method Node */
node = (acpi_namespace_node *) obj_handle; node = (acpi_namespace_node *) obj_handle;
obj_desc = node->object; obj_desc = acpi_ns_get_attached_object (node);
if (!obj_desc) { if (!obj_desc) {
return_ACPI_STATUS (AE_NULL_OBJECT); return_ACPI_STATUS (AE_NULL_OBJECT);
} }
...@@ -115,9 +114,17 @@ acpi_ds_parse_method ( ...@@ -115,9 +114,17 @@ acpi_ds_parse_method (
acpi_ps_set_name (op, node->name); acpi_ps_set_name (op, node->name);
op->node = node; op->node = node;
/*
* Get a new Owner_id for objects created by this method. Namespace
* objects (such as Operation Regions) can be created during the
* first pass parse.
*/
owner_id = acpi_ut_allocate_owner_id (ACPI_OWNER_TYPE_METHOD);
obj_desc->method.owning_id = owner_id;
/* Create and initialize a new walk state */ /* Create and initialize a new walk state */
walk_state = acpi_ds_create_walk_state (TABLE_ID_DSDT, 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);
...@@ -126,7 +133,7 @@ acpi_ds_parse_method ( ...@@ -126,7 +133,7 @@ acpi_ds_parse_method (
status = acpi_ds_init_aml_walk (walk_state, op, node, obj_desc->method.aml_start, status = acpi_ds_init_aml_walk (walk_state, op, node, obj_desc->method.aml_start,
obj_desc->method.aml_length, NULL, NULL, 1); obj_desc->method.aml_length, NULL, NULL, 1);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
/* TBD: delete walk state */ acpi_ds_delete_walk_state (walk_state);
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
...@@ -145,16 +152,10 @@ acpi_ds_parse_method ( ...@@ -145,16 +152,10 @@ acpi_ds_parse_method (
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
/* Get a new Owner_id for objects created by this method */
owner_id = acpi_ut_allocate_owner_id (OWNER_TYPE_METHOD);
obj_desc->method.owning_id = owner_id;
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "**** [%4.4s] Parsed **** Named_obj=%p Op=%p\n", ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "**** [%4.4s] Parsed **** Named_obj=%p Op=%p\n",
(char*)&((acpi_namespace_node *)obj_handle)->name, obj_handle, op)); (char *) &((acpi_namespace_node *) obj_handle)->name, obj_handle, op));
acpi_ps_delete_parse_tree (op); acpi_ps_delete_parse_tree (op);
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
...@@ -186,14 +187,13 @@ acpi_ds_begin_method_execution ( ...@@ -186,14 +187,13 @@ acpi_ds_begin_method_execution (
acpi_status status = AE_OK; acpi_status status = AE_OK;
FUNCTION_TRACE_PTR ("Ds_begin_method_execution", method_node); ACPI_FUNCTION_TRACE_PTR ("Ds_begin_method_execution", method_node);
if (!method_node) { if (!method_node) {
return_ACPI_STATUS (AE_NULL_ENTRY); return_ACPI_STATUS (AE_NULL_ENTRY);
} }
/* /*
* If there is a concurrency limit on this method, we need to * If there is a concurrency limit on this method, we need to
* obtain a unit from the method semaphore. * obtain a unit from the method semaphore.
...@@ -221,13 +221,11 @@ acpi_ds_begin_method_execution ( ...@@ -221,13 +221,11 @@ acpi_ds_begin_method_execution (
WAIT_FOREVER); WAIT_FOREVER);
} }
/* /*
* Increment the method parse tree thread count since it has been * Increment the method parse tree thread count since it has been
* reentered one more time (even if it is the same thread) * reentered one more time (even if it is the same thread)
*/ */
obj_desc->method.thread_count++; obj_desc->method.thread_count++;
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
...@@ -247,9 +245,9 @@ acpi_ds_begin_method_execution ( ...@@ -247,9 +245,9 @@ acpi_ds_begin_method_execution (
acpi_status acpi_status
acpi_ds_call_control_method ( acpi_ds_call_control_method (
acpi_walk_list *walk_list, ACPI_THREAD_STATE *thread,
acpi_walk_state *this_walk_state, acpi_walk_state *this_walk_state,
acpi_parse_object *op) /* TBD: This operand is obsolete */ acpi_parse_object *op)
{ {
acpi_status status; acpi_status status;
acpi_namespace_node *method_node; acpi_namespace_node *method_node;
...@@ -258,7 +256,7 @@ acpi_ds_call_control_method ( ...@@ -258,7 +256,7 @@ acpi_ds_call_control_method (
u32 i; u32 i;
FUNCTION_TRACE_PTR ("Ds_call_control_method", this_walk_state); ACPI_FUNCTION_TRACE_PTR ("Ds_call_control_method", this_walk_state);
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Execute method %p, currentstate=%p\n", ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Execute method %p, currentstate=%p\n",
this_walk_state->prev_op, this_walk_state)); this_walk_state->prev_op, this_walk_state));
...@@ -284,14 +282,12 @@ acpi_ds_call_control_method ( ...@@ -284,14 +282,12 @@ acpi_ds_call_control_method (
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
/* 1) Parse: Create a new walk state for the preempting walk */ /* 1) Parse: Create a new walk state for the preempting walk */
next_walk_state = acpi_ds_create_walk_state (obj_desc->method.owning_id, next_walk_state = acpi_ds_create_walk_state (obj_desc->method.owning_id,
op, obj_desc, NULL); op, obj_desc, NULL);
if (!next_walk_state) { if (!next_walk_state) {
return_ACPI_STATUS (AE_NO_MEMORY); return_ACPI_STATUS (AE_NO_MEMORY);
goto cleanup;
} }
/* Create and init a Root Node */ /* Create and init a Root Node */
...@@ -306,7 +302,7 @@ acpi_ds_call_control_method ( ...@@ -306,7 +302,7 @@ acpi_ds_call_control_method (
obj_desc->method.aml_start, obj_desc->method.aml_length, obj_desc->method.aml_start, obj_desc->method.aml_length,
NULL, NULL, 1); NULL, NULL, 1);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
/* TBD: delete walk state */ acpi_ds_delete_walk_state (next_walk_state);
goto cleanup; goto cleanup;
} }
...@@ -315,11 +311,10 @@ acpi_ds_call_control_method ( ...@@ -315,11 +311,10 @@ acpi_ds_call_control_method (
status = acpi_ps_parse_aml (next_walk_state); status = acpi_ps_parse_aml (next_walk_state);
acpi_ps_delete_parse_tree (op); acpi_ps_delete_parse_tree (op);
/* 2) Execute: Create a new state for the preempting walk */ /* 2) Execute: Create a new state for the preempting walk */
next_walk_state = acpi_ds_create_walk_state (obj_desc->method.owning_id, next_walk_state = acpi_ds_create_walk_state (obj_desc->method.owning_id,
NULL, obj_desc, walk_list); NULL, obj_desc, thread);
if (!next_walk_state) { if (!next_walk_state) {
status = AE_NO_MEMORY; status = AE_NO_MEMORY;
goto cleanup; goto cleanup;
...@@ -390,7 +385,7 @@ acpi_ds_restart_control_method ( ...@@ -390,7 +385,7 @@ acpi_ds_restart_control_method (
acpi_status status; acpi_status status;
FUNCTION_TRACE_PTR ("Ds_restart_control_method", walk_state); ACPI_FUNCTION_TRACE_PTR ("Ds_restart_control_method", walk_state);
if (return_desc) { if (return_desc) {
...@@ -405,7 +400,6 @@ acpi_ds_restart_control_method ( ...@@ -405,7 +400,6 @@ acpi_ds_restart_control_method (
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
} }
else { else {
/* /*
* Delete the return value if it will not be used by the * Delete the return value if it will not be used by the
...@@ -413,7 +407,6 @@ acpi_ds_restart_control_method ( ...@@ -413,7 +407,6 @@ acpi_ds_restart_control_method (
*/ */
acpi_ut_remove_reference (return_desc); acpi_ut_remove_reference (return_desc);
} }
} }
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
...@@ -446,12 +439,13 @@ acpi_ds_terminate_control_method ( ...@@ -446,12 +439,13 @@ acpi_ds_terminate_control_method (
{ {
acpi_operand_object *obj_desc; acpi_operand_object *obj_desc;
acpi_namespace_node *method_node; acpi_namespace_node *method_node;
acpi_status status;
FUNCTION_TRACE_PTR ("Ds_terminate_control_method", walk_state); ACPI_FUNCTION_TRACE_PTR ("Ds_terminate_control_method", walk_state);
/* The method object should be stored 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;
if (!obj_desc) { if (!obj_desc) {
...@@ -467,8 +461,10 @@ acpi_ds_terminate_control_method ( ...@@ -467,8 +461,10 @@ acpi_ds_terminate_control_method (
* If this is the last thread executing the method, * If this is the last thread executing the method,
* we have additional cleanup to perform * we have additional cleanup to perform
*/ */
acpi_ut_acquire_mutex (ACPI_MTX_PARSER); status = acpi_ut_acquire_mutex (ACPI_MTX_PARSER);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
/* Signal completion of the execution of this method if necessary */ /* Signal completion of the execution of this method if necessary */
...@@ -493,7 +489,11 @@ acpi_ds_terminate_control_method ( ...@@ -493,7 +489,11 @@ acpi_ds_terminate_control_method (
* Delete any namespace entries created immediately underneath * Delete any namespace entries created immediately underneath
* the method * the method
*/ */
acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
if (method_node->child) { if (method_node->child) {
acpi_ns_delete_namespace_subtree (method_node); acpi_ns_delete_namespace_subtree (method_node);
} }
...@@ -503,11 +503,14 @@ acpi_ds_terminate_control_method ( ...@@ -503,11 +503,14 @@ acpi_ds_terminate_control_method (
* the namespace * the namespace
*/ */
acpi_ns_delete_namespace_by_owner (walk_state->method_desc->method.owning_id); acpi_ns_delete_namespace_by_owner (walk_state->method_desc->method.owning_id);
acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
} }
acpi_ut_release_mutex (ACPI_MTX_PARSER); status = acpi_ut_release_mutex (ACPI_MTX_PARSER);
return_ACPI_STATUS (AE_OK); return_ACPI_STATUS (status);
} }
This diff is collapsed.
/****************************************************************************** /******************************************************************************
* *
* Module Name: dsobject - Dispatcher object management routines * Module Name: dsobject - Dispatcher object management routines
* $Revision: 81 $ * $Revision: 90 $
* *
*****************************************************************************/ *****************************************************************************/
/* /*
* Copyright (C) 2000, 2001 R. Byron Moore * Copyright (C) 2000 - 2002, R. Byron Moore
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
#include "acnamesp.h" #include "acnamesp.h"
#define _COMPONENT ACPI_DISPATCHER #define _COMPONENT ACPI_DISPATCHER
MODULE_NAME ("dsobject") ACPI_MODULE_NAME ("dsobject")
/******************************************************************************* /*******************************************************************************
...@@ -62,13 +62,13 @@ acpi_ds_init_one_object ( ...@@ -62,13 +62,13 @@ acpi_ds_init_one_object (
void *context, void *context,
void **return_value) void **return_value)
{ {
acpi_object_type8 type; acpi_object_type type;
acpi_status status; acpi_status status;
acpi_init_walk_info *info = (acpi_init_walk_info *) context; acpi_init_walk_info *info = (acpi_init_walk_info *) context;
u8 table_revision; u8 table_revision;
PROC_NAME ("Ds_init_one_object"); ACPI_FUNCTION_NAME ("Ds_init_one_object");
info->object_count++; info->object_count++;
...@@ -89,7 +89,6 @@ acpi_ds_init_one_object ( ...@@ -89,7 +89,6 @@ acpi_ds_init_one_object (
type = acpi_ns_get_type (obj_handle); type = acpi_ns_get_type (obj_handle);
switch (type) { switch (type) {
case ACPI_TYPE_REGION: case ACPI_TYPE_REGION:
acpi_ds_initialize_region (obj_handle); acpi_ds_initialize_region (obj_handle);
...@@ -121,7 +120,7 @@ acpi_ds_init_one_object ( ...@@ -121,7 +120,7 @@ acpi_ds_init_one_object (
status = acpi_ds_parse_method (obj_handle); status = acpi_ds_parse_method (obj_handle);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Method %p [%4.4s] - parse failure, %s\n", ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Method %p [%4.4s] - parse failure, %s\n",
obj_handle, (char*)&((acpi_namespace_node *)obj_handle)->name, obj_handle, (char *) &((acpi_namespace_node *) obj_handle)->name,
acpi_format_exception (status))); acpi_format_exception (status)));
/* This parse failed, but we will continue parsing more methods */ /* This parse failed, but we will continue parsing more methods */
...@@ -134,6 +133,7 @@ acpi_ds_init_one_object ( ...@@ -134,6 +133,7 @@ acpi_ds_init_one_object (
* for every execution since there isn't much overhead * for every execution since there isn't much overhead
*/ */
acpi_ns_delete_namespace_subtree (obj_handle); acpi_ns_delete_namespace_subtree (obj_handle);
acpi_ns_delete_namespace_by_owner (((acpi_namespace_node *) obj_handle)->object->method.owning_id);
break; break;
default: default:
...@@ -170,7 +170,7 @@ acpi_ds_initialize_objects ( ...@@ -170,7 +170,7 @@ acpi_ds_initialize_objects (
acpi_init_walk_info info; acpi_init_walk_info info;
FUNCTION_TRACE ("Ds_initialize_objects"); ACPI_FUNCTION_TRACE ("Ds_initialize_objects");
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
...@@ -235,7 +235,7 @@ acpi_ds_init_object_from_op ( ...@@ -235,7 +235,7 @@ acpi_ds_init_object_from_op (
acpi_operand_object *obj_desc; acpi_operand_object *obj_desc;
PROC_NAME ("Ds_init_object_from_op"); ACPI_FUNCTION_NAME ("Ds_init_object_from_op");
obj_desc = *ret_obj_desc; obj_desc = *ret_obj_desc;
...@@ -252,6 +252,8 @@ acpi_ds_init_object_from_op ( ...@@ -252,6 +252,8 @@ acpi_ds_init_object_from_op (
switch (obj_desc->common.type) { switch (obj_desc->common.type) {
case ACPI_TYPE_BUFFER: case ACPI_TYPE_BUFFER:
obj_desc->buffer.node = (acpi_namespace_node *) walk_state->operands[0];
/* First arg is a number */ /* First arg is a number */
acpi_ds_create_operand (walk_state, op->value.arg, 0); acpi_ds_create_operand (walk_state, op->value.arg, 0);
...@@ -285,7 +287,7 @@ acpi_ds_init_object_from_op ( ...@@ -285,7 +287,7 @@ acpi_ds_init_object_from_op (
if (obj_desc->buffer.length == 0) { if (obj_desc->buffer.length == 0) {
obj_desc->buffer.pointer = NULL; obj_desc->buffer.pointer = NULL;
REPORT_WARNING (("Buffer created with zero length in AML\n")); ACPI_REPORT_WARNING (("Buffer created with zero length in AML\n"));
break; break;
} }
...@@ -312,7 +314,7 @@ acpi_ds_init_object_from_op ( ...@@ -312,7 +314,7 @@ acpi_ds_init_object_from_op (
return (AE_TYPE); return (AE_TYPE);
} }
MEMCPY (obj_desc->buffer.pointer, byte_list->data, ACPI_MEMCPY (obj_desc->buffer.pointer, byte_list->data,
obj_desc->buffer.length); obj_desc->buffer.length);
} }
...@@ -339,7 +341,7 @@ acpi_ds_init_object_from_op ( ...@@ -339,7 +341,7 @@ acpi_ds_init_object_from_op (
case ACPI_TYPE_STRING: case ACPI_TYPE_STRING:
obj_desc->string.pointer = op->value.string; obj_desc->string.pointer = op->value.string;
obj_desc->string.length = STRLEN (op->value.string); obj_desc->string.length = ACPI_STRLEN (op->value.string);
/* /*
* The string is contained in the ACPI table, don't ever try * The string is contained in the ACPI table, don't ever try
...@@ -422,42 +424,38 @@ acpi_ds_build_internal_simple_obj ( ...@@ -422,42 +424,38 @@ acpi_ds_build_internal_simple_obj (
acpi_operand_object **obj_desc_ptr) acpi_operand_object **obj_desc_ptr)
{ {
acpi_operand_object *obj_desc; acpi_operand_object *obj_desc;
acpi_object_type8 type;
acpi_status status; acpi_status status;
u32 length;
char *name; char *name;
FUNCTION_TRACE ("Ds_build_internal_simple_obj"); ACPI_FUNCTION_TRACE ("Ds_build_internal_simple_obj");
if (op->opcode == AML_INT_NAMEPATH_OP) { if (op->opcode == AML_INT_NAMEPATH_OP) {
/* /*
* This is an object reference. If The name was * This is an object reference. If this name was
* previously looked up in the NS, it is stored in this op. * previously looked up in the namespace, it was stored in this op.
* Otherwise, go ahead and look it up now * Otherwise, go ahead and look it up now
*/ */
if (!op->node) { if (!op->node) {
status = acpi_ns_lookup (walk_state->scope_info, status = acpi_ns_lookup (walk_state->scope_info, op->value.string,
op->value.string, ACPI_TYPE_ANY, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, NULL,
NS_SEARCH_PARENT | NS_DONT_OPEN_SCOPE, (acpi_namespace_node **) &(op->node));
NULL,
(acpi_namespace_node **)&(op->node));
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
if (status == AE_NOT_FOUND) { if (status == AE_NOT_FOUND) {
name = NULL; name = NULL;
acpi_ns_externalize_name (ACPI_UINT32_MAX, op->value.string, &length, &name); acpi_ns_externalize_name (ACPI_UINT32_MAX, op->value.string, NULL, &name);
if (name) { if (name) {
REPORT_WARNING (("Reference %s at AML %X not found\n", ACPI_REPORT_WARNING (("Reference %s at AML %X not found\n",
name, op->aml_offset)); name, op->aml_offset));
ACPI_MEM_FREE (name); ACPI_MEM_FREE (name);
} }
else { else {
REPORT_WARNING (("Reference %s at AML %X not found\n", ACPI_REPORT_WARNING (("Reference %s at AML %X not found\n",
op->value.string, op->aml_offset)); op->value.string, op->aml_offset));
} }
...@@ -469,23 +467,11 @@ acpi_ds_build_internal_simple_obj ( ...@@ -469,23 +467,11 @@ acpi_ds_build_internal_simple_obj (
} }
} }
} }
/*
* The reference will be a Reference
* TBD: [Restructure] unless we really need a separate
* type of INTERNAL_TYPE_REFERENCE change
* Acpi_ds_map_opcode_to_data_type to handle this case
*/
type = INTERNAL_TYPE_REFERENCE;
}
else {
type = acpi_ds_map_opcode_to_data_type (op->opcode, NULL);
} }
/* Create and init the internal ACPI object */ /* Create and init the internal ACPI object */
obj_desc = acpi_ut_create_internal_object (type); obj_desc = acpi_ut_create_internal_object ((acpi_ps_get_opcode_info (op->opcode))->object_type);
if (!obj_desc) { if (!obj_desc) {
return_ACPI_STATUS (AE_NO_MEMORY); return_ACPI_STATUS (AE_NO_MEMORY);
} }
...@@ -527,7 +513,7 @@ acpi_ds_build_internal_package_obj ( ...@@ -527,7 +513,7 @@ acpi_ds_build_internal_package_obj (
acpi_status status = AE_OK; acpi_status status = AE_OK;
FUNCTION_TRACE ("Ds_build_internal_package_obj"); ACPI_FUNCTION_TRACE ("Ds_build_internal_package_obj");
obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_PACKAGE); obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_PACKAGE);
...@@ -651,7 +637,7 @@ acpi_ds_create_node ( ...@@ -651,7 +637,7 @@ acpi_ds_create_node (
acpi_operand_object *obj_desc; acpi_operand_object *obj_desc;
FUNCTION_TRACE_PTR ("Ds_create_node", op); ACPI_FUNCTION_TRACE_PTR ("Ds_create_node", op);
/* /*
...@@ -659,7 +645,7 @@ acpi_ds_create_node ( ...@@ -659,7 +645,7 @@ acpi_ds_create_node (
* parts of the table, we can arrive here twice. Only init * parts of the table, we can arrive here twice. Only init
* the named object node the first time through * the named object node the first time through
*/ */
if (node->object) { if (acpi_ns_get_attached_object (node)) {
return_ACPI_STATUS (AE_OK); return_ACPI_STATUS (AE_OK);
} }
...@@ -682,7 +668,7 @@ acpi_ds_create_node ( ...@@ -682,7 +668,7 @@ acpi_ds_create_node (
/* Init obj */ /* Init obj */
status = acpi_ns_attach_object (node, obj_desc, (u8) node->type); status = acpi_ns_attach_object (node, obj_desc, node->type);
/* Remove local reference to the object */ /* Remove local reference to the object */
......
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.
# #
# Makefile for all Linux ACPI interpreter subdirectories # Makefile for all Linux ACPI interpreter subdirectories
# EXCEPT for the ospm directory
# #
O_TARGET := $(notdir $(CURDIR)).o O_TARGET := $(notdir $(CURDIR)).o
obj-$(CONFIG_ACPI) := $(patsubst %.c,%.o,$(wildcard *.c)) obj-$(CONFIG_ACPI_INTERPRETER) := $(patsubst %.c,%.o,$(wildcard *.c))
EXTRA_CFLAGS += $(ACPI_CFLAGS) EXTRA_CFLAGS += $(ACPI_CFLAGS)
......
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.
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