1 /*******************************************************************************
3 * Module Name: dbinput - user front-end to the AML debugger
5 ******************************************************************************/
8 * Copyright (C) 2000 - 2018, Intel Corp.
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
44 #include <acpi/acpi.h>
48 #ifdef ACPI_APPLICATION
52 #define _COMPONENT ACPI_CA_DEBUGGER
53 ACPI_MODULE_NAME("dbinput")
55 /* Local prototypes */
56 static u32
acpi_db_get_line(char *input_buffer
);
58 static u32
acpi_db_match_command(char *user_command
);
60 static void acpi_db_display_command_info(const char *command
, u8 display_all
);
62 static void acpi_db_display_help(char *command
);
65 acpi_db_match_command_help(const char *command
,
66 const struct acpi_db_command_help
*help
);
69 * Top-level debugger commands.
71 * This list of commands must match the string table below it
73 enum acpi_ex_debugger_commands
{
125 #ifdef ACPI_APPLICATION
146 #define CMD_FIRST_VALID 2
148 /* Second parameter is the required argument count */
150 static const struct acpi_db_command_info acpi_gbl_db_commands
[] = {
202 #ifdef ACPI_APPLICATION
225 * Help for all debugger commands. First argument is the number of lines
226 * of help to output for the command.
228 * Note: Some commands are not supported by the kernel-level version of
231 static const struct acpi_db_command_help acpi_gbl_db_command_help
[] = {
232 {0, "\nNamespace Access:", "\n"},
233 {1, " Businfo", "Display system bus info\n"},
234 {1, " Disassemble <Method>", "Disassemble a control method\n"},
235 {1, " Find <AcpiName> (? is wildcard)",
236 "Find ACPI name(s) with wildcards\n"},
237 {1, " Integrity", "Validate namespace integrity\n"},
238 {1, " Methods", "Display list of loaded control methods\n"},
239 {1, " Namespace [Object] [Depth]",
240 "Display loaded namespace tree/subtree\n"},
241 {1, " Notify <Object> <Value>", "Send a notification on Object\n"},
242 {1, " Objects [ObjectType]",
243 "Display summary of all objects or just given type\n"},
244 {1, " Owner <OwnerId> [Depth]",
245 "Display loaded namespace by object owner\n"},
246 {1, " Paths", "Display full pathnames of namespace objects\n"},
247 {1, " Predefined", "Check all predefined names\n"},
248 {1, " Prefix [<Namepath>]", "Set or Get current execution prefix\n"},
249 {1, " References <Addr>", "Find all references to object at addr\n"},
250 {1, " Resources [DeviceName]",
251 "Display Device resources (no arg = all devices)\n"},
252 {1, " Set N <NamedObject> <Value>", "Set value for named integer\n"},
253 {1, " Template <Object>", "Format/dump a Buffer/ResourceTemplate\n"},
254 {1, " Type <Object>", "Display object type\n"},
256 {0, "\nControl Method Execution:", "\n"},
257 {1, " Evaluate <Namepath> [Arguments]",
258 "Evaluate object or control method\n"},
259 {1, " Execute <Namepath> [Arguments]", "Synonym for Evaluate\n"},
260 #ifdef ACPI_APPLICATION
261 {1, " Background <Namepath> [Arguments]",
262 "Evaluate object/method in a separate thread\n"},
263 {1, " Thread <Threads><Loops><NamePath>",
264 "Spawn threads to execute method(s)\n"},
266 {1, " Debug <Namepath> [Arguments]", "Single-Step a control method\n"},
267 {7, " [Arguments] formats:", "Control method argument formats\n"},
268 {1, " Hex Integer", "Integer\n"},
269 {1, " \"Ascii String\"", "String\n"},
270 {1, " (Hex Byte List)", "Buffer\n"},
271 {1, " (01 42 7A BF)", "Buffer example (4 bytes)\n"},
272 {1, " [Package Element List]", "Package\n"},
273 {1, " [0x01 0x1234 \"string\"]",
274 "Package example (3 elements)\n"},
276 {0, "\nMiscellaneous:", "\n"},
277 {1, " Allocations", "Display list of current memory allocations\n"},
278 {2, " Dump <Address>|<Namepath>", "\n"},
279 {0, " [Byte|Word|Dword|Qword]",
280 "Display ACPI objects or memory\n"},
281 {1, " Handlers", "Info about global handlers\n"},
282 {1, " Help [Command]", "This help screen or individual command\n"},
283 {1, " History", "Display command history buffer\n"},
284 {1, " Level <DebugLevel>] [console]",
285 "Get/Set debug level for file or console\n"},
286 {1, " Locks", "Current status of internal mutexes\n"},
287 {1, " Osi [Install|Remove <name>]",
288 "Display or modify global _OSI list\n"},
289 {1, " Quit or Exit", "Exit this command\n"},
290 {8, " Stats <SubCommand>",
291 "Display namespace and memory statistics\n"},
292 {1, " Allocations", "Display list of current memory allocations\n"},
293 {1, " Memory", "Dump internal memory lists\n"},
294 {1, " Misc", "Namespace search and mutex stats\n"},
295 {1, " Objects", "Summary of namespace objects\n"},
296 {1, " Sizes", "Sizes for each of the internal objects\n"},
297 {1, " Stack", "Display CPU stack usage\n"},
298 {1, " Tables", "Info about current ACPI table(s)\n"},
299 {1, " Tables", "Display info about loaded ACPI tables\n"},
300 #ifdef ACPI_APPLICATION
301 {1, " Terminate", "Delete namespace and all internal objects\n"},
303 {1, " ! <CommandNumber>", "Execute command from history buffer\n"},
304 {1, " !!", "Execute last command again\n"},
306 {0, "\nMethod and Namespace Debugging:", "\n"},
307 {5, " Trace <State> [<Namepath>] [Once]",
308 "Trace control method execution\n"},
309 {1, " Enable", "Enable all messages\n"},
310 {1, " Disable", "Disable tracing\n"},
311 {1, " Method", "Enable method execution messages\n"},
312 {1, " Opcode", "Enable opcode execution messages\n"},
313 {3, " Test <TestName>", "Invoke a debug test\n"},
314 {1, " Objects", "Read/write/compare all namespace data objects\n"},
316 "Validate all ACPI predefined names (_STA, etc.)\n"},
317 {1, " Execute predefined",
318 "Execute all predefined (public) methods\n"},
320 {0, "\nControl Method Single-Step Execution:", "\n"},
321 {1, " Arguments (or Args)", "Display method arguments\n"},
322 {1, " Breakpoint <AmlOffset>", "Set an AML execution breakpoint\n"},
323 {1, " Call", "Run to next control method invocation\n"},
324 {1, " Go", "Allow method to run to completion\n"},
325 {1, " Information", "Display info about the current method\n"},
326 {1, " Into", "Step into (not over) a method call\n"},
327 {1, " List [# of Aml Opcodes]", "Display method ASL statements\n"},
328 {1, " Locals", "Display method local variables\n"},
329 {1, " Results", "Display method result stack\n"},
330 {1, " Set <A|L> <#> <Value>", "Set method data (Arguments/Locals)\n"},
331 {1, " Stop", "Terminate control method\n"},
332 {1, " Tree", "Display control method calling tree\n"},
333 {1, " <Enter>", "Single step next AML opcode (over calls)\n"},
335 #ifdef ACPI_APPLICATION
336 {0, "\nFile Operations:", "\n"},
337 {1, " Close", "Close debug output file\n"},
338 {1, " Load <Input Filename>", "Load ACPI table from a file\n"},
339 {1, " Open <Output Filename>", "Open a file for debug output\n"},
340 {1, " Unload <Namepath>",
341 "Unload an ACPI table via namespace object\n"},
343 {0, "\nHardware Simulation:", "\n"},
344 {1, " EnableAcpi", "Enable ACPI (hardware) mode\n"},
345 {1, " Event <F|G> <Value>", "Generate AcpiEvent (Fixed/GPE)\n"},
346 {1, " Gpe <GpeNum> [GpeBlockDevice]", "Simulate a GPE\n"},
347 {1, " Gpes", "Display info on all GPE devices\n"},
348 {1, " Sci", "Generate an SCI\n"},
349 {1, " Sleep [SleepState]", "Simulate sleep/wake sequence(s) (0-5)\n"},
354 /*******************************************************************************
356 * FUNCTION: acpi_db_match_command_help
358 * PARAMETERS: command - Command string to match
359 * help - Help table entry to attempt match
361 * RETURN: TRUE if command matched, FALSE otherwise
363 * DESCRIPTION: Attempt to match a command in the help table in order to
364 * print help information for a single command.
366 ******************************************************************************/
369 acpi_db_match_command_help(const char *command
,
370 const struct acpi_db_command_help
*help
)
372 char *invocation
= help
->invocation
;
375 /* Valid commands in the help table begin with a couple of spaces */
377 if (*invocation
!= ' ') {
381 while (*invocation
== ' ') {
385 /* Match command name (full command or substring) */
387 while ((*command
) && (*invocation
) && (*invocation
!= ' ')) {
388 if (tolower((int)*command
) != tolower((int)*invocation
)) {
396 /* Print the appropriate number of help lines */
398 line_count
= help
->line_count
;
400 acpi_os_printf("%-38s : %s", help
->invocation
,
409 /*******************************************************************************
411 * FUNCTION: acpi_db_display_command_info
413 * PARAMETERS: command - Command string to match
414 * display_all - Display all matching commands, or just
415 * the first one (substring match)
419 * DESCRIPTION: Display help information for a Debugger command.
421 ******************************************************************************/
423 static void acpi_db_display_command_info(const char *command
, u8 display_all
)
425 const struct acpi_db_command_help
*next
;
428 next
= acpi_gbl_db_command_help
;
429 while (next
->invocation
) {
430 matched
= acpi_db_match_command_help(command
, next
);
431 if (!display_all
&& matched
) {
439 /*******************************************************************************
441 * FUNCTION: acpi_db_display_help
443 * PARAMETERS: command - Optional command string to display help.
444 * if not specified, all debugger command
445 * help strings are displayed
449 * DESCRIPTION: Display help for a single debugger command, or all of them.
451 ******************************************************************************/
453 static void acpi_db_display_help(char *command
)
455 const struct acpi_db_command_help
*next
= acpi_gbl_db_command_help
;
459 /* No argument to help, display help for all commands */
461 acpi_os_printf("\nSummary of AML Debugger Commands\n\n");
463 while (next
->invocation
) {
464 acpi_os_printf("%-38s%s", next
->invocation
,
468 acpi_os_printf("\n");
471 /* Display help for all commands that match the subtring */
473 acpi_db_display_command_info(command
, TRUE
);
477 /*******************************************************************************
479 * FUNCTION: acpi_db_get_next_token
481 * PARAMETERS: string - Command buffer
482 * next - Return value, end of next token
484 * RETURN: Pointer to the start of the next token.
486 * DESCRIPTION: Command line parsing. Get the next token on the command line
488 ******************************************************************************/
490 char *acpi_db_get_next_token(char *string
,
491 char **next
, acpi_object_type
*return_type
)
495 acpi_object_type type
= ACPI_TYPE_INTEGER
;
497 /* At end of buffer? */
499 if (!string
|| !(*string
)) {
503 /* Remove any spaces at the beginning */
505 if (*string
== ' ') {
506 while (*string
&& (*string
== ' ')) {
518 /* This is a quoted string, scan until closing quote */
522 type
= ACPI_TYPE_STRING
;
524 /* Find end of string */
526 while (*string
&& (*string
!= '"')) {
533 /* This is the start of a buffer, scan until closing paren */
537 type
= ACPI_TYPE_BUFFER
;
539 /* Find end of buffer */
541 while (*string
&& (*string
!= ')')) {
548 /* This is the start of a package, scan until closing bracket */
553 type
= ACPI_TYPE_PACKAGE
;
555 /* Find end of package (closing bracket) */
559 /* Handle String package elements */
561 if (*string
== '"') {
562 /* Find end of string */
565 while (*string
&& (*string
!= '"')) {
571 } else if (*string
== '[') {
572 depth
++; /* A nested package declaration */
573 } else if (*string
== ']') {
575 if (depth
== 0) { /* Found final package closing bracket */
588 /* Find end of token */
590 while (*string
&& (*string
!= ' ')) {
607 /*******************************************************************************
609 * FUNCTION: acpi_db_get_line
611 * PARAMETERS: input_buffer - Command line buffer
613 * RETURN: Count of arguments to the command
615 * DESCRIPTION: Get the next command line from the user. Gets entire line
616 * up to the next newline
618 ******************************************************************************/
620 static u32
acpi_db_get_line(char *input_buffer
)
627 if (acpi_ut_safe_strcpy
628 (acpi_gbl_db_parsed_buf
, sizeof(acpi_gbl_db_parsed_buf
),
631 ("Buffer overflow while parsing input line (max %u characters)\n",
632 sizeof(acpi_gbl_db_parsed_buf
));
636 this = acpi_gbl_db_parsed_buf
;
637 for (i
= 0; i
< ACPI_DEBUGGER_MAX_ARGS
; i
++) {
638 acpi_gbl_db_args
[i
] = acpi_db_get_next_token(this, &next
,
639 &acpi_gbl_db_arg_types
641 if (!acpi_gbl_db_args
[i
]) {
648 /* Uppercase the actual command */
650 acpi_ut_strupr(acpi_gbl_db_args
[0]);
654 count
--; /* Number of args only */
660 /*******************************************************************************
662 * FUNCTION: acpi_db_match_command
664 * PARAMETERS: user_command - User command line
666 * RETURN: Index into command array, -1 if not found
668 * DESCRIPTION: Search command array for a command match
670 ******************************************************************************/
672 static u32
acpi_db_match_command(char *user_command
)
676 if (!user_command
|| user_command
[0] == 0) {
680 for (i
= CMD_FIRST_VALID
; acpi_gbl_db_commands
[i
].name
; i
++) {
682 (ACPI_CAST_PTR(char, acpi_gbl_db_commands
[i
].name
),
683 user_command
) == acpi_gbl_db_commands
[i
].name
) {
688 /* Command not recognized */
690 return (CMD_NOT_FOUND
);
693 /*******************************************************************************
695 * FUNCTION: acpi_db_command_dispatch
697 * PARAMETERS: input_buffer - Command line buffer
698 * walk_state - Current walk
699 * op - Current (executing) parse op
703 * DESCRIPTION: Command dispatcher.
705 ******************************************************************************/
708 acpi_db_command_dispatch(char *input_buffer
,
709 struct acpi_walk_state
*walk_state
,
710 union acpi_parse_object
*op
)
716 acpi_status status
= AE_CTRL_TRUE
;
718 /* If acpi_terminate has been called, terminate this thread */
720 if (acpi_gbl_db_terminate_loop
) {
721 return (AE_CTRL_TERMINATE
);
724 /* Find command and add to the history buffer */
726 param_count
= acpi_db_get_line(input_buffer
);
727 command_index
= acpi_db_match_command(acpi_gbl_db_args
[0]);
731 * We don't want to add the !! command to the history buffer. It
732 * would cause an infinite loop because it would always be the
735 if (command_index
!= CMD_HISTORY_LAST
) {
736 acpi_db_add_to_history(input_buffer
);
739 /* Verify that we have the minimum number of params */
741 if (param_count
< acpi_gbl_db_commands
[command_index
].min_args
) {
743 ("%u parameters entered, [%s] requires %u parameters\n",
744 param_count
, acpi_gbl_db_commands
[command_index
].name
,
745 acpi_gbl_db_commands
[command_index
].min_args
);
747 acpi_db_display_command_info(acpi_gbl_db_commands
748 [command_index
].name
, FALSE
);
749 return (AE_CTRL_TRUE
);
752 /* Decode and dispatch the command */
754 switch (command_index
) {
762 case CMD_ALLOCATIONS
:
764 #ifdef ACPI_DBG_TRACK_ALLOCATIONS
765 acpi_ut_dump_allocations((u32
)-1, NULL
);
772 acpi_db_display_arguments();
777 acpi_db_set_method_breakpoint(acpi_gbl_db_args
[1], walk_state
,
783 acpi_db_get_bus_info();
788 acpi_db_set_method_call_breakpoint(op
);
794 acpi_db_execute(acpi_gbl_db_args
[1],
795 &acpi_gbl_db_args
[2], &acpi_gbl_db_arg_types
[2],
799 case CMD_DISASSEMBLE
:
802 (void)acpi_db_disassemble_method(acpi_gbl_db_args
[1]);
807 acpi_db_decode_and_display_object(acpi_gbl_db_args
[1],
808 acpi_gbl_db_args
[2]);
814 acpi_db_execute(acpi_gbl_db_args
[1],
815 &acpi_gbl_db_args
[2], &acpi_gbl_db_arg_types
[2],
821 status
= acpi_db_find_name_in_namespace(acpi_gbl_db_args
[1]);
826 acpi_gbl_cm_single_step
= FALSE
;
831 acpi_db_display_handlers();
837 acpi_db_display_help(acpi_gbl_db_args
[1]);
842 acpi_db_display_history();
845 case CMD_HISTORY_EXE
: /* ! command */
847 command_line
= acpi_db_get_from_history(acpi_gbl_db_args
[1]);
849 return (AE_CTRL_TRUE
);
852 status
= acpi_db_command_dispatch(command_line
, walk_state
, op
);
855 case CMD_HISTORY_LAST
: /* !! command */
857 command_line
= acpi_db_get_from_history(NULL
);
859 return (AE_CTRL_TRUE
);
862 status
= acpi_db_command_dispatch(command_line
, walk_state
, op
);
865 case CMD_INFORMATION
:
867 acpi_db_display_method_info(op
);
872 acpi_db_check_integrity();
878 acpi_gbl_cm_single_step
= TRUE
;
885 if (param_count
== 0) {
887 ("Current debug level for file output is: %8.8lX\n",
888 acpi_gbl_db_debug_level
);
890 ("Current debug level for console output is: %8.8lX\n",
891 acpi_gbl_db_console_debug_level
);
892 } else if (param_count
== 2) {
893 temp
= acpi_gbl_db_console_debug_level
;
894 acpi_gbl_db_console_debug_level
=
895 strtoul(acpi_gbl_db_args
[1], NULL
, 16);
897 ("Debug Level for console output was %8.8lX, now %8.8lX\n",
898 temp
, acpi_gbl_db_console_debug_level
);
900 temp
= acpi_gbl_db_debug_level
;
901 acpi_gbl_db_debug_level
=
902 strtoul(acpi_gbl_db_args
[1], NULL
, 16);
904 ("Debug Level for file output was %8.8lX, now %8.8lX\n",
905 temp
, acpi_gbl_db_debug_level
);
911 acpi_db_disassemble_aml(acpi_gbl_db_args
[1], op
);
916 acpi_db_display_locks();
921 acpi_db_display_locals();
926 status
= acpi_db_display_objects("METHOD", acpi_gbl_db_args
[1]);
931 acpi_db_dump_namespace(acpi_gbl_db_args
[1],
932 acpi_gbl_db_args
[2]);
937 temp
= strtoul(acpi_gbl_db_args
[2], NULL
, 0);
938 acpi_db_send_notify(acpi_gbl_db_args
[1], temp
);
943 acpi_ut_strupr(acpi_gbl_db_args
[1]);
945 acpi_db_display_objects(acpi_gbl_db_args
[1],
946 acpi_gbl_db_args
[2]);
951 acpi_db_display_interfaces(acpi_gbl_db_args
[1],
952 acpi_gbl_db_args
[2]);
957 acpi_db_dump_namespace_by_owner(acpi_gbl_db_args
[1],
958 acpi_gbl_db_args
[2]);
963 acpi_db_dump_namespace_paths();
968 acpi_db_set_scope(acpi_gbl_db_args
[1]);
973 acpi_db_find_references(acpi_gbl_db_args
[1]);
978 acpi_db_display_resources(acpi_gbl_db_args
[1]);
983 acpi_db_display_results();
988 acpi_db_set_method_data(acpi_gbl_db_args
[1],
990 acpi_gbl_db_args
[3]);
995 status
= acpi_db_display_statistics(acpi_gbl_db_args
[1]);
1000 return (AE_NOT_IMPLEMENTED
);
1004 acpi_db_display_table_info(acpi_gbl_db_args
[1]);
1009 acpi_db_display_template(acpi_gbl_db_args
[1]);
1014 acpi_db_trace(acpi_gbl_db_args
[1], acpi_gbl_db_args
[2],
1015 acpi_gbl_db_args
[3]);
1020 acpi_db_display_calling_tree();
1025 acpi_db_display_object_type(acpi_gbl_db_args
[1]);
1028 #ifdef ACPI_APPLICATION
1030 /* Hardware simulation commands. */
1032 case CMD_ENABLEACPI
:
1033 #if (!ACPI_REDUCED_HARDWARE)
1035 status
= acpi_enable();
1036 if (ACPI_FAILURE(status
)) {
1037 acpi_os_printf("AcpiEnable failed (Status=%X)\n",
1041 #endif /* !ACPI_REDUCED_HARDWARE */
1046 acpi_os_printf("Event command not implemented\n");
1051 acpi_db_generate_gpe(acpi_gbl_db_args
[1], acpi_gbl_db_args
[2]);
1056 acpi_db_display_gpes();
1061 acpi_db_generate_sci();
1066 status
= acpi_db_sleep(acpi_gbl_db_args
[1]);
1069 /* File I/O commands. */
1073 acpi_db_close_debug_file();
1077 struct acpi_new_table_desc
*list_head
= NULL
;
1080 ac_get_all_tables_from_file(acpi_gbl_db_args
[1],
1081 ACPI_GET_ALL_TABLES
,
1083 if (ACPI_SUCCESS(status
)) {
1084 acpi_db_load_tables(list_head
);
1091 acpi_db_open_debug_file(acpi_gbl_db_args
[1]);
1094 /* User space commands. */
1098 acpi_db_set_output_destination(ACPI_DB_REDIRECTABLE_OUTPUT
);
1099 acpi_ut_subsystem_shutdown();
1102 * TBD: [Restructure] Need some way to re-initialize without
1103 * re-creating the semaphores!
1106 acpi_gbl_db_terminate_loop
= TRUE
;
1107 /* acpi_initialize (NULL); */
1110 case CMD_BACKGROUND
:
1112 acpi_db_create_execution_thread(acpi_gbl_db_args
[1],
1113 &acpi_gbl_db_args
[2],
1114 &acpi_gbl_db_arg_types
[2]);
1119 acpi_db_create_execution_threads(acpi_gbl_db_args
[1],
1120 acpi_gbl_db_args
[2],
1121 acpi_gbl_db_args
[3]);
1124 /* Debug test commands. */
1126 case CMD_PREDEFINED
:
1128 acpi_db_check_predefined_names();
1133 acpi_db_execute_test(acpi_gbl_db_args
[1]);
1138 acpi_db_unload_acpi_table(acpi_gbl_db_args
[1]);
1146 acpi_os_printf("Method execution terminated\n");
1147 return (AE_CTRL_TERMINATE
);
1150 if (!acpi_gbl_db_output_to_file
) {
1151 acpi_dbg_level
= ACPI_DEBUG_DEFAULT
;
1153 #ifdef ACPI_APPLICATION
1154 acpi_db_close_debug_file();
1156 acpi_gbl_db_terminate_loop
= TRUE
;
1157 return (AE_CTRL_TERMINATE
);
1162 acpi_os_printf("%s: unknown command\n", acpi_gbl_db_args
[0]);
1163 return (AE_CTRL_TRUE
);
1166 if (ACPI_SUCCESS(status
)) {
1167 status
= AE_CTRL_TRUE
;
1173 /*******************************************************************************
1175 * FUNCTION: acpi_db_execute_thread
1177 * PARAMETERS: context - Not used
1181 * DESCRIPTION: Debugger execute thread. Waits for a command line, then
1182 * simply dispatches it.
1184 ******************************************************************************/
1186 void ACPI_SYSTEM_XFACE
acpi_db_execute_thread(void *context
)
1189 (void)acpi_db_user_commands();
1190 acpi_gbl_db_threads_terminated
= TRUE
;
1193 /*******************************************************************************
1195 * FUNCTION: acpi_db_user_commands
1201 * DESCRIPTION: Command line execution for the AML debugger. Commands are
1202 * matched and dispatched here.
1204 ******************************************************************************/
1206 acpi_status
acpi_db_user_commands(void)
1208 acpi_status status
= AE_OK
;
1210 acpi_os_printf("\n");
1212 /* TBD: [Restructure] Need a separate command line buffer for step mode */
1214 while (!acpi_gbl_db_terminate_loop
) {
1216 /* Wait the readiness of the command */
1218 status
= acpi_os_wait_command_ready();
1219 if (ACPI_FAILURE(status
)) {
1223 /* Just call to the command line interpreter */
1225 acpi_gbl_method_executing
= FALSE
;
1226 acpi_gbl_step_to_next_call
= FALSE
;
1228 (void)acpi_db_command_dispatch(acpi_gbl_db_line_buf
, NULL
,
1231 /* Notify the completion of the command */
1233 status
= acpi_os_notify_command_complete();
1234 if (ACPI_FAILURE(status
)) {
1239 if (ACPI_FAILURE(status
) && status
!= AE_CTRL_TERMINATE
) {
1240 ACPI_EXCEPTION((AE_INFO
, status
, "While parsing command line"));