📄 dbcmds.c
字号:
/******************************************************************************* * * Module Name: dbcmds - debug commands and output routines * $Revision: 66 $ * ******************************************************************************//* * Copyright (C) 2000, 2001 R. Byron Moore * * 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 * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */#include "acpi.h"#include "acparser.h"#include "acdispat.h"#include "amlcode.h"#include "acnamesp.h"#include "acparser.h"#include "acevents.h"#include "acinterp.h"#include "acdebug.h"#include "actables.h"#include "acresrc.h"#ifdef ENABLE_DEBUGGER#define _COMPONENT ACPI_DEBUGGER MODULE_NAME ("dbcmds")/* * Arguments for the Objects command * These object types map directly to the ACPI_TYPES */ARGUMENT_INFO acpi_db_object_types [] ={ {"ANY"}, {"NUMBERS"}, {"STRINGS"}, {"BUFFERS"}, {"PACKAGES"}, {"FIELDS"}, {"DEVICES"}, {"EVENTS"}, {"METHODS"}, {"MUTEXES"}, {"REGIONS"}, {"POWERRESOURCES"}, {"PROCESSORS"}, {"THERMALZONES"}, {"BUFFERFIELDS"}, {"DDBHANDLES"}, {NULL} /* Must be null terminated */};/******************************************************************************* * * FUNCTION: Acpi_db_walk_for_references * * PARAMETERS: Callback from Walk_namespace * * RETURN: Status * * DESCRIPTION: Check if this namespace object refers to the target object * that is passed in as the context value. * ******************************************************************************/acpi_statusacpi_db_walk_for_references ( acpi_handle obj_handle, u32 nesting_level, void *context, void **return_value){ acpi_operand_object *obj_desc = (acpi_operand_object *) context; acpi_namespace_node *node = (acpi_namespace_node *) obj_handle; /* Check for match against the namespace node itself */ if (node == (void *) obj_desc) { acpi_os_printf ("Object is a Node [%4.4s]\n", &node->name); } /* Check for match against the object attached to the node */ if (node->object == obj_desc) { acpi_os_printf ("Reference at Node->Object %p [%4.4s]\n", node, &node->name); } /* Check first child for a match */ /* TBD: [Investigate] probably now obsolete with new datastructure */ if (node->child == (void *) obj_desc) { acpi_os_printf ("Reference at Node->Child %p [%4.4s]\n", node, &node->name); } return (AE_OK);}/******************************************************************************* * * FUNCTION: Acpi_db_find_references * * PARAMETERS: Object_arg - String with hex value of the object * * RETURN: None * * DESCRIPTION: Search namespace for all references to the input object * ******************************************************************************/voidacpi_db_find_references ( NATIVE_CHAR *object_arg){ acpi_operand_object *obj_desc; /* Convert string to object pointer */ obj_desc = (acpi_operand_object *) STRTOUL (object_arg, NULL, 16); /* Search all nodes in namespace */ acpi_walk_namespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, acpi_db_walk_for_references, (void *) obj_desc, NULL);}/******************************************************************************* * * FUNCTION: Acpi_db_display_locks * * PARAMETERS: None * * RETURN: None * * DESCRIPTION: Display information about internal mutexes. * ******************************************************************************/voidacpi_db_display_locks (void){ u32 i; for (i = 0; i < MAX_MTX; i++) { acpi_os_printf ("%26s : %s\n", acpi_ut_get_mutex_name (i), acpi_gbl_acpi_mutex_info[i].owner_id == ACPI_MUTEX_NOT_ACQUIRED ? "Locked" : "Unlocked"); }}/******************************************************************************* * * FUNCTION: Acpi_db_display_table_info * * PARAMETERS: Table_arg - String with name of table to be displayed * * RETURN: None * * DESCRIPTION: Display information about loaded tables. Current * implementation displays all loaded tables. * ******************************************************************************/voidacpi_db_display_table_info ( NATIVE_CHAR *table_arg){ u32 i; for (i = 0; i < NUM_ACPI_TABLES; i++) { if (acpi_gbl_acpi_tables[i].pointer) { acpi_os_printf ("%s at %p length %X\n", acpi_gbl_acpi_table_data[i].name, acpi_gbl_acpi_tables[i].pointer, acpi_gbl_acpi_tables[i].length); } }}/******************************************************************************* * * FUNCTION: Acpi_db_unload_acpi_table * * PARAMETERS: Table_arg - Name of the table to be unloaded * Instance_arg - Which instance of the table to unload (if * there are multiple tables of the same type) * * RETURN: Nonde * * DESCRIPTION: Unload an ACPI table. * Instance is not implemented * ******************************************************************************/voidacpi_db_unload_acpi_table ( NATIVE_CHAR *table_arg, NATIVE_CHAR *instance_arg){ u32 i; acpi_status status; /* Search all tables for the target type */ for (i = 0; i < NUM_ACPI_TABLES; i++) { if (!STRNCMP (table_arg, acpi_gbl_acpi_table_data[i].signature, acpi_gbl_acpi_table_data[i].sig_length)) { /* Found the table, unload it */ status = acpi_unload_table (i); if (ACPI_SUCCESS (status)) { acpi_os_printf ("[%s] unloaded and uninstalled\n", table_arg); } else { acpi_os_printf ("%s, while unloading [%s]\n", acpi_format_exception (status), table_arg); } return; } } acpi_os_printf ("Unknown table type [%s]\n", table_arg);}/******************************************************************************* * * FUNCTION: Acpi_db_set_method_breakpoint * * PARAMETERS: Location - AML offset of breakpoint * Walk_state - Current walk info * Op - Current Op (from parse walk) * * RETURN: None * * DESCRIPTION: Set a breakpoint in a control method at the specified * AML offset * ******************************************************************************/voidacpi_db_set_method_breakpoint ( NATIVE_CHAR *location, acpi_walk_state *walk_state, acpi_parse_object *op){ u32 address; if (!op) { acpi_os_printf ("There is no method currently executing\n"); return; } /* Get and verify the breakpoint address */ address = STRTOUL (location, NULL, 16); if (address <= op->aml_offset) { acpi_os_printf ("Breakpoint %X is beyond current address %X\n", address, op->aml_offset); } /* Save breakpoint in current walk */ walk_state->method_breakpoint = address; acpi_os_printf ("Breakpoint set at AML offset %X\n", address);}/******************************************************************************* * * FUNCTION: Acpi_db_set_method_call_breakpoint * * PARAMETERS: Op - Current Op (from parse walk) * * RETURN: None * * DESCRIPTION: Set a breakpoint in a control method at the specified * AML offset * ******************************************************************************/voidacpi_db_set_method_call_breakpoint ( acpi_parse_object *op){ if (!op) { acpi_os_printf ("There is no method currently executing\n"); return; } acpi_gbl_step_to_next_call = TRUE;}/******************************************************************************* * * FUNCTION: Acpi_db_disassemble_aml * * PARAMETERS: Statements - Number of statements to disassemble * Op - Current Op (from parse walk) * * RETURN: None * * DESCRIPTION: Display disassembled AML (ASL) starting from Op for the number * of statements specified. * ******************************************************************************/voidacpi_db_disassemble_aml ( NATIVE_CHAR *statements, acpi_parse_object *op){ u32 num_statements = 8; if (!op) { acpi_os_printf ("There is no method currently executing\n"); return; } if (statements) { num_statements = STRTOUL (statements, NULL, 0); } acpi_db_display_op (NULL, op, num_statements);}/******************************************************************************* * * FUNCTION: Acpi_db_dump_namespace * * PARAMETERS: Start_arg - Node to begin namespace dump * Depth_arg - Maximum tree depth to be dumped * * RETURN: None * * DESCRIPTION: Dump entire namespace or a subtree. Each node is displayed * with type and other information. * ******************************************************************************/voidacpi_db_dump_namespace ( NATIVE_CHAR *start_arg, NATIVE_CHAR *depth_arg){ acpi_handle subtree_entry = acpi_gbl_root_node; u32 max_depth = ACPI_UINT32_MAX; /* No argument given, just start at the root and dump entire namespace */ if (start_arg) { /* Check if numeric argument, must be a Node */ if ((start_arg[0] >= 0x30) && (start_arg[0] <= 0x39)) { subtree_entry = (acpi_handle) STRTOUL (start_arg, NULL, 16); if (!acpi_os_readable (subtree_entry, sizeof (acpi_namespace_node))) { acpi_os_printf ("Address %p is invalid in this address space\n", subtree_entry); return; } if (!VALID_DESCRIPTOR_TYPE ((subtree_entry), ACPI_DESC_TYPE_NAMED)) { acpi_os_printf ("Address %p is not a valid Named object\n", subtree_entry); return; } } /* Alpha argument */ else { /* The parameter is a name string that must be resolved to a Named obj*/ subtree_entry = acpi_db_local_ns_lookup (start_arg); if (!subtree_entry) { subtree_entry = acpi_gbl_root_node; } } /* Now we can check for the depth argument */ if (depth_arg) { max_depth = STRTOUL (depth_arg, NULL, 0); } } acpi_db_set_output_destination (DB_DUPLICATE_OUTPUT); acpi_os_printf ("ACPI Namespace (from %p subtree):\n", subtree_entry); /* Display the subtree */ acpi_db_set_output_destination (DB_REDIRECTABLE_OUTPUT); acpi_ns_dump_objects (ACPI_TYPE_ANY, ACPI_DISPLAY_SUMMARY, max_depth, ACPI_UINT32_MAX, subtree_entry); acpi_db_set_output_destination (DB_CONSOLE_OUTPUT);}/******************************************************************************* * * FUNCTION: Acpi_db_dump_namespace_by_owner * * PARAMETERS: Owner_arg - Owner ID whose nodes will be displayed * Depth_arg - Maximum tree depth to be dumped * * RETURN: None * * DESCRIPTION: Dump elements of the namespace that are owned by the Owner_id. * ******************************************************************************/voidacpi_db_dump_namespace_by_owner ( NATIVE_CHAR *owner_arg, NATIVE_CHAR *depth_arg){ acpi_handle subtree_entry = acpi_gbl_root_node; u32 max_depth = ACPI_UINT32_MAX; u16 owner_id; owner_id = (u16) STRTOUL (owner_arg, NULL, 0); /* Now we can check for the depth argument */ if (depth_arg) { max_depth = STRTOUL (depth_arg, NULL, 0); } acpi_db_set_output_destination (DB_DUPLICATE_OUTPUT); acpi_os_printf ("ACPI Namespace by owner %X:\n", owner_id); /* Display the subtree */ acpi_db_set_output_destination (DB_REDIRECTABLE_OUTPUT); acpi_ns_dump_objects (ACPI_TYPE_ANY, ACPI_DISPLAY_SUMMARY, max_depth, owner_id, subtree_entry); acpi_db_set_output_destination (DB_CONSOLE_OUTPUT);}/******************************************************************************* * * FUNCTION: Acpi_db_send_notify * * PARAMETERS: Name - Name of ACPI object to send the notify to * Value - Value of the notify to send. * * RETURN: None * * DESCRIPTION: Send an ACPI notification. The value specified is sent to the * named object as an ACPI notify. * ******************************************************************************/voidacpi_db_send_notify ( NATIVE_CHAR *name, u32 value){ acpi_namespace_node *node; /* Translate name to an Named object */ node = acpi_db_local_ns_lookup (name); if (!node) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -