📄 dbinput.c
字号:
/******************************************************************************* * * 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. Called from two places: * ******************************************************************************/acpi_statusacpi_db_command_dispatch ( NATIVE_CHAR *input_buffer, acpi_walk_state *walk_state, acpi_parse_object *op){ u32 temp; u32 command_index; u32 param_count; NATIVE_CHAR *command_line; acpi_status status = AE_CTRL_TRUE; /* If Acpi_terminate has been called, terminate this thread */ if (acpi_gbl_db_terminate_threads) { return (AE_CTRL_TERMINATE); } param_count = acpi_db_get_line (input_buffer); command_index = acpi_db_match_command (acpi_gbl_db_args[0]); temp = 0; /* Verify that we have the minimum number of params */ if (param_count < acpi_gbl_db_commands[command_index].min_args) { acpi_os_printf ("%d parameters entered, [%s] requires %d parameters\n", param_count, acpi_gbl_db_commands[command_index].name, acpi_gbl_db_commands[command_index].min_args); return (AE_CTRL_TRUE); } /* Decode and dispatch the command */ switch (command_index) { case CMD_NULL: if (op) { return (AE_OK); } break; case CMD_ALLOCATIONS:#ifdef ACPI_DBG_TRACK_ALLOCATIONS acpi_ut_dump_allocations ((u32) -1, NULL);#endif break; case CMD_ARGS: case CMD_ARGUMENTS: acpi_db_display_arguments (); break; case CMD_BREAKPOINT: acpi_db_set_method_breakpoint (acpi_gbl_db_args[1], walk_state, op); break; case CMD_CALL: acpi_db_set_method_call_breakpoint (op); status = AE_OK; break; case CMD_CLOSE: acpi_db_close_debug_file (); break; case CMD_DEBUG: acpi_db_execute (acpi_gbl_db_args[1], &acpi_gbl_db_args[2], EX_SINGLE_STEP); break; case CMD_DUMP: acpi_db_decode_and_display_object (acpi_gbl_db_args[1], acpi_gbl_db_args[2]); break; case CMD_ENABLEACPI: status = acpi_enable(); if (ACPI_FAILURE(status)) { acpi_os_printf("Acpi_enable failed (Status=%X)\n", status); return (status); } break; case CMD_EVENT: acpi_os_printf ("Event command not implemented\n"); break; case CMD_EXECUTE: acpi_db_execute (acpi_gbl_db_args[1], &acpi_gbl_db_args[2], EX_NO_SINGLE_STEP); break; case CMD_FIND: acpi_db_find_name_in_namespace (acpi_gbl_db_args[1]); break; case CMD_GO: acpi_gbl_cm_single_step = FALSE; return (AE_OK); 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_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); if (ACPI_SUCCESS (status)) { status = AE_CTRL_TRUE; } return (status); break; case CMD_HISTORY_LAST: 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); if (ACPI_SUCCESS (status)) { status = AE_CTRL_TRUE; } return (status); case CMD_INFORMATION: acpi_db_display_method_info (op); break; case CMD_INTO: if (op) { acpi_gbl_cm_single_step = TRUE;/* TBD: Must get current walk state */ /* Acpi_gbl_Method_breakpoint = 0; */ return (AE_OK); } break; case CMD_LEVEL: if (param_count == 0) { acpi_os_printf ("Current debug level for file output is: %8.8lX\n", acpi_gbl_db_debug_level); acpi_os_printf ("Current debug level for console output is: %8.8lX\n", acpi_gbl_db_console_debug_level); } else if (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.8lX, now %8.8lX\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.8lX, now %8.8lX\n", temp, acpi_gbl_db_debug_level); } break; case CMD_LIST: acpi_db_disassemble_aml (acpi_gbl_db_args[1], op); break; case CMD_LOAD: status = acpi_db_load_acpi_table (acpi_gbl_db_args[1]); if (ACPI_FAILURE (status)) { return (status); } break; case CMD_LOCKS: acpi_db_display_locks (); break; case CMD_LOCALS: acpi_db_display_locals (); break; case CMD_METHODS: acpi_db_display_objects ("METHOD", acpi_gbl_db_args[1]); break; case CMD_NAMESPACE: acpi_db_dump_namespace (acpi_gbl_db_args[1], acpi_gbl_db_args[2]); break; case CMD_NOTIFY: temp = STRTOUL (acpi_gbl_db_args[2], NULL, 0); acpi_db_send_notify (acpi_gbl_db_args[1], temp); break; case CMD_OBJECT: acpi_db_display_objects (STRUPR (acpi_gbl_db_args[1]), acpi_gbl_db_args[2]); break; case CMD_OPEN: acpi_db_open_debug_file (acpi_gbl_db_args[1]); break; case CMD_OWNER: acpi_db_dump_namespace_by_owner (acpi_gbl_db_args[1], acpi_gbl_db_args[2]); break; case CMD_PREFIX: acpi_db_set_scope (acpi_gbl_db_args[1]); break; case CMD_REFERENCES: acpi_db_find_references (acpi_gbl_db_args[1]); break; case CMD_RESOURCES: acpi_db_display_resources (acpi_gbl_db_args[1]); break; case CMD_RESULTS: acpi_db_display_results (); break; case CMD_SET: acpi_db_set_method_data (acpi_gbl_db_args[1], acpi_gbl_db_args[2], acpi_gbl_db_args[3]); break; case CMD_STATS: acpi_db_display_statistics (acpi_gbl_db_args[1]); break; case CMD_STOP: return (AE_AML_ERROR); break; case CMD_TABLES: acpi_db_display_table_info (acpi_gbl_db_args[1]); break; case CMD_TERMINATE: acpi_db_set_output_destination (DB_REDIRECTABLE_OUTPUT); acpi_ut_subsystem_shutdown (); /* TBD: [Restructure] Need some way to re-initialize without re-creating the semaphores! */ /* Acpi_initialize (NULL); */ break; case CMD_THREADS: acpi_db_create_execution_threads (acpi_gbl_db_args[1], acpi_gbl_db_args[2], acpi_gbl_db_args[3]); break; case CMD_TREE: acpi_db_display_calling_tree (); break; case CMD_UNLOAD: acpi_db_unload_acpi_table (acpi_gbl_db_args[1], acpi_gbl_db_args[2]); break; case CMD_EXIT: case CMD_QUIT: if (op) { acpi_os_printf ("Method execution terminated\n"); return (AE_CTRL_TERMINATE); } if (!acpi_gbl_db_output_to_file) { acpi_dbg_level = DEBUG_DEFAULT; } /* Shutdown */ /* Acpi_ut_subsystem_shutdown (); */ acpi_db_close_debug_file (); acpi_gbl_db_terminate_threads = TRUE; return (AE_CTRL_TERMINATE); case CMD_NOT_FOUND: acpi_os_printf ("Unknown Command\n"); return (AE_CTRL_TRUE); } /* Add all commands that come here to the history buffer */ acpi_db_add_to_history (input_buffer); return (status);}/******************************************************************************* * * FUNCTION: Acpi_db_execute_thread * * PARAMETERS: Context - Not used * * RETURN: None * * DESCRIPTION: Debugger execute thread. Waits for a command line, then * simply dispatches it. * ******************************************************************************/voidacpi_db_execute_thread ( void *context){ acpi_status status = AE_OK; while (status != AE_CTRL_TERMINATE) { acpi_gbl_method_executing = FALSE; acpi_gbl_step_to_next_call = FALSE; acpi_ut_acquire_mutex (ACPI_MTX_DEBUG_CMD_READY); status = acpi_db_command_dispatch (acpi_gbl_db_line_buf, NULL, NULL); acpi_ut_release_mutex (ACPI_MTX_DEBUG_CMD_COMPLETE); }}/******************************************************************************* * * FUNCTION: Acpi_db_single_thread * * PARAMETERS: None * * RETURN: None * * DESCRIPTION: Debugger execute thread. Waits for a command line, then * simply dispatches it. * ******************************************************************************/voidacpi_db_single_thread ( void){ acpi_status status = AE_OK; acpi_gbl_method_executing = FALSE; acpi_gbl_step_to_next_call = FALSE; status = acpi_db_command_dispatch (acpi_gbl_db_line_buf, NULL, NULL);}/******************************************************************************* * * FUNCTION: Acpi_db_user_commands * * PARAMETERS: Prompt - User prompt (depends on mode) * Op - Current executing parse op * * RETURN: None * * DESCRIPTION: Command line execution for the AML debugger. Commands are * matched and dispatched here. * ******************************************************************************/acpi_statusacpi_db_user_commands ( NATIVE_CHAR prompt, acpi_parse_object *op){ acpi_status status = AE_OK; /* TBD: [Restructure] Need a separate command line buffer for step mode */ while (!acpi_gbl_db_terminate_threads) { /* Force output to console until a command is entered */ acpi_db_set_output_destination (DB_CONSOLE_OUTPUT); /* Different prompt if method is executing */ if (!acpi_gbl_method_executing) { acpi_os_printf ("%1c ", DB_COMMAND_PROMPT); } else { acpi_os_printf ("%1c ", DB_EXECUTE_PROMPT); } /* Get the user input line */ acpi_os_get_line (acpi_gbl_db_line_buf); /* Check for single or multithreaded debug */ if (acpi_gbl_debugger_configuration & DEBUGGER_MULTI_THREADED) { /* * Signal the debug thread that we have a command to execute, * and wait for the command to complete. */ acpi_ut_release_mutex (ACPI_MTX_DEBUG_CMD_READY); acpi_ut_acquire_mutex (ACPI_MTX_DEBUG_CMD_COMPLETE); } else { /* Just call to the command line interpreter */ acpi_db_single_thread (); } } /* * Only this thread (the original thread) should actually terminate the subsystem, * because all the semaphores are deleted during termination */ acpi_terminate (); return (status);}#endif /* ENABLE_DEBUGGER */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -