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++)
725 if (strstr (AcpiGbl_DbCommands[i].Name, UserCommand) ==
726 AcpiGbl_DbCommands[i].Name)
732 /* Command not recognized */
734 return (CMD_NOT_FOUND);
738 /*******************************************************************************
740 * FUNCTION: AcpiDbCommandDispatch
742 * PARAMETERS: InputBuffer - Command line buffer
743 * WalkState - Current walk
744 * Op - Current (executing) parse op
748 * DESCRIPTION: Command dispatcher.
750 ******************************************************************************/
753 AcpiDbCommandDispatch (
755 ACPI_WALK_STATE *WalkState,
756 ACPI_PARSE_OBJECT *Op)
762 ACPI_STATUS Status = AE_CTRL_TRUE;
765 /* If AcpiTerminate has been called, terminate this thread */
767 if (AcpiGbl_DbTerminateLoop)
769 return (AE_CTRL_TERMINATE);
772 /* Find command and add to the history buffer */
774 ParamCount = AcpiDbGetLine (InputBuffer);
775 CommandIndex = AcpiDbMatchCommand (AcpiGbl_DbArgs[0]);
779 * We don't want to add the !! command to the history buffer. It
780 * would cause an infinite loop because it would always be the
783 if (CommandIndex != CMD_HISTORY_LAST)
785 AcpiDbAddToHistory (InputBuffer);
788 /* Verify that we have the minimum number of params */
790 if (ParamCount < AcpiGbl_DbCommands[CommandIndex].MinArgs)
792 AcpiOsPrintf ("%u parameters entered, [%s] requires %u parameters\n",
793 ParamCount, AcpiGbl_DbCommands[CommandIndex].Name,
794 AcpiGbl_DbCommands[CommandIndex].MinArgs);
796 AcpiDbDisplayCommandInfo (
797 AcpiGbl_DbCommands[CommandIndex].Name, FALSE);
798 return (AE_CTRL_TRUE);
801 /* Decode and dispatch the command */
803 switch (CommandIndex)
813 case CMD_ALLOCATIONS:
815 #ifdef ACPI_DBG_TRACK_ALLOCATIONS
816 AcpiUtDumpAllocations ((UINT32) -1, NULL);
823 AcpiDbDisplayArguments ();
828 AcpiDbSetMethodBreakpoint (AcpiGbl_DbArgs[1], WalkState, Op);
838 AcpiDbSetMethodCallBreakpoint (Op);
844 AcpiDbExecute (AcpiGbl_DbArgs[1],
845 &AcpiGbl_DbArgs[2], &AcpiGbl_DbArgTypes[2], EX_SINGLE_STEP);
848 case CMD_DISASSEMBLE:
851 (void) AcpiDbDisassembleMethod (AcpiGbl_DbArgs[1]);
856 AcpiDbDecodeAndDisplayObject (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]);
862 AcpiDbExecute (AcpiGbl_DbArgs[1],
863 &AcpiGbl_DbArgs[2], &AcpiGbl_DbArgTypes[2], EX_NO_SINGLE_STEP);
868 Status = AcpiDbFindNameInNamespace (AcpiGbl_DbArgs[1]);
873 AcpiGbl_CmSingleStep = FALSE;
878 AcpiDbDisplayHandlers ();
884 AcpiDbDisplayHelp (AcpiGbl_DbArgs[1]);
889 AcpiDbDisplayHistory ();
892 case CMD_HISTORY_EXE: /* ! command */
894 CommandLine = AcpiDbGetFromHistory (AcpiGbl_DbArgs[1]);
897 return (AE_CTRL_TRUE);
900 Status = AcpiDbCommandDispatch (CommandLine, WalkState, Op);
903 case CMD_HISTORY_LAST: /* !! command */
905 CommandLine = AcpiDbGetFromHistory (NULL);
908 return (AE_CTRL_TRUE);
911 Status = AcpiDbCommandDispatch (CommandLine, WalkState, Op);
914 case CMD_INFORMATION:
916 AcpiDbDisplayMethodInfo (Op);
921 AcpiDbCheckIntegrity ();
928 AcpiGbl_CmSingleStep = TRUE;
938 "Current debug level for file output is: %8.8lX\n",
939 AcpiGbl_DbDebugLevel);
941 "Current debug level for console output is: %8.8lX\n",
942 AcpiGbl_DbConsoleDebugLevel);
944 else if (ParamCount == 2)
946 Temp = AcpiGbl_DbConsoleDebugLevel;
947 AcpiGbl_DbConsoleDebugLevel =
948 strtoul (AcpiGbl_DbArgs[1], NULL, 16);
950 "Debug Level for console output was %8.8lX, now %8.8lX\n",
951 Temp, AcpiGbl_DbConsoleDebugLevel);
955 Temp = AcpiGbl_DbDebugLevel;
956 AcpiGbl_DbDebugLevel = strtoul (AcpiGbl_DbArgs[1], NULL, 16);
958 "Debug Level for file output was %8.8lX, now %8.8lX\n",
959 Temp, AcpiGbl_DbDebugLevel);
965 AcpiDbDisassembleAml (AcpiGbl_DbArgs[1], Op);
970 AcpiDbDisplayLocks ();
975 AcpiDbDisplayLocals ();
980 Status = AcpiDbDisplayObjects ("METHOD", AcpiGbl_DbArgs[1]);
985 AcpiDbDumpNamespace (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]);
990 Temp = strtoul (AcpiGbl_DbArgs[2], NULL, 0);
991 AcpiDbSendNotify (AcpiGbl_DbArgs[1], Temp);
996 AcpiUtStrupr (AcpiGbl_DbArgs[1]);
997 Status = AcpiDbDisplayObjects (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]);
1002 AcpiDbDisplayInterfaces (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]);
1007 AcpiDbDumpNamespaceByOwner (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]);
1012 AcpiDbDumpNamespacePaths ();
1017 AcpiDbSetScope (AcpiGbl_DbArgs[1]);
1020 case CMD_REFERENCES:
1022 AcpiDbFindReferences (AcpiGbl_DbArgs[1]);
1027 AcpiDbDisplayResources (AcpiGbl_DbArgs[1]);
1032 AcpiDbDisplayResults ();
1037 AcpiDbSetMethodData (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2],
1043 Status = AcpiDbDisplayStatistics (AcpiGbl_DbArgs[1]);
1048 return (AE_NOT_IMPLEMENTED);
1052 AcpiDbDisplayTableInfo (AcpiGbl_DbArgs[1]);
1057 AcpiDbDisplayTemplate (AcpiGbl_DbArgs[1]);
1062 AcpiDbTrace (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2], AcpiGbl_DbArgs[3]);
1067 AcpiDbDisplayCallingTree ();
1072 AcpiDbDisplayObjectType (AcpiGbl_DbArgs[1]);
1075 #ifdef ACPI_APPLICATION
1077 /* Hardware simulation commands. */
1079 case CMD_ENABLEACPI:
1080 #if (!ACPI_REDUCED_HARDWARE)
1082 Status = AcpiEnable();
1083 if (ACPI_FAILURE(Status))
1085 AcpiOsPrintf("AcpiEnable failed (Status=%X)\n", Status);
1088 #endif /* !ACPI_REDUCED_HARDWARE */
1093 AcpiOsPrintf ("Event command not implemented\n");
1098 AcpiDbGenerateGpe (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]);
1103 AcpiDbDisplayGpes ();
1108 AcpiDbGenerateSci ();
1113 Status = AcpiDbSleep (AcpiGbl_DbArgs[1]);
1116 /* File I/O commands. */
1120 AcpiDbCloseDebugFile ();
1125 ACPI_NEW_TABLE_DESC *ListHead = NULL;
1127 Status = AcGetAllTablesFromFile (AcpiGbl_DbArgs[1],
1128 ACPI_GET_ALL_TABLES, &ListHead);
1129 if (ACPI_SUCCESS (Status))
1131 AcpiDbLoadTables (ListHead);
1138 AcpiDbOpenDebugFile (AcpiGbl_DbArgs[1]);
1141 /* User space commands. */
1145 AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT);
1146 AcpiUtSubsystemShutdown ();
1149 * TBD: [Restructure] Need some way to re-initialize without
1150 * re-creating the semaphores!
1153 AcpiGbl_DbTerminateLoop = TRUE;
1154 /* AcpiInitialize (NULL); */
1159 AcpiDbCreateExecutionThreads (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2],
1163 /* Debug test commands. */
1165 case CMD_PREDEFINED:
1167 AcpiDbCheckPredefinedNames ();
1172 AcpiDbExecuteTest (AcpiGbl_DbArgs[1]);
1177 AcpiDbUnloadAcpiTable (AcpiGbl_DbArgs[1]);
1186 AcpiOsPrintf ("Method execution terminated\n");
1187 return (AE_CTRL_TERMINATE);
1190 if (!AcpiGbl_DbOutputToFile)
1192 AcpiDbgLevel = ACPI_DEBUG_DEFAULT;
1195 #ifdef ACPI_APPLICATION
1196 AcpiDbCloseDebugFile ();
1198 AcpiGbl_DbTerminateLoop = TRUE;
1199 return (AE_CTRL_TERMINATE);
1204 AcpiOsPrintf ("%s: unknown command\n", AcpiGbl_DbArgs[0]);
1205 return (AE_CTRL_TRUE);
1208 if (ACPI_SUCCESS (Status))
1210 Status = AE_CTRL_TRUE;
1217 /*******************************************************************************
1219 * FUNCTION: AcpiDbExecuteThread
1221 * PARAMETERS: Context - Not used
1225 * DESCRIPTION: Debugger execute thread. Waits for a command line, then
1226 * simply dispatches it.
1228 ******************************************************************************/
1230 void ACPI_SYSTEM_XFACE
1231 AcpiDbExecuteThread (
1234 ACPI_STATUS Status = AE_OK;
1235 ACPI_STATUS MStatus;
1238 while (Status != AE_CTRL_TERMINATE && !AcpiGbl_DbTerminateLoop)
1240 AcpiGbl_MethodExecuting = FALSE;
1241 AcpiGbl_StepToNextCall = FALSE;
1243 MStatus = AcpiOsAcquireMutex (AcpiGbl_DbCommandReady,
1245 if (ACPI_FAILURE (MStatus))
1250 Status = AcpiDbCommandDispatch (AcpiGbl_DbLineBuf, NULL, NULL);
1252 AcpiOsReleaseMutex (AcpiGbl_DbCommandComplete);
1254 AcpiGbl_DbThreadsTerminated = TRUE;
1258 /*******************************************************************************
1260 * FUNCTION: AcpiDbSingleThread
1266 * DESCRIPTION: Debugger execute thread. Waits for a command line, then
1267 * simply dispatches it.
1269 ******************************************************************************/
1272 AcpiDbSingleThread (
1276 AcpiGbl_MethodExecuting = FALSE;
1277 AcpiGbl_StepToNextCall = FALSE;
1279 (void) AcpiDbCommandDispatch (AcpiGbl_DbLineBuf, NULL, NULL);
1283 /*******************************************************************************
1285 * FUNCTION: AcpiDbUserCommands
1287 * PARAMETERS: Prompt - User prompt (depends on mode)
1288 * Op - Current executing parse op
1292 * DESCRIPTION: Command line execution for the AML debugger. Commands are
1293 * matched and dispatched here.
1295 ******************************************************************************/
1298 AcpiDbUserCommands (
1300 ACPI_PARSE_OBJECT *Op)
1302 ACPI_STATUS Status = AE_OK;
1305 AcpiOsPrintf ("\n");
1307 /* TBD: [Restructure] Need a separate command line buffer for step mode */
1309 while (!AcpiGbl_DbTerminateLoop)
1311 /* Force output to console until a command is entered */
1313 AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
1315 /* Different prompt if method is executing */
1317 if (!AcpiGbl_MethodExecuting)
1319 AcpiOsPrintf ("%1c ", ACPI_DEBUGGER_COMMAND_PROMPT);
1323 AcpiOsPrintf ("%1c ", ACPI_DEBUGGER_EXECUTE_PROMPT);
1326 /* Get the user input line */
1328 Status = AcpiOsGetLine (AcpiGbl_DbLineBuf,
1329 ACPI_DB_LINE_BUFFER_SIZE, NULL);
1330 if (ACPI_FAILURE (Status))
1332 ACPI_EXCEPTION ((AE_INFO, Status, "While parsing command line"));
1336 /* Check for single or multithreaded debug */
1338 if (AcpiGbl_DebuggerConfiguration & DEBUGGER_MULTI_THREADED)
1341 * Signal the debug thread that we have a command to execute,
1342 * and wait for the command to complete.
1344 AcpiOsReleaseMutex (AcpiGbl_DbCommandReady);
1346 Status = AcpiOsAcquireMutex (AcpiGbl_DbCommandComplete,
1348 if (ACPI_FAILURE (Status))
1355 /* Just call to the command line interpreter */
1357 AcpiDbSingleThread ();
1364 #endif /* ACPI_DEBUGGER */