1 /*******************************************************************************
3 * Module Name: dbinput - user front-end to the AML debugger
5 ******************************************************************************/
8 * Copyright (C) 2000 - 2013, 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.
45 #include <contrib/dev/acpica/include/acpi.h>
46 #include <contrib/dev/acpica/include/accommon.h>
47 #include <contrib/dev/acpica/include/acdebug.h>
52 #define _COMPONENT ACPI_CA_DEBUGGER
53 ACPI_MODULE_NAME ("dbinput")
55 /* Local prototypes */
70 AcpiDbDisplayCommandInfo (
79 AcpiDbMatchCommandHelp (
81 const ACPI_DB_COMMAND_HELP *Help);
85 * Top-level debugger commands.
87 * This list of commands must match the string table below it
89 enum AcpiExDebuggerCommands
157 #define CMD_FIRST_VALID 2
160 /* Second parameter is the required argument count */
162 static const ACPI_DB_COMMAND_INFO AcpiGbl_DbCommands[] =
232 * Help for all debugger commands. First argument is the number of lines
233 * of help to output for the command.
235 static const ACPI_DB_COMMAND_HELP AcpiGbl_DbCommandHelp[] =
237 {0, "\nGeneral-Purpose Commands:", "\n"},
238 {1, " Allocations", "Display list of current memory allocations\n"},
239 {2, " Dump <Address>|<Namepath>", "\n"},
240 {0, " [Byte|Word|Dword|Qword]", "Display ACPI objects or memory\n"},
241 {1, " EnableAcpi", "Enable ACPI (hardware) mode\n"},
242 {1, " Handlers", "Info about global handlers\n"},
243 {1, " Help [Command]", "This help screen or individual command\n"},
244 {1, " History", "Display command history buffer\n"},
245 {1, " Level <DebugLevel>] [console]", "Get/Set debug level for file or console\n"},
246 {1, " Locks", "Current status of internal mutexes\n"},
247 {1, " Osi [Install|Remove <name>]", "Display or modify global _OSI list\n"},
248 {1, " Quit or Exit", "Exit this command\n"},
249 {9, " Stats [Allocations|Memory|Misc|", "\n"},
250 {1, " Objects|Sizes|Stack|Tables]", "Display namespace and memory statistics\n"},
251 {1, " Allocations", "Display list of current memory allocations\n"},
252 {1, " Memory", "Dump internal memory lists\n"},
253 {1, " Misc", "Namespace search and mutex stats\n"},
254 {1, " Objects", "Summary of namespace objects\n"},
255 {1, " Sizes", "Sizes for each of the internal objects\n"},
256 {1, " Stack", "Display CPU stack usage\n"},
257 {1, " Tables", "Info about current ACPI table(s)\n"},
258 {1, " Tables", "Display info about loaded ACPI tables\n"},
259 {1, " Unload <Namepath>", "Unload an ACPI table via namespace object\n"},
260 {1, " ! <CommandNumber>", "Execute command from history buffer\n"},
261 {1, " !!", "Execute last command again\n"},
263 {0, "\nNamespace Access Commands:", "\n"},
264 {1, " Businfo", "Display system bus info\n"},
265 {1, " Disassemble <Method>", "Disassemble a control method\n"},
266 {1, " Find <AcpiName> (? is wildcard)", "Find ACPI name(s) with wildcards\n"},
267 {1, " Integrity", "Validate namespace integrity\n"},
268 {1, " Methods", "Display list of loaded control methods\n"},
269 {1, " Namespace [Object] [Depth]", "Display loaded namespace tree/subtree\n"},
270 {1, " Notify <Object> <Value>", "Send a notification on Object\n"},
271 {1, " Objects <ObjectType>", "Display all objects of the given type\n"},
272 {1, " Owner <OwnerId> [Depth]", "Display loaded namespace by object owner\n"},
273 {1, " Paths", "Display full pathnames of namespace objects\n"},
274 {1, " Predefined", "Check all predefined names\n"},
275 {1, " Prefix [<NamePath>]", "Set or Get current execution prefix\n"},
276 {1, " References <Addr>", "Find all references to object at addr\n"},
277 {1, " Resources [DeviceName]", "Display Device resources (no arg = all devices)\n"},
278 {1, " Set N <NamedObject> <Value>", "Set value for named integer\n"},
279 {1, " Template <Object>", "Format/dump a Buffer/ResourceTemplate\n"},
280 {1, " Terminate", "Delete namespace and all internal objects\n"},
281 {1, " Type <Object>", "Display object type\n"},
283 {0, "\nControl Method Execution Commands:","\n"},
284 {1, " Arguments (or Args)", "Display method arguments\n"},
285 {1, " Breakpoint <AmlOffset>", "Set an AML execution breakpoint\n"},
286 {1, " Call", "Run to next control method invocation\n"},
287 {1, " Debug <Namepath> [Arguments]", "Single Step a control method\n"},
288 {6, " Evaluate", "Synonym for Execute\n"},
289 {5, " Execute <Namepath> [Arguments]", "Execute control method\n"},
290 {1, " Hex Integer", "Integer method argument\n"},
291 {1, " \"Ascii String\"", "String method argument\n"},
292 {1, " (Hex Byte List)", "Buffer method argument\n"},
293 {1, " [Package Element List]", "Package method argument\n"},
294 {1, " Go", "Allow method to run to completion\n"},
295 {1, " Information", "Display info about the current method\n"},
296 {1, " Into", "Step into (not over) a method call\n"},
297 {1, " List [# of Aml Opcodes]", "Display method ASL statements\n"},
298 {1, " Locals", "Display method local variables\n"},
299 {1, " Results", "Display method result stack\n"},
300 {1, " Set <A|L> <#> <Value>", "Set method data (Arguments/Locals)\n"},
301 {1, " Stop", "Terminate control method\n"},
302 {1, " Thread <Threads><Loops><NamePath>", "Spawn threads to execute method(s)\n"},
303 {1, " Trace <method name>", "Trace method execution\n"},
304 {1, " Tree", "Display control method calling tree\n"},
305 {1, " <Enter>", "Single step next AML opcode (over calls)\n"},
307 {0, "\nHardware Related Commands:", "\n"},
308 {1, " Event <F|G> <Value>", "Generate AcpiEvent (Fixed/GPE)\n"},
309 {1, " Gpe <GpeNum> <GpeBlock>", "Simulate a GPE\n"},
310 {1, " Gpes", "Display info on all GPEs\n"},
311 {1, " Sci", "Generate an SCI\n"},
312 {1, " Sleep [SleepState]", "Simulate sleep/wake sequence(s) (0-5)\n"},
314 {0, "\nFile I/O Commands:", "\n"},
315 {1, " Close", "Close debug output file\n"},
316 {1, " Load <Input Filename>", "Load ACPI table from a file\n"},
317 {1, " Open <Output Filename>", "Open a file for debug output\n"},
322 /*******************************************************************************
324 * FUNCTION: AcpiDbMatchCommandHelp
326 * PARAMETERS: Command - Command string to match
327 * Help - Help table entry to attempt match
329 * RETURN: TRUE if command matched, FALSE otherwise
331 * DESCRIPTION: Attempt to match a command in the help table in order to
332 * print help information for a single command.
334 ******************************************************************************/
337 AcpiDbMatchCommandHelp (
339 const ACPI_DB_COMMAND_HELP *Help)
341 char *Invocation = Help->Invocation;
345 /* Valid commands in the help table begin with a couple of spaces */
347 if (*Invocation != ' ')
352 while (*Invocation == ' ')
357 /* Match command name (full command or substring) */
359 while ((*Command) && (*Invocation) && (*Invocation != ' '))
361 if (ACPI_TOLOWER (*Command) != ACPI_TOLOWER (*Invocation))
370 /* Print the appropriate number of help lines */
372 LineCount = Help->LineCount;
375 AcpiOsPrintf ("%-38s : %s", Help->Invocation, Help->Description);
384 /*******************************************************************************
386 * FUNCTION: AcpiDbDisplayCommandInfo
388 * PARAMETERS: Command - Command string to match
389 * DisplayAll - Display all matching commands, or just
390 * the first one (substring match)
394 * DESCRIPTION: Display help information for a Debugger command.
396 ******************************************************************************/
399 AcpiDbDisplayCommandInfo (
403 const ACPI_DB_COMMAND_HELP *Next;
407 Next = AcpiGbl_DbCommandHelp;
408 while (Next->Invocation)
410 Matched = AcpiDbMatchCommandHelp (Command, Next);
411 if (!DisplayAll && Matched)
421 /*******************************************************************************
423 * FUNCTION: AcpiDbDisplayHelp
425 * PARAMETERS: Command - Optional command string to display help.
426 * if not specified, all debugger command
427 * help strings are displayed
431 * DESCRIPTION: Display help for a single debugger command, or all of them.
433 ******************************************************************************/
439 const ACPI_DB_COMMAND_HELP *Next = AcpiGbl_DbCommandHelp;
444 /* No argument to help, display help for all commands */
446 while (Next->Invocation)
448 AcpiOsPrintf ("%-38s%s", Next->Invocation, Next->Description);
454 /* Display help for all commands that match the subtring */
456 AcpiDbDisplayCommandInfo (Command, TRUE);
461 /*******************************************************************************
463 * FUNCTION: AcpiDbGetNextToken
465 * PARAMETERS: String - Command buffer
466 * Next - Return value, end of next token
468 * RETURN: Pointer to the start of the next token.
470 * DESCRIPTION: Command line parsing. Get the next token on the command line
472 ******************************************************************************/
478 ACPI_OBJECT_TYPE *ReturnType)
482 ACPI_OBJECT_TYPE Type = ACPI_TYPE_INTEGER;
485 /* At end of buffer? */
487 if (!String || !(*String))
492 /* Remove any spaces at the beginning */
496 while (*String && (*String == ' '))
511 /* This is a quoted string, scan until closing quote */
515 Type = ACPI_TYPE_STRING;
517 /* Find end of string */
519 while (*String && (*String != '"'))
527 /* This is the start of a buffer, scan until closing paren */
531 Type = ACPI_TYPE_BUFFER;
533 /* Find end of buffer */
535 while (*String && (*String != ')'))
543 /* This is the start of a package, scan until closing bracket */
548 Type = ACPI_TYPE_PACKAGE;
550 /* Find end of package (closing bracket) */
554 /* Handle String package elements */
558 /* Find end of string */
561 while (*String && (*String != '"'))
570 else if (*String == '[')
572 Depth++; /* A nested package declaration */
574 else if (*String == ']')
577 if (Depth == 0) /* Found final package closing bracket */
591 /* Find end of token */
593 while (*String && (*String != ' '))
615 /*******************************************************************************
617 * FUNCTION: AcpiDbGetLine
619 * PARAMETERS: InputBuffer - Command line buffer
621 * RETURN: Count of arguments to the command
623 * DESCRIPTION: Get the next command line from the user. Gets entire line
624 * up to the next newline
626 ******************************************************************************/
638 ACPI_STRCPY (AcpiGbl_DbParsedBuf, InputBuffer);
640 This = AcpiGbl_DbParsedBuf;
641 for (i = 0; i < ACPI_DEBUGGER_MAX_ARGS; i++)
643 AcpiGbl_DbArgs[i] = AcpiDbGetNextToken (This, &Next,
644 &AcpiGbl_DbArgTypes[i]);
645 if (!AcpiGbl_DbArgs[i])
653 /* Uppercase the actual command */
655 if (AcpiGbl_DbArgs[0])
657 AcpiUtStrupr (AcpiGbl_DbArgs[0]);
663 Count--; /* Number of args only */
670 /*******************************************************************************
672 * FUNCTION: AcpiDbMatchCommand
674 * PARAMETERS: UserCommand - User command line
676 * RETURN: Index into command array, -1 if not found
678 * DESCRIPTION: Search command array for a command match
680 ******************************************************************************/
689 if (!UserCommand || UserCommand[0] == 0)
694 for (i = CMD_FIRST_VALID; AcpiGbl_DbCommands[i].Name; i++)
696 if (ACPI_STRSTR (AcpiGbl_DbCommands[i].Name, UserCommand) ==
697 AcpiGbl_DbCommands[i].Name)
703 /* Command not recognized */
705 return (CMD_NOT_FOUND);
709 /*******************************************************************************
711 * FUNCTION: AcpiDbCommandDispatch
713 * PARAMETERS: InputBuffer - Command line buffer
714 * WalkState - Current walk
715 * Op - Current (executing) parse op
719 * DESCRIPTION: Command dispatcher.
721 ******************************************************************************/
724 AcpiDbCommandDispatch (
726 ACPI_WALK_STATE *WalkState,
727 ACPI_PARSE_OBJECT *Op)
733 ACPI_STATUS Status = AE_CTRL_TRUE;
736 /* If AcpiTerminate has been called, terminate this thread */
738 if (AcpiGbl_DbTerminateThreads)
740 return (AE_CTRL_TERMINATE);
743 ParamCount = AcpiDbGetLine (InputBuffer);
744 CommandIndex = AcpiDbMatchCommand (AcpiGbl_DbArgs[0]);
747 /* Verify that we have the minimum number of params */
749 if (ParamCount < AcpiGbl_DbCommands[CommandIndex].MinArgs)
751 AcpiOsPrintf ("%u parameters entered, [%s] requires %u parameters\n",
752 ParamCount, AcpiGbl_DbCommands[CommandIndex].Name,
753 AcpiGbl_DbCommands[CommandIndex].MinArgs);
755 AcpiDbDisplayCommandInfo (AcpiGbl_DbCommands[CommandIndex].Name, FALSE);
756 return (AE_CTRL_TRUE);
759 /* Decode and dispatch the command */
761 switch (CommandIndex)
771 case CMD_ALLOCATIONS:
773 #ifdef ACPI_DBG_TRACK_ALLOCATIONS
774 AcpiUtDumpAllocations ((UINT32) -1, NULL);
781 AcpiDbDisplayArguments ();
786 AcpiDbBatchExecute (AcpiGbl_DbArgs[1]);
791 AcpiDbSetMethodBreakpoint (AcpiGbl_DbArgs[1], WalkState, Op);
801 AcpiDbSetMethodCallBreakpoint (Op);
807 AcpiDbCloseDebugFile ();
812 AcpiDbExecute (AcpiGbl_DbArgs[1],
813 &AcpiGbl_DbArgs[2], &AcpiGbl_DbArgTypes[2], EX_SINGLE_STEP);
816 case CMD_DISASSEMBLE:
819 (void) AcpiDbDisassembleMethod (AcpiGbl_DbArgs[1]);
824 AcpiDbDecodeAndDisplayObject (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]);
828 #if (!ACPI_REDUCED_HARDWARE)
830 Status = AcpiEnable();
831 if (ACPI_FAILURE(Status))
833 AcpiOsPrintf("AcpiEnable failed (Status=%X)\n", Status);
836 #endif /* !ACPI_REDUCED_HARDWARE */
841 AcpiOsPrintf ("Event command not implemented\n");
847 AcpiDbExecute (AcpiGbl_DbArgs[1],
848 &AcpiGbl_DbArgs[2], &AcpiGbl_DbArgTypes[2], EX_NO_SINGLE_STEP);
853 Status = AcpiDbFindNameInNamespace (AcpiGbl_DbArgs[1]);
858 AcpiGbl_CmSingleStep = FALSE;
863 AcpiDbGenerateGpe (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]);
868 AcpiDbDisplayGpes ();
873 AcpiDbDisplayHandlers ();
879 AcpiDbDisplayHelp (AcpiGbl_DbArgs[1]);
884 AcpiDbDisplayHistory ();
887 case CMD_HISTORY_EXE: /* ! command */
889 CommandLine = AcpiDbGetFromHistory (AcpiGbl_DbArgs[1]);
892 return (AE_CTRL_TRUE);
895 Status = AcpiDbCommandDispatch (CommandLine, WalkState, Op);
898 case CMD_HISTORY_LAST: /* !! command */
900 CommandLine = AcpiDbGetFromHistory (NULL);
903 return (AE_CTRL_TRUE);
906 Status = AcpiDbCommandDispatch (CommandLine, WalkState, Op);
909 case CMD_INFORMATION:
911 AcpiDbDisplayMethodInfo (Op);
916 AcpiDbCheckIntegrity ();
923 AcpiGbl_CmSingleStep = TRUE;
932 AcpiOsPrintf ("Current debug level for file output is: %8.8lX\n",
933 AcpiGbl_DbDebugLevel);
934 AcpiOsPrintf ("Current debug level for console output is: %8.8lX\n",
935 AcpiGbl_DbConsoleDebugLevel);
937 else if (ParamCount == 2)
939 Temp = AcpiGbl_DbConsoleDebugLevel;
940 AcpiGbl_DbConsoleDebugLevel = ACPI_STRTOUL (AcpiGbl_DbArgs[1],
943 "Debug Level for console output was %8.8lX, now %8.8lX\n",
944 Temp, AcpiGbl_DbConsoleDebugLevel);
948 Temp = AcpiGbl_DbDebugLevel;
949 AcpiGbl_DbDebugLevel = ACPI_STRTOUL (AcpiGbl_DbArgs[1], NULL, 16);
951 "Debug Level for file output was %8.8lX, now %8.8lX\n",
952 Temp, AcpiGbl_DbDebugLevel);
958 AcpiDbDisassembleAml (AcpiGbl_DbArgs[1], Op);
963 Status = AcpiDbGetTableFromFile (AcpiGbl_DbArgs[1], NULL);
968 AcpiDbDisplayLocks ();
973 AcpiDbDisplayLocals ();
978 Status = AcpiDbDisplayObjects ("METHOD", AcpiGbl_DbArgs[1]);
983 AcpiDbDumpNamespace (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]);
988 Temp = ACPI_STRTOUL (AcpiGbl_DbArgs[2], NULL, 0);
989 AcpiDbSendNotify (AcpiGbl_DbArgs[1], Temp);
994 AcpiUtStrupr (AcpiGbl_DbArgs[1]);
995 Status = AcpiDbDisplayObjects (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]);
1000 AcpiDbOpenDebugFile (AcpiGbl_DbArgs[1]);
1005 AcpiDbDisplayInterfaces (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]);
1010 AcpiDbDumpNamespaceByOwner (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]);
1015 AcpiDbDumpNamespacePaths ();
1018 case CMD_PREDEFINED:
1020 AcpiDbCheckPredefinedNames ();
1025 AcpiDbSetScope (AcpiGbl_DbArgs[1]);
1028 case CMD_REFERENCES:
1030 AcpiDbFindReferences (AcpiGbl_DbArgs[1]);
1035 AcpiDbDisplayResources (AcpiGbl_DbArgs[1]);
1040 AcpiDbDisplayResults ();
1045 AcpiDbGenerateSci ();
1050 AcpiDbSetMethodData (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2],
1056 Status = AcpiDbSleep (AcpiGbl_DbArgs[1]);
1061 Status = AcpiDbDisplayStatistics (AcpiGbl_DbArgs[1]);
1066 return (AE_NOT_IMPLEMENTED);
1070 AcpiDbDisplayTableInfo (AcpiGbl_DbArgs[1]);
1075 AcpiDbDisplayTemplate (AcpiGbl_DbArgs[1]);
1080 AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT);
1081 AcpiUtSubsystemShutdown ();
1084 * TBD: [Restructure] Need some way to re-initialize without
1085 * re-creating the semaphores!
1088 /* AcpiInitialize (NULL); */
1093 AcpiDbCreateExecutionThreads (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2],
1099 (void) AcpiDebugTrace (AcpiGbl_DbArgs[1],0,0,1);
1104 AcpiDbDisplayCallingTree ();
1109 AcpiDbDisplayObjectType (AcpiGbl_DbArgs[1]);
1114 AcpiDbUnloadAcpiTable (AcpiGbl_DbArgs[1]);
1122 AcpiOsPrintf ("Method execution terminated\n");
1123 return (AE_CTRL_TERMINATE);
1126 if (!AcpiGbl_DbOutputToFile)
1128 AcpiDbgLevel = ACPI_DEBUG_DEFAULT;
1131 AcpiDbCloseDebugFile ();
1132 AcpiGbl_DbTerminateThreads = TRUE;
1133 return (AE_CTRL_TERMINATE);
1138 AcpiOsPrintf ("Unknown Command\n");
1139 return (AE_CTRL_TRUE);
1142 if (ACPI_SUCCESS (Status))
1144 Status = AE_CTRL_TRUE;
1147 /* Add all commands that come here to the history buffer */
1149 AcpiDbAddToHistory (InputBuffer);
1154 /*******************************************************************************
1156 * FUNCTION: AcpiDbExecuteThread
1158 * PARAMETERS: Context - Not used
1162 * DESCRIPTION: Debugger execute thread. Waits for a command line, then
1163 * simply dispatches it.
1165 ******************************************************************************/
1167 void ACPI_SYSTEM_XFACE
1168 AcpiDbExecuteThread (
1171 ACPI_STATUS Status = AE_OK;
1172 ACPI_STATUS MStatus;
1175 while (Status != AE_CTRL_TERMINATE)
1177 AcpiGbl_MethodExecuting = FALSE;
1178 AcpiGbl_StepToNextCall = FALSE;
1180 MStatus = AcpiUtAcquireMutex (ACPI_MTX_DEBUG_CMD_READY);
1181 if (ACPI_FAILURE (MStatus))
1186 Status = AcpiDbCommandDispatch (AcpiGbl_DbLineBuf, NULL, NULL);
1188 MStatus = AcpiUtReleaseMutex (ACPI_MTX_DEBUG_CMD_COMPLETE);
1189 if (ACPI_FAILURE (MStatus))
1197 /*******************************************************************************
1199 * FUNCTION: AcpiDbSingleThread
1205 * DESCRIPTION: Debugger execute thread. Waits for a command line, then
1206 * simply dispatches it.
1208 ******************************************************************************/
1211 AcpiDbSingleThread (
1215 AcpiGbl_MethodExecuting = FALSE;
1216 AcpiGbl_StepToNextCall = FALSE;
1218 (void) AcpiDbCommandDispatch (AcpiGbl_DbLineBuf, NULL, NULL);
1222 /*******************************************************************************
1224 * FUNCTION: AcpiDbUserCommands
1226 * PARAMETERS: Prompt - User prompt (depends on mode)
1227 * Op - Current executing parse op
1231 * DESCRIPTION: Command line execution for the AML debugger. Commands are
1232 * matched and dispatched here.
1234 ******************************************************************************/
1237 AcpiDbUserCommands (
1239 ACPI_PARSE_OBJECT *Op)
1241 ACPI_STATUS Status = AE_OK;
1244 AcpiOsPrintf ("\n");
1246 /* TBD: [Restructure] Need a separate command line buffer for step mode */
1248 while (!AcpiGbl_DbTerminateThreads)
1250 /* Force output to console until a command is entered */
1252 AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
1254 /* Different prompt if method is executing */
1256 if (!AcpiGbl_MethodExecuting)
1258 AcpiOsPrintf ("%1c ", ACPI_DEBUGGER_COMMAND_PROMPT);
1262 AcpiOsPrintf ("%1c ", ACPI_DEBUGGER_EXECUTE_PROMPT);
1265 /* Get the user input line */
1267 Status = AcpiOsGetLine (AcpiGbl_DbLineBuf,
1268 ACPI_DB_LINE_BUFFER_SIZE, NULL);
1269 if (ACPI_FAILURE (Status))
1271 ACPI_EXCEPTION ((AE_INFO, Status, "While parsing command line"));
1275 /* Check for single or multithreaded debug */
1277 if (AcpiGbl_DebuggerConfiguration & DEBUGGER_MULTI_THREADED)
1280 * Signal the debug thread that we have a command to execute,
1281 * and wait for the command to complete.
1283 Status = AcpiUtReleaseMutex (ACPI_MTX_DEBUG_CMD_READY);
1284 if (ACPI_FAILURE (Status))
1289 Status = AcpiUtAcquireMutex (ACPI_MTX_DEBUG_CMD_COMPLETE);
1290 if (ACPI_FAILURE (Status))
1297 /* Just call to the command line interpreter */
1299 AcpiDbSingleThread ();
1304 * Only this thread (the original thread) should actually terminate the
1305 * subsystem, because all the semaphores are deleted during termination
1307 Status = AcpiTerminate ();
1311 #endif /* ACPI_DEBUGGER */