// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 /******************************************************************************* * * Module Name: dbinput - user front-end to the AML debugger *
******************************************************************************/
/* * Help for all debugger commands. First argument is the number of lines * of help to output for the command. * * Note: Some commands are not supported by the kernel-level version of * the debugger.
*/ staticconststruct acpi_db_command_help acpi_gbl_db_command_help[] = {
{0, "\nNamespace Access:", "\n"},
{1, " Businfo", "Display system bus info\n"},
{1, " Disassemble ", "Disassemble a control method\n"},
{1, " Find (? is wildcard)", "Find ACPI name(s) with wildcards\n"},
{1, " Integrity", "Validate namespace integrity\n"},
{1, " Methods", "Display list of loaded control methods\n"},
{1, " Fields ", "Display list of loaded field units by space ID\n"},
{1, " Namespace [Object] [Depth]", "Display loaded namespace tree/subtree\n"},
{1, " Notify , "Send a notification on Object\n"},
{1, " Objects [ObjectType]", "Display summary of all objects or just given type\n"},
{1, " Owner [Depth]", "Display loaded namespace by object owner\n"},
{1, " Paths", "Display full pathnames of namespace objects\n"},
{1, " Predefined", "Check all predefined names\n"},
{1, " Prefix []", "Set or Get current execution prefix\n"},
{1, " References ", "Find all references to object at addr\n"},
{1, " Resources [DeviceName]", "Display Device resources (no arg = all devices)\n"},
{1, " Set N ", "Set value for named integer\n"},
{1, " Template , "Format/dump a Buffer/ResourceTemplate\n"},
{1, " Type , "Display object type\n"},
{0, "\nControl Method Execution:", "\n"},
{1, " All ", "Evaluate all objects named NameSeg\n"},
{1, " Evaluate [Arguments]", "Evaluate object or control method\n"},
{1, " Execute [Arguments]", "Synonym for Evaluate\n"}, #ifdef ACPI_APPLICATION
{1, " Background [Arguments]", "Evaluate object/method in a separate thread\n"},
{1, " Thread ", "Spawn threads to execute method(s)\n"}, #endif
{1, " Debug [Arguments]", "Single-Step a control method\n"},
{7, " [Arguments] formats:", "Control method argument formats\n"},
{1, " Hex Integer", "Integer\n"},
{1, " \"Ascii String\"", "String\n"},
{1, " (Hex Byte List)", "Buffer\n"},
{1, " (01 42 7A BF)", "Buffer example (4 bytes)\n"},
{1, " [Package Element List]", "Package\n"},
{1, " [0x01 0x1234 \"string\"]", "Package example (3 elements)\n"},
{0, "\nMiscellaneous:", "\n"},
{1, " Allocations", "Display list of current memory allocations\n"},
{2, " Dump |", "\n"},
{0, " [Byte|Word|Dword|Qword]", "Display ACPI objects or memory\n"},
{1, " Handlers", "Info about global handlers\n"},
{1, " Help [Command]", "This help screen or individual command\n"},
{1, " History", "Display command history buffer\n"},
{1, " Level ] [console]", "Get/Set debug level for file or console\n"},
{1, " Locks", "Current status of internal mutexes\n"},
{1, " Osi [Install|Remove ]", "Display or modify global _OSI list\n"},
{1, " Quit or Exit", "Exit this command\n"},
{8, " Stats ", "Display namespace and memory statistics\n"},
{1, " Allocations", "Display list of current memory allocations\n"},
{1, " Memory", "Dump internal memory lists\n"},
{1, " Misc", "Namespace search and mutex stats\n"},
{1, " Objects", "Summary of namespace objects\n"},
{1, " Sizes", "Sizes for each of the internal objects\n"},
{1, " Stack", "Display CPU stack usage\n"},
{1, " Tables", "Info about current ACPI table(s)\n"},
{1, " Tables", "Display info about loaded ACPI tables\n"}, #ifdef ACPI_APPLICATION
{1, " Terminate", "Delete namespace and all internal objects\n"}, #endif
{1, " ! ", "Execute command from history buffer\n"},
{1, " !!", "Execute last command again\n"},
{0, "\nMethod and Namespace Debugging:", "\n"},
{5, " Trace [] [Once]", "Trace control method execution\n"},
{1, " Enable", "Enable all messages\n"},
{1, " Disable", "Disable tracing\n"},
{1, " Method", "Enable method execution messages\n"},
{1, " Opcode", "Enable opcode execution messages\n"},
{3, " Test ", "Invoke a debug test\n"},
{1, " Objects", "Read/write/compare all namespace data objects\n"},
{1, " Predefined", "Validate all ACPI predefined names (_STA, etc.)\n"},
{1, " Execute predefined", "Execute all predefined (public) methods\n"},
{0, "\nControl Method Single-Step Execution:", "\n"},
{1, " Arguments (or Args)", "Display method arguments\n"},
{1, " Breakpoint ", "Set an AML execution breakpoint\n"},
{1, " Call", "Run to next control method invocation\n"},
{1, " Go", "Allow method to run to completion\n"},
{1, " Information", "Display info about the current method\n"},
{1, " Into", "Step into (not over) a method call\n"},
{1, " List [# of Aml Opcodes]", "Display method ASL statements\n"},
{1, " Locals", "Display method local variables\n"},
{1, " Results", "Display method result stack\n"},
{1, " Set <#> ", "Set method data (Arguments/Locals)\n"},
{1, " Stop", "Terminate control method\n"},
{1, " Tree", "Display control method calling tree\n"},
{1, " ", "Single step next AML opcode (over calls)\n"},
#ifdef ACPI_APPLICATION
{0, "\nFile Operations:", "\n"},
{1, " Close", "Close debug output file\n"},
{1, " Load ", "Load ACPI table from a file\n"},
{1, " Open , "Open a file for debug output\n"},
{1, " Unload ", "Unload an ACPI table via namespace object\n"},
{0, "\nHardware Simulation:", "\n"},
{1, " EnableAcpi", "Enable ACPI (hardware) mode\n"},
{1, " Event ", "Generate AcpiEvent (Fixed/GPE)\n"},
{1, " Gpe [GpeBlockDevice]", "Simulate a GPE\n"},
{1, " Gpes", "Display info on all GPE devices\n"},
{1, " Sci", "Generate an SCI\n"},
{1, " Sleep [SleepState]", "Simulate sleep/wake sequence(s) (0-5)\n"},
{1, " Interrupt ", "Simulate an interrupt\n"}, #endif
{0, NULL, NULL}
};
/******************************************************************************* * * FUNCTION: acpi_db_match_command_help * * PARAMETERS: command - Command string to match * help - Help table entry to attempt match * * RETURN: TRUE if command matched, FALSE otherwise * * DESCRIPTION: Attempt to match a command in the help table in order to * print help information for a single command. *
******************************************************************************/
/******************************************************************************* * * FUNCTION: acpi_db_display_command_info * * PARAMETERS: command - Command string to match * display_all - Display all matching commands, or just * the first one (substring match) * * RETURN: None * * DESCRIPTION: Display help information for a Debugger command. *
******************************************************************************/
next = acpi_gbl_db_command_help; while (next->invocation) {
matched = acpi_db_match_command_help(command, next); if (!display_all && matched) { return;
}
next++;
}
}
/******************************************************************************* * * FUNCTION: acpi_db_display_help * * PARAMETERS: command - Optional command string to display help. * if not specified, all debugger command * help strings are displayed * * RETURN: None * * DESCRIPTION: Display help for a single debugger command, or all of them. *
******************************************************************************/
/* No argument to help, display help for all commands */
acpi_os_printf("\nSummary of AML Debugger Commands\n\n");
while (next->invocation) {
acpi_os_printf("%-38s%s", next->invocation,
next->description);
next++;
}
acpi_os_printf("\n");
} else { /* Display help for all commands that match the substring */
acpi_db_display_command_info(command, TRUE);
}
}
/******************************************************************************* * * FUNCTION: acpi_db_get_next_token * * PARAMETERS: string - Command buffer * next - Return value, end of next token * * RETURN: Pointer to the start of the next token. * * DESCRIPTION: Command line parsing. Get the next token on the command line *
******************************************************************************/
/******************************************************************************* * * FUNCTION: acpi_db_get_line * * PARAMETERS: input_buffer - Command line buffer * * RETURN: Count of arguments to the command * * DESCRIPTION: Get the next command line from the user. Gets entire line * up to the next newline *
******************************************************************************/
if (acpi_ut_safe_strcpy
(acpi_gbl_db_parsed_buf, sizeof(acpi_gbl_db_parsed_buf),
input_buffer)) {
acpi_os_printf
("Buffer overflow while parsing input line (max %u characters)\n",
(u32)sizeof(acpi_gbl_db_parsed_buf)); return (0);
}
this = acpi_gbl_db_parsed_buf; for (i = 0; i < ACPI_DEBUGGER_MAX_ARGS; i++) {
acpi_gbl_db_args[i] = acpi_db_get_next_token(this, &next,
&acpi_gbl_db_arg_types
[i]); if (!acpi_gbl_db_args[i]) { break;
}
this = next;
}
/* Uppercase the actual command */
acpi_ut_strupr(acpi_gbl_db_args[0]);
count = i; if (count) {
count--; /* Number of args only */
}
return (count);
}
/******************************************************************************* * * FUNCTION: acpi_db_match_command * * PARAMETERS: user_command - User command line * * RETURN: Index into command array, -1 if not found * * DESCRIPTION: Search command array for a command match *
******************************************************************************/
/* * We don't want to add the !! command to the history buffer. It * would cause an infinite loop because it would always be the * previous command.
*/ if (command_index != CMD_HISTORY_LAST) {
acpi_db_add_to_history(input_buffer);
}
/* Verify that we have the minimum number of params */
#ifdef ACPI_DISASSEMBLER
(void)acpi_db_disassemble_method(acpi_gbl_db_args[1]); #else
acpi_os_printf
("The AML Disassembler is not configured/present\n"); #endif break;
status = acpi_db_find_name_in_namespace(acpi_gbl_db_args[1]); break;
case CMD_FIELDS:
status = acpi_ut_strtoul64(acpi_gbl_db_args[1], &temp64);
if (ACPI_FAILURE(status)
|| temp64 >= ACPI_NUM_PREDEFINED_REGIONS) {
acpi_os_printf
("Invalid address space ID: must be between 0 and %u inclusive\n",
ACPI_NUM_PREDEFINED_REGIONS - 1); return (AE_OK);
}
status = acpi_db_display_fields((u32)temp64); break;
case CMD_GO:
acpi_gbl_cm_single_step = FALSE; return (AE_OK);
case CMD_HANDLERS:
acpi_db_display_handlers(); break;
case CMD_HELP: case CMD_HELP2:
acpi_db_display_help(acpi_gbl_db_args[1]); break;
case CMD_HISTORY:
acpi_db_display_history(); break;
case CMD_HISTORY_EXE: /* ! command */
command_line = acpi_db_get_from_history(acpi_gbl_db_args[1]); if (!command_line) { return (AE_CTRL_TRUE);
}
status = acpi_db_command_dispatch(command_line, walk_state, op); return (status);
case CMD_HISTORY_LAST: /* !! command */
command_line = acpi_db_get_from_history(NULL); if (!command_line) { return (AE_CTRL_TRUE);
}
status = acpi_db_command_dispatch(command_line, walk_state, op); return (status);
case CMD_INFORMATION:
acpi_db_display_method_info(op); break;
case CMD_INTEGRITY:
acpi_db_check_integrity(); break;
case CMD_INTO:
if (op) {
acpi_gbl_cm_single_step = TRUE; return (AE_OK);
} break;
case CMD_LEVEL:
if (param_count == 0) {
acpi_os_printf
("Current debug level for file output is: %8.8X\n",
acpi_gbl_db_debug_level);
acpi_os_printf
("Current debug level for console output is: %8.8X\n",
acpi_gbl_db_console_debug_level);
} elseif (param_count == 2) {
temp = acpi_gbl_db_console_debug_level;
acpi_gbl_db_console_debug_level =
strtoul(acpi_gbl_db_args[1], NULL, 16);
acpi_os_printf
("Debug Level for console output was %8.8X, now %8.8X\n",
temp, acpi_gbl_db_console_debug_level);
} else {
temp = acpi_gbl_db_debug_level;
acpi_gbl_db_debug_level =
strtoul(acpi_gbl_db_args[1], NULL, 16);
acpi_os_printf
("Debug Level for file output was %8.8X, now %8.8X\n",
temp, acpi_gbl_db_debug_level);
} break;
case CMD_LIST:
#ifdef ACPI_DISASSEMBLER
acpi_db_disassemble_aml(acpi_gbl_db_args[1], op); #else
acpi_os_printf
("The AML Disassembler is not configured/present\n"); #endif break;
case CMD_LOCKS:
acpi_db_display_locks(); break;
case CMD_LOCALS:
acpi_db_display_locals(); break;
case CMD_METHODS:
status = acpi_db_display_objects("METHOD", acpi_gbl_db_args[1]); break;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.