1 /*******************************************************************************
3 * Module Name: dbinput - user front-end to the AML debugger
5 ******************************************************************************/
8 * Copyright (C) 2000 - 2016, 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.
48 #ifdef ACPI_APPLICATION
54 #define _COMPONENT ACPI_CA_DEBUGGER
55 ACPI_MODULE_NAME ("dbinput")
58 /* Local prototypes */
73 AcpiDbDisplayCommandInfo (
82 AcpiDbMatchCommandHelp (
84 const ACPI_DB_COMMAND_HELP *Help);
88 * Top-level debugger commands.
90 * This list of commands must match the string table below it
92 enum AcpiExDebuggerCommands
145 #ifdef ACPI_APPLICATION
165 #define CMD_FIRST_VALID 2
168 /* Second parameter is the required argument count */
170 static const ACPI_DB_COMMAND_INFO AcpiGbl_DbCommands[] =
223 #ifdef ACPI_APPLICATION
245 * Help for all debugger commands. First argument is the number of lines
246 * of help to output for the command.
248 static const ACPI_DB_COMMAND_HELP AcpiGbl_DbCommandHelp[] =
250 {0, "\nGeneral-Purpose Commands:", "\n"},
251 {1, " Allocations", "Display list of current memory allocations\n"},
252 {2, " Dump <Address>|<Namepath>", "\n"},
253 {0, " [Byte|Word|Dword|Qword]", "Display ACPI objects or memory\n"},
254 {1, " Handlers", "Info about global handlers\n"},
255 {1, " Help [Command]", "This help screen or individual command\n"},
256 {1, " History", "Display command history buffer\n"},
257 {1, " Level <DebugLevel>] [console]", "Get/Set debug level for file or console\n"},
258 {1, " Locks", "Current status of internal mutexes\n"},
259 {1, " Osi [Install|Remove <name>]", "Display or modify global _OSI list\n"},
260 {1, " Quit or Exit", "Exit this command\n"},
261 {8, " Stats <SubCommand>", "Display namespace and memory statistics\n"},
262 {1, " Allocations", "Display list of current memory allocations\n"},
263 {1, " Memory", "Dump internal memory lists\n"},
264 {1, " Misc", "Namespace search and mutex stats\n"},
265 {1, " Objects", "Summary of namespace objects\n"},
266 {1, " Sizes", "Sizes for each of the internal objects\n"},
267 {1, " Stack", "Display CPU stack usage\n"},
268 {1, " Tables", "Info about current ACPI table(s)\n"},
269 {1, " Tables", "Display info about loaded ACPI tables\n"},
270 {1, " ! <CommandNumber>", "Execute command from history buffer\n"},
271 {1, " !!", "Execute last command again\n"},
273 {0, "\nNamespace Access Commands:", "\n"},
274 {1, " Businfo", "Display system bus info\n"},
275 {1, " Disassemble <Method>", "Disassemble a control method\n"},
276 {1, " Find <AcpiName> (? is wildcard)", "Find ACPI name(s) with wildcards\n"},
277 {1, " Integrity", "Validate namespace integrity\n"},
278 {1, " Methods", "Display list of loaded control methods\n"},
279 {1, " Namespace [Object] [Depth]", "Display loaded namespace tree/subtree\n"},
280 {1, " Notify <Object> <Value>", "Send a notification on Object\n"},
281 {1, " Objects [ObjectType]", "Display summary of all objects or just given type\n"},
282 {1, " Owner <OwnerId> [Depth]", "Display loaded namespace by object owner\n"},
283 {1, " Paths", "Display full pathnames of namespace objects\n"},
284 {1, " Predefined", "Check all predefined names\n"},
285 {1, " Prefix [<Namepath>]", "Set or Get current execution prefix\n"},
286 {1, " References <Addr>", "Find all references to object at addr\n"},
287 {1, " Resources [DeviceName]", "Display Device resources (no arg = all devices)\n"},
288 {1, " Set N <NamedObject> <Value>", "Set value for named integer\n"},
289 {1, " Template <Object>", "Format/dump a Buffer/ResourceTemplate\n"},
290 {1, " Type <Object>", "Display object type\n"},
292 {0, "\nControl Method Execution Commands:","\n"},
293 {1, " Arguments (or Args)", "Display method arguments\n"},
294 {1, " Breakpoint <AmlOffset>", "Set an AML execution breakpoint\n"},
295 {1, " Call", "Run to next control method invocation\n"},
296 {1, " Debug <Namepath> [Arguments]", "Single Step a control method\n"},
297 {6, " Evaluate", "Synonym for Execute\n"},
298 {5, " Execute <Namepath> [Arguments]", "Execute control method\n"},
299 {1, " Hex Integer", "Integer method argument\n"},
300 {1, " \"Ascii String\"", "String method argument\n"},
301 {1, " (Hex Byte List)", "Buffer method argument\n"},
302 {1, " [Package Element List]", "Package method argument\n"},
303 {1, " Go", "Allow method to run to completion\n"},
304 {1, " Information", "Display info about the current method\n"},
305 {1, " Into", "Step into (not over) a method call\n"},
306 {1, " List [# of Aml Opcodes]", "Display method ASL statements\n"},
307 {1, " Locals", "Display method local variables\n"},
308 {1, " Results", "Display method result stack\n"},
309 {1, " Set <A|L> <#> <Value>", "Set method data (Arguments/Locals)\n"},
310 {1, " Stop", "Terminate control method\n"},
311 {5, " Trace <State> [<Namepath>] [Once]", "Trace control method execution\n"},
312 {1, " Enable", "Enable all messages\n"},
313 {1, " Disable", "Disable tracing\n"},
314 {1, " Method", "Enable method execution messages\n"},
315 {1, " Opcode", "Enable opcode execution messages\n"},
316 {1, " Tree", "Display control method calling tree\n"},
317 {1, " <Enter>", "Single step next AML opcode (over calls)\n"},
319 #ifdef ACPI_APPLICATION
320 {0, "\nHardware Simulation Commands:", "\n"},
321 {1, " EnableAcpi", "Enable ACPI (hardware) mode\n"},
322 {1, " Event <F|G> <Value>", "Generate AcpiEvent (Fixed/GPE)\n"},
323 {1, " Gpe <GpeNum> [GpeBlockDevice]", "Simulate a GPE\n"},
324 {1, " Gpes", "Display info on all GPE devices\n"},
325 {1, " Sci", "Generate an SCI\n"},
326 {1, " Sleep [SleepState]", "Simulate sleep/wake sequence(s) (0-5)\n"},
328 {0, "\nFile I/O Commands:", "\n"},
329 {1, " Close", "Close debug output file\n"},
330 {1, " Load <Input Filename>", "Load ACPI table from a file\n"},
331 {1, " Open <Output Filename>", "Open a file for debug output\n"},
332 {1, " Unload <Namepath>", "Unload an ACPI table via namespace object\n"},
334 {0, "\nUser Space Commands:", "\n"},
335 {1, " Terminate", "Delete namespace and all internal objects\n"},
336 {1, " Thread <Threads><Loops><NamePath>", "Spawn threads to execute method(s)\n"},
338 {0, "\nDebug Test Commands:", "\n"},
339 {3, " Test <TestName>", "Invoke a debug test\n"},
340 {1, " Objects", "Read/write/compare all namespace data objects\n"},
341 {1, " Predefined", "Execute all ACPI predefined names (_STA, etc.)\n"},
347 /*******************************************************************************
349 * FUNCTION: AcpiDbMatchCommandHelp
351 * PARAMETERS: Command - Command string to match
352 * Help - Help table entry to attempt match
354 * RETURN: TRUE if command matched, FALSE otherwise
356 * DESCRIPTION: Attempt to match a command in the help table in order to
357 * print help information for a single command.
359 ******************************************************************************/
362 AcpiDbMatchCommandHelp (
364 const ACPI_DB_COMMAND_HELP *Help)
366 char *Invocation = Help->Invocation;
370 /* Valid commands in the help table begin with a couple of spaces */
372 if (*Invocation != ' ')
377 while (*Invocation == ' ')
382 /* Match command name (full command or substring) */
384 while ((*Command) && (*Invocation) && (*Invocation != ' '))
386 if (tolower ((int) *Command) != tolower ((int) *Invocation))
395 /* Print the appropriate number of help lines */
397 LineCount = Help->LineCount;
400 AcpiOsPrintf ("%-38s : %s", Help->Invocation, Help->Description);
409 /*******************************************************************************
411 * FUNCTION: AcpiDbDisplayCommandInfo
413 * PARAMETERS: Command - Command string to match
414 * DisplayAll - Display all matching commands, or just
415 * the first one (substring match)
419 * DESCRIPTION: Display help information for a Debugger command.
421 ******************************************************************************/
424 AcpiDbDisplayCommandInfo (
428 const ACPI_DB_COMMAND_HELP *Next;
432 Next = AcpiGbl_DbCommandHelp;
433 while (Next->Invocation)
435 Matched = AcpiDbMatchCommandHelp (Command, Next);
436 if (!DisplayAll && Matched)
446 /*******************************************************************************
448 * FUNCTION: AcpiDbDisplayHelp
450 * PARAMETERS: Command - Optional command string to display help.
451 * if not specified, all debugger command
452 * help strings are displayed
456 * DESCRIPTION: Display help for a single debugger command, or all of them.
458 ******************************************************************************/
464 const ACPI_DB_COMMAND_HELP *Next = AcpiGbl_DbCommandHelp;
469 /* No argument to help, display help for all commands */
471 while (Next->Invocation)
473 AcpiOsPrintf ("%-38s%s", Next->Invocation, Next->Description);
479 /* Display help for all commands that match the subtring */
481 AcpiDbDisplayCommandInfo (Command, TRUE);
486 /*******************************************************************************
488 * FUNCTION: AcpiDbGetNextToken
490 * PARAMETERS: String - Command buffer
491 * Next - Return value, end of next token
493 * RETURN: Pointer to the start of the next token.
495 * DESCRIPTION: Command line parsing. Get the next token on the command line
497 ******************************************************************************/
503 ACPI_OBJECT_TYPE *ReturnType)
507 ACPI_OBJECT_TYPE Type = ACPI_TYPE_INTEGER;
510 /* At end of buffer? */
512 if (!String || !(*String))
517 /* Remove any spaces at the beginning */
521 while (*String && (*String == ' '))
536 /* This is a quoted string, scan until closing quote */
540 Type = ACPI_TYPE_STRING;
542 /* Find end of string */
544 while (*String && (*String != '"'))
552 /* This is the start of a buffer, scan until closing paren */
556 Type = ACPI_TYPE_BUFFER;
558 /* Find end of buffer */
560 while (*String && (*String != ')'))
568 /* This is the start of a package, scan until closing bracket */
573 Type = ACPI_TYPE_PACKAGE;
575 /* Find end of package (closing bracket) */
579 /* Handle String package elements */
583 /* Find end of string */
586 while (*String && (*String != '"'))
595 else if (*String == '[')
597 Depth++; /* A nested package declaration */
599 else if (*String == ']')
602 if (Depth == 0) /* Found final package closing bracket */
616 /* Find end of token */
618 while (*String && (*String != ' '))
640 /*******************************************************************************
642 * FUNCTION: AcpiDbGetLine
644 * PARAMETERS: InputBuffer - Command line buffer
646 * RETURN: Count of arguments to the command
648 * DESCRIPTION: Get the next command line from the user. Gets entire line
649 * up to the next newline
651 ******************************************************************************/
663 if (AcpiUtSafeStrcpy (AcpiGbl_DbParsedBuf, sizeof (AcpiGbl_DbParsedBuf),
667 "Buffer overflow while parsing input line (max %u characters)\n",
668 sizeof (AcpiGbl_DbParsedBuf));
672 This = AcpiGbl_DbParsedBuf;
673 for (i = 0; i < ACPI_DEBUGGER_MAX_ARGS; i++)
675 AcpiGbl_DbArgs[i] = AcpiDbGetNextToken (This, &Next,
676 &AcpiGbl_DbArgTypes[i]);
677 if (!AcpiGbl_DbArgs[i])
685 /* Uppercase the actual command */
687 AcpiUtStrupr (AcpiGbl_DbArgs[0]);
692 Count--; /* Number of args only */
699 /*******************************************************************************
701 * FUNCTION: AcpiDbMatchCommand
703 * PARAMETERS: UserCommand - User command line
705 * RETURN: Index into command array, -1 if not found
707 * DESCRIPTION: Search command array for a command match
709 ******************************************************************************/
718 if (!UserCommand || UserCommand[0] == 0)
723 for (i = CMD_FIRST_VALID; AcpiGbl_DbCommands[i].Name; i++)
726 ACPI_CAST_PTR (char, AcpiGbl_DbCommands[i].Name), UserCommand) ==
727 AcpiGbl_DbCommands[i].Name)
733 /* Command not recognized */
735 return (CMD_NOT_FOUND);
739 /*******************************************************************************
741 * FUNCTION: AcpiDbCommandDispatch
743 * PARAMETERS: InputBuffer - Command line buffer
744 * WalkState - Current walk
745 * Op - Current (executing) parse op
749 * DESCRIPTION: Command dispatcher.
751 ******************************************************************************/
754 AcpiDbCommandDispatch (
756 ACPI_WALK_STATE *WalkState,
757 ACPI_PARSE_OBJECT *Op)
763 ACPI_STATUS Status = AE_CTRL_TRUE;
766 /* If AcpiTerminate has been called, terminate this thread */
768 if (AcpiGbl_DbTerminateLoop)
770 return (AE_CTRL_TERMINATE);
773 /* Find command and add to the history buffer */
775 ParamCount = AcpiDbGetLine (InputBuffer);
776 CommandIndex = AcpiDbMatchCommand (AcpiGbl_DbArgs[0]);
780 * We don't want to add the !! command to the history buffer. It
781 * would cause an infinite loop because it would always be the
784 if (CommandIndex != CMD_HISTORY_LAST)
786 AcpiDbAddToHistory (InputBuffer);
789 /* Verify that we have the minimum number of params */
791 if (ParamCount < AcpiGbl_DbCommands[CommandIndex].MinArgs)
793 AcpiOsPrintf ("%u parameters entered, [%s] requires %u parameters\n",
794 ParamCount, AcpiGbl_DbCommands[CommandIndex].Name,
795 AcpiGbl_DbCommands[CommandIndex].MinArgs);
797 AcpiDbDisplayCommandInfo (
798 AcpiGbl_DbCommands[CommandIndex].Name, FALSE);
799 return (AE_CTRL_TRUE);
802 /* Decode and dispatch the command */
804 switch (CommandIndex)
814 case CMD_ALLOCATIONS:
816 #ifdef ACPI_DBG_TRACK_ALLOCATIONS
817 AcpiUtDumpAllocations ((UINT32) -1, NULL);
824 AcpiDbDisplayArguments ();
829 AcpiDbSetMethodBreakpoint (AcpiGbl_DbArgs[1], WalkState, Op);
839 AcpiDbSetMethodCallBreakpoint (Op);
845 AcpiDbExecute (AcpiGbl_DbArgs[1],
846 &AcpiGbl_DbArgs[2], &AcpiGbl_DbArgTypes[2], EX_SINGLE_STEP);
849 case CMD_DISASSEMBLE:
852 (void) AcpiDbDisassembleMethod (AcpiGbl_DbArgs[1]);
857 AcpiDbDecodeAndDisplayObject (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]);
863 AcpiDbExecute (AcpiGbl_DbArgs[1],
864 &AcpiGbl_DbArgs[2], &AcpiGbl_DbArgTypes[2], EX_NO_SINGLE_STEP);
869 Status = AcpiDbFindNameInNamespace (AcpiGbl_DbArgs[1]);
874 AcpiGbl_CmSingleStep = FALSE;
879 AcpiDbDisplayHandlers ();
885 AcpiDbDisplayHelp (AcpiGbl_DbArgs[1]);
890 AcpiDbDisplayHistory ();
893 case CMD_HISTORY_EXE: /* ! command */
895 CommandLine = AcpiDbGetFromHistory (AcpiGbl_DbArgs[1]);
898 return (AE_CTRL_TRUE);
901 Status = AcpiDbCommandDispatch (CommandLine, WalkState, Op);
904 case CMD_HISTORY_LAST: /* !! command */
906 CommandLine = AcpiDbGetFromHistory (NULL);
909 return (AE_CTRL_TRUE);
912 Status = AcpiDbCommandDispatch (CommandLine, WalkState, Op);
915 case CMD_INFORMATION:
917 AcpiDbDisplayMethodInfo (Op);
922 AcpiDbCheckIntegrity ();
929 AcpiGbl_CmSingleStep = TRUE;
939 "Current debug level for file output is: %8.8lX\n",
940 AcpiGbl_DbDebugLevel);
942 "Current debug level for console output is: %8.8lX\n",
943 AcpiGbl_DbConsoleDebugLevel);
945 else if (ParamCount == 2)
947 Temp = AcpiGbl_DbConsoleDebugLevel;
948 AcpiGbl_DbConsoleDebugLevel =
949 strtoul (AcpiGbl_DbArgs[1], NULL, 16);
951 "Debug Level for console output was %8.8lX, now %8.8lX\n",
952 Temp, AcpiGbl_DbConsoleDebugLevel);
956 Temp = AcpiGbl_DbDebugLevel;
957 AcpiGbl_DbDebugLevel = strtoul (AcpiGbl_DbArgs[1], NULL, 16);
959 "Debug Level for file output was %8.8lX, now %8.8lX\n",
960 Temp, AcpiGbl_DbDebugLevel);
966 AcpiDbDisassembleAml (AcpiGbl_DbArgs[1], Op);
971 AcpiDbDisplayLocks ();
976 AcpiDbDisplayLocals ();
981 Status = AcpiDbDisplayObjects ("METHOD", AcpiGbl_DbArgs[1]);
986 AcpiDbDumpNamespace (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]);
991 Temp = strtoul (AcpiGbl_DbArgs[2], NULL, 0);
992 AcpiDbSendNotify (AcpiGbl_DbArgs[1], Temp);
997 AcpiUtStrupr (AcpiGbl_DbArgs[1]);
998 Status = AcpiDbDisplayObjects (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]);
1003 AcpiDbDisplayInterfaces (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]);
1008 AcpiDbDumpNamespaceByOwner (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]);
1013 AcpiDbDumpNamespacePaths ();
1018 AcpiDbSetScope (AcpiGbl_DbArgs[1]);
1021 case CMD_REFERENCES:
1023 AcpiDbFindReferences (AcpiGbl_DbArgs[1]);
1028 AcpiDbDisplayResources (AcpiGbl_DbArgs[1]);
1033 AcpiDbDisplayResults ();
1038 AcpiDbSetMethodData (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2],
1044 Status = AcpiDbDisplayStatistics (AcpiGbl_DbArgs[1]);
1049 return (AE_NOT_IMPLEMENTED);
1053 AcpiDbDisplayTableInfo (AcpiGbl_DbArgs[1]);
1058 AcpiDbDisplayTemplate (AcpiGbl_DbArgs[1]);
1063 AcpiDbTrace (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2], AcpiGbl_DbArgs[3]);
1068 AcpiDbDisplayCallingTree ();
1073 AcpiDbDisplayObjectType (AcpiGbl_DbArgs[1]);
1076 #ifdef ACPI_APPLICATION
1078 /* Hardware simulation commands. */
1080 case CMD_ENABLEACPI:
1081 #if (!ACPI_REDUCED_HARDWARE)
1083 Status = AcpiEnable();
1084 if (ACPI_FAILURE(Status))
1086 AcpiOsPrintf("AcpiEnable failed (Status=%X)\n", Status);
1089 #endif /* !ACPI_REDUCED_HARDWARE */
1094 AcpiOsPrintf ("Event command not implemented\n");
1099 AcpiDbGenerateGpe (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]);
1104 AcpiDbDisplayGpes ();
1109 AcpiDbGenerateSci ();
1114 Status = AcpiDbSleep (AcpiGbl_DbArgs[1]);
1117 /* File I/O commands. */
1121 AcpiDbCloseDebugFile ();
1126 ACPI_NEW_TABLE_DESC *ListHead = NULL;
1128 Status = AcGetAllTablesFromFile (AcpiGbl_DbArgs[1],
1129 ACPI_GET_ALL_TABLES, &ListHead);
1130 if (ACPI_SUCCESS (Status))
1132 AcpiDbLoadTables (ListHead);
1139 AcpiDbOpenDebugFile (AcpiGbl_DbArgs[1]);
1142 /* User space commands. */
1146 AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT);
1147 AcpiUtSubsystemShutdown ();
1150 * TBD: [Restructure] Need some way to re-initialize without
1151 * re-creating the semaphores!
1154 AcpiGbl_DbTerminateLoop = TRUE;
1155 /* AcpiInitialize (NULL); */
1160 AcpiDbCreateExecutionThreads (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2],
1164 /* Debug test commands. */
1166 case CMD_PREDEFINED:
1168 AcpiDbCheckPredefinedNames ();
1173 AcpiDbExecuteTest (AcpiGbl_DbArgs[1]);
1178 AcpiDbUnloadAcpiTable (AcpiGbl_DbArgs[1]);
1187 AcpiOsPrintf ("Method execution terminated\n");
1188 return (AE_CTRL_TERMINATE);
1191 if (!AcpiGbl_DbOutputToFile)
1193 AcpiDbgLevel = ACPI_DEBUG_DEFAULT;
1196 #ifdef ACPI_APPLICATION
1197 AcpiDbCloseDebugFile ();
1199 AcpiGbl_DbTerminateLoop = TRUE;
1200 return (AE_CTRL_TERMINATE);
1205 AcpiOsPrintf ("%s: unknown command\n", AcpiGbl_DbArgs[0]);
1206 return (AE_CTRL_TRUE);
1209 if (ACPI_SUCCESS (Status))
1211 Status = AE_CTRL_TRUE;
1218 /*******************************************************************************
1220 * FUNCTION: AcpiDbExecuteThread
1222 * PARAMETERS: Context - Not used
1226 * DESCRIPTION: Debugger execute thread. Waits for a command line, then
1227 * simply dispatches it.
1229 ******************************************************************************/
1231 void ACPI_SYSTEM_XFACE
1232 AcpiDbExecuteThread (
1235 ACPI_STATUS Status = AE_OK;
1236 ACPI_STATUS MStatus;
1239 while (Status != AE_CTRL_TERMINATE && !AcpiGbl_DbTerminateLoop)
1241 AcpiGbl_MethodExecuting = FALSE;
1242 AcpiGbl_StepToNextCall = FALSE;
1244 MStatus = AcpiOsAcquireMutex (AcpiGbl_DbCommandReady,
1246 if (ACPI_FAILURE (MStatus))
1251 Status = AcpiDbCommandDispatch (AcpiGbl_DbLineBuf, NULL, NULL);
1253 AcpiOsReleaseMutex (AcpiGbl_DbCommandComplete);
1255 AcpiGbl_DbThreadsTerminated = TRUE;
1259 /*******************************************************************************
1261 * FUNCTION: AcpiDbSingleThread
1267 * DESCRIPTION: Debugger execute thread. Waits for a command line, then
1268 * simply dispatches it.
1270 ******************************************************************************/
1273 AcpiDbSingleThread (
1277 AcpiGbl_MethodExecuting = FALSE;
1278 AcpiGbl_StepToNextCall = FALSE;
1280 (void) AcpiDbCommandDispatch (AcpiGbl_DbLineBuf, NULL, NULL);
1284 /*******************************************************************************
1286 * FUNCTION: AcpiDbUserCommands
1288 * PARAMETERS: Prompt - User prompt (depends on mode)
1289 * Op - Current executing parse op
1293 * DESCRIPTION: Command line execution for the AML debugger. Commands are
1294 * matched and dispatched here.
1296 ******************************************************************************/
1299 AcpiDbUserCommands (
1301 ACPI_PARSE_OBJECT *Op)
1303 ACPI_STATUS Status = AE_OK;
1306 AcpiOsPrintf ("\n");
1308 /* TBD: [Restructure] Need a separate command line buffer for step mode */
1310 while (!AcpiGbl_DbTerminateLoop)
1312 /* Force output to console until a command is entered */
1314 AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
1316 /* Different prompt if method is executing */
1318 if (!AcpiGbl_MethodExecuting)
1320 AcpiOsPrintf ("%1c ", ACPI_DEBUGGER_COMMAND_PROMPT);
1324 AcpiOsPrintf ("%1c ", ACPI_DEBUGGER_EXECUTE_PROMPT);
1327 /* Get the user input line */
1329 Status = AcpiOsGetLine (AcpiGbl_DbLineBuf,
1330 ACPI_DB_LINE_BUFFER_SIZE, NULL);
1331 if (ACPI_FAILURE (Status))
1333 ACPI_EXCEPTION ((AE_INFO, Status, "While parsing command line"));
1337 /* Check for single or multithreaded debug */
1339 if (AcpiGbl_DebuggerConfiguration & DEBUGGER_MULTI_THREADED)
1342 * Signal the debug thread that we have a command to execute,
1343 * and wait for the command to complete.
1345 AcpiOsReleaseMutex (AcpiGbl_DbCommandReady);
1347 Status = AcpiOsAcquireMutex (AcpiGbl_DbCommandComplete,
1349 if (ACPI_FAILURE (Status))
1356 /* Just call to the command line interpreter */
1358 AcpiDbSingleThread ();
1365 #endif /* ACPI_DEBUGGER */