// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 /******************************************************************************* * * Module Name: dbinput - user front-end to the AML debugger * ******************************************************************************/ #include <acpi/acpi.h> #include "accommon.h" #include "acdebug.h" #ifdef ACPI_APPLICATION #include "acapps.h" #endif #define _COMPONENT … ACPI_MODULE_NAME("dbinput") /* Local prototypes */ static u32 acpi_db_get_line(char *input_buffer); static u32 acpi_db_match_command(char *user_command); static void acpi_db_display_command_info(const char *command, u8 display_all); static void acpi_db_display_help(char *command); static u8 acpi_db_match_command_help(const char *command, const struct acpi_db_command_help *help); /* * Top-level debugger commands. * * This list of commands must match the string table below it */ enum acpi_ex_debugger_commands { … }; #define CMD_FIRST_VALID … /* Second parameter is the required argument count */ static const struct acpi_db_command_info acpi_gbl_db_commands[] = …; /* * 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. */ static const struct acpi_db_command_help acpi_gbl_db_command_help[] = …; /******************************************************************************* * * 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. * ******************************************************************************/ static u8 acpi_db_match_command_help(const char *command, const struct acpi_db_command_help *help) { … } /******************************************************************************* * * 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. * ******************************************************************************/ static void acpi_db_display_command_info(const char *command, u8 display_all) { … } /******************************************************************************* * * 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. * ******************************************************************************/ static void acpi_db_display_help(char *command) { … } /******************************************************************************* * * 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 * ******************************************************************************/ char *acpi_db_get_next_token(char *string, char **next, acpi_object_type *return_type) { … } /******************************************************************************* * * 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 * ******************************************************************************/ static u32 acpi_db_get_line(char *input_buffer) { … } /******************************************************************************* * * 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 * ******************************************************************************/ static u32 acpi_db_match_command(char *user_command) { … } /******************************************************************************* * * FUNCTION: acpi_db_command_dispatch * * PARAMETERS: input_buffer - Command line buffer * walk_state - Current walk * op - Current (executing) parse op * * RETURN: Status * * DESCRIPTION: Command dispatcher. * ******************************************************************************/ acpi_status acpi_db_command_dispatch(char *input_buffer, struct acpi_walk_state *walk_state, union acpi_parse_object *op) { … } /******************************************************************************* * * FUNCTION: acpi_db_execute_thread * * PARAMETERS: context - Not used * * RETURN: None * * DESCRIPTION: Debugger execute thread. Waits for a command line, then * simply dispatches it. * ******************************************************************************/ void ACPI_SYSTEM_XFACE acpi_db_execute_thread(void *context) { … } /******************************************************************************* * * FUNCTION: acpi_db_user_commands * * PARAMETERS: None * * RETURN: None * * DESCRIPTION: Command line execution for the AML debugger. Commands are * matched and dispatched here. * ******************************************************************************/ acpi_status acpi_db_user_commands(void) { … }