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.
44 #include <contrib/dev/acpica/include/acpi.h>
45 #include <contrib/dev/acpica/include/accommon.h>
46 #include <contrib/dev/acpica/include/acdebug.h>
48 #ifdef ACPI_APPLICATION
49 #include <contrib/dev/acpica/include/acapps.h>
52 #define _COMPONENT ACPI_CA_DEBUGGER
53 ACPI_MODULE_NAME ("dbinput")
56 /* Local prototypes */
71 AcpiDbDisplayCommandInfo (
80 AcpiDbMatchCommandHelp (
82 const ACPI_DB_COMMAND_HELP *Help);
86 * Top-level debugger commands.
88 * This list of commands must match the string table below it
90 enum AcpiExDebuggerCommands
143 #ifdef ACPI_APPLICATION
163 #define CMD_FIRST_VALID 2
166 /* Second parameter is the required argument count */
168 static const ACPI_DB_COMMAND_INFO AcpiGbl_DbCommands[] =
221 #ifdef ACPI_APPLICATION
243 * Help for all debugger commands. First argument is the number of lines
244 * of help to output for the command.
246 static const ACPI_DB_COMMAND_HELP AcpiGbl_DbCommandHelp[] =
248 {0, "\nGeneral-Purpose Commands:", "\n"},
249 {1, " Allocations", "Display list of current memory allocations\n"},
250 {2, " Dump <Address>|<Namepath>", "\n"},
251 {0, " [Byte|Word|Dword|Qword]", "Display ACPI objects or memory\n"},
252 {1, " Handlers", "Info about global handlers\n"},
253 {1, " Help [Command]", "This help screen or individual command\n"},
254 {1, " History", "Display command history buffer\n"},
255 {1, " Level <DebugLevel>] [console]", "Get/Set debug level for file or console\n"},
256 {1, " Locks", "Current status of internal mutexes\n"},
257 {1, " Osi [Install|Remove <name>]", "Display or modify global _OSI list\n"},
258 {1, " Quit or Exit", "Exit this command\n"},
259 {8, " Stats <SubCommand>", "Display namespace and memory statistics\n"},
260 {1, " Allocations", "Display list of current memory allocations\n"},
261 {1, " Memory", "Dump internal memory lists\n"},
262 {1, " Misc", "Namespace search and mutex stats\n"},
263 {1, " Objects", "Summary of namespace objects\n"},
264 {1, " Sizes", "Sizes for each of the internal objects\n"},
265 {1, " Stack", "Display CPU stack usage\n"},
266 {1, " Tables", "Info about current ACPI table(s)\n"},
267 {1, " Tables", "Display info about loaded ACPI tables\n"},
268 {1, " ! <CommandNumber>", "Execute command from history buffer\n"},
269 {1, " !!", "Execute last command again\n"},
271 {0, "\nNamespace Access Commands:", "\n"},
272 {1, " Businfo", "Display system bus info\n"},
273 {1, " Disassemble <Method>", "Disassemble a control method\n"},
274 {1, " Find <AcpiName> (? is wildcard)", "Find ACPI name(s) with wildcards\n"},
275 {1, " Integrity", "Validate namespace integrity\n"},
276 {1, " Methods", "Display list of loaded control methods\n"},
277 {1, " Namespace [Object] [Depth]", "Display loaded namespace tree/subtree\n"},
278 {1, " Notify <Object> <Value>", "Send a notification on Object\n"},
279 {1, " Objects [ObjectType]", "Display summary of all objects or just given type\n"},
280 {1, " Owner <OwnerId> [Depth]", "Display loaded namespace by object owner\n"},
281 {1, " Paths", "Display full pathnames of namespace objects\n"},
282 {1, " Predefined", "Check all predefined names\n"},
283 {1, " Prefix [<Namepath>]", "Set or Get current execution prefix\n"},
284 {1, " References <Addr>", "Find all references to object at addr\n"},
285 {1, " Resources [DeviceName]", "Display Device resources (no arg = all devices)\n"},
286 {1, " Set N <NamedObject> <Value>", "Set value for named integer\n"},
287 {1, " Template <Object>", "Format/dump a Buffer/ResourceTemplate\n"},
288 {1, " Type <Object>", "Display object type\n"},
290 {0, "\nControl Method Execution Commands:","\n"},
291 {1, " Arguments (or Args)", "Display method arguments\n"},
292 {1, " Breakpoint <AmlOffset>", "Set an AML execution breakpoint\n"},
293 {1, " Call", "Run to next control method invocation\n"},
294 {1, " Debug <Namepath> [Arguments]", "Single Step a control method\n"},
295 {6, " Evaluate", "Synonym for Execute\n"},
296 {5, " Execute <Namepath> [Arguments]", "Execute control method\n"},
297 {1, " Hex Integer", "Integer method argument\n"},
298 {1, " \"Ascii String\"", "String method argument\n"},
299 {1, " (Hex Byte List)", "Buffer method argument\n"},
300 {1, " [Package Element List]", "Package method argument\n"},
301 {1, " Go", "Allow method to run to completion\n"},
302 {1, " Information", "Display info about the current method\n"},
303 {1, " Into", "Step into (not over) a method call\n"},
304 {1, " List [# of Aml Opcodes]", "Display method ASL statements\n"},
305 {1, " Locals", "Display method local variables\n"},
306 {1, " Results", "Display method result stack\n"},
307 {1, " Set <A|L> <#> <Value>", "Set method data (Arguments/Locals)\n"},
308 {1, " Stop", "Terminate control method\n"},
309 {5, " Trace <State> [<Namepath>] [Once]", "Trace control method execution\n"},
310 {1, " Enable", "Enable all messages\n"},
311 {1, " Disable", "Disable tracing\n"},
312 {1, " Method", "Enable method execution messages\n"},
313 {1, " Opcode", "Enable opcode execution messages\n"},
314 {1, " Tree", "Display control method calling tree\n"},
315 {1, " <Enter>", "Single step next AML opcode (over calls)\n"},
317 #ifdef ACPI_APPLICATION
318 {0, "\nHardware Simulation Commands:", "\n"},
319 {1, " EnableAcpi", "Enable ACPI (hardware) mode\n"},
320 {1, " Event <F|G> <Value>", "Generate AcpiEvent (Fixed/GPE)\n"},
321 {1, " Gpe <GpeNum> [GpeBlockDevice]", "Simulate a GPE\n"},
322 {1, " Gpes", "Display info on all GPE devices\n"},
323 {1, " Sci", "Generate an SCI\n"},
324 {1, " Sleep [SleepState]", "Simulate sleep/wake sequence(s) (0-5)\n"},
326 {0, "\nFile I/O Commands:", "\n"},
327 {1, " Close", "Close debug output file\n"},
328 {1, " Load <Input Filename>", "Load ACPI table from a file\n"},
329 {1, " Open <Output Filename>", "Open a file for debug output\n"},
330 {1, " Unload <Namepath>", "Unload an ACPI table via namespace object\n"},
332 {0, "\nUser Space Commands:", "\n"},
333 {1, " Terminate", "Delete namespace and all internal objects\n"},
334 {1, " Thread <Threads><Loops><NamePath>", "Spawn threads to execute method(s)\n"},
336 {0, "\nDebug Test Commands:", "\n"},
337 {3, " Test <TestName>", "Invoke a debug test\n"},
338 {1, " Objects", "Read/write/compare all namespace data objects\n"},
339 {1, " Predefined", "Execute all ACPI predefined names (_STA, etc.)\n"},
345 /*******************************************************************************
347 * FUNCTION: AcpiDbMatchCommandHelp
349 * PARAMETERS: Command - Command string to match
350 * Help - Help table entry to attempt match
352 * RETURN: TRUE if command matched, FALSE otherwise
354 * DESCRIPTION: Attempt to match a command in the help table in order to
355 * print help information for a single command.
357 ******************************************************************************/
360 AcpiDbMatchCommandHelp (
362 const ACPI_DB_COMMAND_HELP *Help)
364 char *Invocation = Help->Invocation;
368 /* Valid commands in the help table begin with a couple of spaces */
370 if (*Invocation != ' ')
375 while (*Invocation == ' ')
380 /* Match command name (full command or substring) */
382 while ((*Command) && (*Invocation) && (*Invocation != ' '))
384 if (tolower ((int) *Command) != tolower ((int) *Invocation))
393 /* Print the appropriate number of help lines */
395 LineCount = Help->LineCount;
398 AcpiOsPrintf ("%-38s : %s", Help->Invocation, Help->Description);
407 /*******************************************************************************
409 * FUNCTION: AcpiDbDisplayCommandInfo
411 * PARAMETERS: Command - Command string to match
412 * DisplayAll - Display all matching commands, or just
413 * the first one (substring match)
417 * DESCRIPTION: Display help information for a Debugger command.
419 ******************************************************************************/
422 AcpiDbDisplayCommandInfo (
426 const ACPI_DB_COMMAND_HELP *Next;
430 Next = AcpiGbl_DbCommandHelp;
431 while (Next->Invocation)
433 Matched = AcpiDbMatchCommandHelp (Command, Next);
434 if (!DisplayAll && Matched)
444 /*******************************************************************************
446 * FUNCTION: AcpiDbDisplayHelp
448 * PARAMETERS: Command - Optional command string to display help.
449 * if not specified, all debugger command
450 * help strings are displayed
454 * DESCRIPTION: Display help for a single debugger command, or all of them.
456 ******************************************************************************/
462 const ACPI_DB_COMMAND_HELP *Next = AcpiGbl_DbCommandHelp;
467 /* No argument to help, display help for all commands */
469 while (Next->Invocation)
471 AcpiOsPrintf ("%-38s%s", Next->Invocation, Next->Description);
477 /* Display help for all commands that match the subtring */
479 AcpiDbDisplayCommandInfo (Command, TRUE);
484 /*******************************************************************************
486 * FUNCTION: AcpiDbGetNextToken
488 * PARAMETERS: String - Command buffer
489 * Next - Return value, end of next token
491 * RETURN: Pointer to the start of the next token.
493 * DESCRIPTION: Command line parsing. Get the next token on the command line
495 ******************************************************************************/
501 ACPI_OBJECT_TYPE *ReturnType)
505 ACPI_OBJECT_TYPE Type = ACPI_TYPE_INTEGER;
508 /* At end of buffer? */
510 if (!String || !(*String))
515 /* Remove any spaces at the beginning */
519 while (*String && (*String == ' '))
534 /* This is a quoted string, scan until closing quote */
538 Type = ACPI_TYPE_STRING;
540 /* Find end of string */
542 while (*String && (*String != '"'))
550 /* This is the start of a buffer, scan until closing paren */
554 Type = ACPI_TYPE_BUFFER;
556 /* Find end of buffer */
558 while (*String && (*String != ')'))
566 /* This is the start of a package, scan until closing bracket */
571 Type = ACPI_TYPE_PACKAGE;
573 /* Find end of package (closing bracket) */
577 /* Handle String package elements */
581 /* Find end of string */
584 while (*String && (*String != '"'))
593 else if (*String == '[')
595 Depth++; /* A nested package declaration */
597 else if (*String == ']')
600 if (Depth == 0) /* Found final package closing bracket */
614 /* Find end of token */
616 while (*String && (*String != ' '))
638 /*******************************************************************************
640 * FUNCTION: AcpiDbGetLine
642 * PARAMETERS: InputBuffer - Command line buffer
644 * RETURN: Count of arguments to the command
646 * DESCRIPTION: Get the next command line from the user. Gets entire line
647 * up to the next newline
649 ******************************************************************************/
661 if (AcpiUtSafeStrcpy (AcpiGbl_DbParsedBuf, sizeof (AcpiGbl_DbParsedBuf),
665 "Buffer overflow while parsing input line (max %u characters)\n",
666 sizeof (AcpiGbl_DbParsedBuf));
670 This = AcpiGbl_DbParsedBuf;
671 for (i = 0; i < ACPI_DEBUGGER_MAX_ARGS; i++)
673 AcpiGbl_DbArgs[i] = AcpiDbGetNextToken (This, &Next,
674 &AcpiGbl_DbArgTypes[i]);
675 if (!AcpiGbl_DbArgs[i])
683 /* Uppercase the actual command */
685 AcpiUtStrupr (AcpiGbl_DbArgs[0]);
690 Count--; /* Number of args only */
697 /*******************************************************************************
699 * FUNCTION: AcpiDbMatchCommand
701 * PARAMETERS: UserCommand - User command line
703 * RETURN: Index into command array, -1 if not found
705 * DESCRIPTION: Search command array for a command match
707 ******************************************************************************/
716 if (!UserCommand || UserCommand[0] == 0)
721 for (i = CMD_FIRST_VALID; AcpiGbl_DbCommands[i].Name; i++)
724 ACPI_CAST_PTR (char, AcpiGbl_DbCommands[i].Name), UserCommand) ==
725 AcpiGbl_DbCommands[i].Name)
731 /* Command not recognized */
733 return (CMD_NOT_FOUND);
737 /*******************************************************************************
739 * FUNCTION: AcpiDbCommandDispatch
741 * PARAMETERS: InputBuffer - Command line buffer
742 * WalkState - Current walk
743 * Op - Current (executing) parse op
747 * DESCRIPTION: Command dispatcher.
749 ******************************************************************************/
752 AcpiDbCommandDispatch (
754 ACPI_WALK_STATE *WalkState,
755 ACPI_PARSE_OBJECT *Op)
761 ACPI_STATUS Status = AE_CTRL_TRUE;
764 /* If AcpiTerminate has been called, terminate this thread */
766 if (AcpiGbl_DbTerminateLoop)
768 return (AE_CTRL_TERMINATE);
771 /* Find command and add to the history buffer */
773 ParamCount = AcpiDbGetLine (InputBuffer);
774 CommandIndex = AcpiDbMatchCommand (AcpiGbl_DbArgs[0]);
778 * We don't want to add the !! command to the history buffer. It
779 * would cause an infinite loop because it would always be the
782 if (CommandIndex != CMD_HISTORY_LAST)
784 AcpiDbAddToHistory (InputBuffer);
787 /* Verify that we have the minimum number of params */
789 if (ParamCount < AcpiGbl_DbCommands[CommandIndex].MinArgs)
791 AcpiOsPrintf ("%u parameters entered, [%s] requires %u parameters\n",
792 ParamCount, AcpiGbl_DbCommands[CommandIndex].Name,
793 AcpiGbl_DbCommands[CommandIndex].MinArgs);
795 AcpiDbDisplayCommandInfo (
796 AcpiGbl_DbCommands[CommandIndex].Name, FALSE);
797 return (AE_CTRL_TRUE);
800 /* Decode and dispatch the command */
802 switch (CommandIndex)
812 case CMD_ALLOCATIONS:
814 #ifdef ACPI_DBG_TRACK_ALLOCATIONS
815 AcpiUtDumpAllocations ((UINT32) -1, NULL);
822 AcpiDbDisplayArguments ();
827 AcpiDbSetMethodBreakpoint (AcpiGbl_DbArgs[1], WalkState, Op);
837 AcpiDbSetMethodCallBreakpoint (Op);
843 AcpiDbExecute (AcpiGbl_DbArgs[1],
844 &AcpiGbl_DbArgs[2], &AcpiGbl_DbArgTypes[2], EX_SINGLE_STEP);
847 case CMD_DISASSEMBLE:
850 (void) AcpiDbDisassembleMethod (AcpiGbl_DbArgs[1]);
855 AcpiDbDecodeAndDisplayObject (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]);
861 AcpiDbExecute (AcpiGbl_DbArgs[1],
862 &AcpiGbl_DbArgs[2], &AcpiGbl_DbArgTypes[2], EX_NO_SINGLE_STEP);
867 Status = AcpiDbFindNameInNamespace (AcpiGbl_DbArgs[1]);
872 AcpiGbl_CmSingleStep = FALSE;
877 AcpiDbDisplayHandlers ();
883 AcpiDbDisplayHelp (AcpiGbl_DbArgs[1]);
888 AcpiDbDisplayHistory ();
891 case CMD_HISTORY_EXE: /* ! command */
893 CommandLine = AcpiDbGetFromHistory (AcpiGbl_DbArgs[1]);
896 return (AE_CTRL_TRUE);
899 Status = AcpiDbCommandDispatch (CommandLine, WalkState, Op);
902 case CMD_HISTORY_LAST: /* !! command */
904 CommandLine = AcpiDbGetFromHistory (NULL);
907 return (AE_CTRL_TRUE);
910 Status = AcpiDbCommandDispatch (CommandLine, WalkState, Op);
913 case CMD_INFORMATION:
915 AcpiDbDisplayMethodInfo (Op);
920 AcpiDbCheckIntegrity ();
927 AcpiGbl_CmSingleStep = TRUE;
937 "Current debug level for file output is: %8.8lX\n",
938 AcpiGbl_DbDebugLevel);
940 "Current debug level for console output is: %8.8lX\n",
941 AcpiGbl_DbConsoleDebugLevel);
943 else if (ParamCount == 2)
945 Temp = AcpiGbl_DbConsoleDebugLevel;
946 AcpiGbl_DbConsoleDebugLevel =
947 strtoul (AcpiGbl_DbArgs[1], NULL, 16);
949 "Debug Level for console output was %8.8lX, now %8.8lX\n",
950 Temp, AcpiGbl_DbConsoleDebugLevel);
954 Temp = AcpiGbl_DbDebugLevel;
955 AcpiGbl_DbDebugLevel = strtoul (AcpiGbl_DbArgs[1], NULL, 16);
957 "Debug Level for file output was %8.8lX, now %8.8lX\n",
958 Temp, AcpiGbl_DbDebugLevel);
964 AcpiDbDisassembleAml (AcpiGbl_DbArgs[1], Op);
969 AcpiDbDisplayLocks ();
974 AcpiDbDisplayLocals ();
979 Status = AcpiDbDisplayObjects ("METHOD", AcpiGbl_DbArgs[1]);
984 AcpiDbDumpNamespace (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]);
989 Temp = strtoul (AcpiGbl_DbArgs[2], NULL, 0);
990 AcpiDbSendNotify (AcpiGbl_DbArgs[1], Temp);
995 AcpiUtStrupr (AcpiGbl_DbArgs[1]);
996 Status = AcpiDbDisplayObjects (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]);
1001 AcpiDbDisplayInterfaces (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]);
1006 AcpiDbDumpNamespaceByOwner (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]);
1011 AcpiDbDumpNamespacePaths ();
1016 AcpiDbSetScope (AcpiGbl_DbArgs[1]);
1019 case CMD_REFERENCES:
1021 AcpiDbFindReferences (AcpiGbl_DbArgs[1]);
1026 AcpiDbDisplayResources (AcpiGbl_DbArgs[1]);
1031 AcpiDbDisplayResults ();
1036 AcpiDbSetMethodData (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2],
1042 Status = AcpiDbDisplayStatistics (AcpiGbl_DbArgs[1]);
1047 return (AE_NOT_IMPLEMENTED);
1051 AcpiDbDisplayTableInfo (AcpiGbl_DbArgs[1]);
1056 AcpiDbDisplayTemplate (AcpiGbl_DbArgs[1]);
1061 AcpiDbTrace (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2], AcpiGbl_DbArgs[3]);
1066 AcpiDbDisplayCallingTree ();
1071 AcpiDbDisplayObjectType (AcpiGbl_DbArgs[1]);
1074 #ifdef ACPI_APPLICATION
1076 /* Hardware simulation commands. */
1078 case CMD_ENABLEACPI:
1079 #if (!ACPI_REDUCED_HARDWARE)
1081 Status = AcpiEnable();
1082 if (ACPI_FAILURE(Status))
1084 AcpiOsPrintf("AcpiEnable failed (Status=%X)\n", Status);
1087 #endif /* !ACPI_REDUCED_HARDWARE */
1092 AcpiOsPrintf ("Event command not implemented\n");
1097 AcpiDbGenerateGpe (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]);
1102 AcpiDbDisplayGpes ();
1107 AcpiDbGenerateSci ();
1112 Status = AcpiDbSleep (AcpiGbl_DbArgs[1]);
1115 /* File I/O commands. */
1119 AcpiDbCloseDebugFile ();
1124 ACPI_NEW_TABLE_DESC *ListHead = NULL;
1126 Status = AcGetAllTablesFromFile (AcpiGbl_DbArgs[1],
1127 ACPI_GET_ALL_TABLES, &ListHead);
1128 if (ACPI_SUCCESS (Status))
1130 AcpiDbLoadTables (ListHead);
1137 AcpiDbOpenDebugFile (AcpiGbl_DbArgs[1]);
1140 /* User space commands. */
1144 AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT);
1145 AcpiUtSubsystemShutdown ();
1148 * TBD: [Restructure] Need some way to re-initialize without
1149 * re-creating the semaphores!
1152 AcpiGbl_DbTerminateLoop = TRUE;
1153 /* AcpiInitialize (NULL); */
1158 AcpiDbCreateExecutionThreads (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2],
1162 /* Debug test commands. */
1164 case CMD_PREDEFINED:
1166 AcpiDbCheckPredefinedNames ();
1171 AcpiDbExecuteTest (AcpiGbl_DbArgs[1]);
1176 AcpiDbUnloadAcpiTable (AcpiGbl_DbArgs[1]);
1185 AcpiOsPrintf ("Method execution terminated\n");
1186 return (AE_CTRL_TERMINATE);
1189 if (!AcpiGbl_DbOutputToFile)
1191 AcpiDbgLevel = ACPI_DEBUG_DEFAULT;
1194 #ifdef ACPI_APPLICATION
1195 AcpiDbCloseDebugFile ();
1197 AcpiGbl_DbTerminateLoop = TRUE;
1198 return (AE_CTRL_TERMINATE);
1203 AcpiOsPrintf ("%s: unknown command\n", AcpiGbl_DbArgs[0]);
1204 return (AE_CTRL_TRUE);
1207 if (ACPI_SUCCESS (Status))
1209 Status = AE_CTRL_TRUE;
1216 /*******************************************************************************
1218 * FUNCTION: AcpiDbExecuteThread
1220 * PARAMETERS: Context - Not used
1224 * DESCRIPTION: Debugger execute thread. Waits for a command line, then
1225 * simply dispatches it.
1227 ******************************************************************************/
1229 void ACPI_SYSTEM_XFACE
1230 AcpiDbExecuteThread (
1233 ACPI_STATUS Status = AE_OK;
1234 ACPI_STATUS MStatus;
1237 while (Status != AE_CTRL_TERMINATE && !AcpiGbl_DbTerminateLoop)
1239 AcpiGbl_MethodExecuting = FALSE;
1240 AcpiGbl_StepToNextCall = FALSE;
1242 MStatus = AcpiOsAcquireMutex (AcpiGbl_DbCommandReady,
1244 if (ACPI_FAILURE (MStatus))
1249 Status = AcpiDbCommandDispatch (AcpiGbl_DbLineBuf, NULL, NULL);
1251 AcpiOsReleaseMutex (AcpiGbl_DbCommandComplete);
1253 AcpiGbl_DbThreadsTerminated = TRUE;
1257 /*******************************************************************************
1259 * FUNCTION: AcpiDbSingleThread
1265 * DESCRIPTION: Debugger execute thread. Waits for a command line, then
1266 * simply dispatches it.
1268 ******************************************************************************/
1271 AcpiDbSingleThread (
1275 AcpiGbl_MethodExecuting = FALSE;
1276 AcpiGbl_StepToNextCall = FALSE;
1278 (void) AcpiDbCommandDispatch (AcpiGbl_DbLineBuf, NULL, NULL);
1282 /*******************************************************************************
1284 * FUNCTION: AcpiDbUserCommands
1286 * PARAMETERS: Prompt - User prompt (depends on mode)
1287 * Op - Current executing parse op
1291 * DESCRIPTION: Command line execution for the AML debugger. Commands are
1292 * matched and dispatched here.
1294 ******************************************************************************/
1297 AcpiDbUserCommands (
1299 ACPI_PARSE_OBJECT *Op)
1301 ACPI_STATUS Status = AE_OK;
1304 AcpiOsPrintf ("\n");
1306 /* TBD: [Restructure] Need a separate command line buffer for step mode */
1308 while (!AcpiGbl_DbTerminateLoop)
1310 /* Force output to console until a command is entered */
1312 AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
1314 /* Different prompt if method is executing */
1316 if (!AcpiGbl_MethodExecuting)
1318 AcpiOsPrintf ("%1c ", ACPI_DEBUGGER_COMMAND_PROMPT);
1322 AcpiOsPrintf ("%1c ", ACPI_DEBUGGER_EXECUTE_PROMPT);
1325 /* Get the user input line */
1327 Status = AcpiOsGetLine (AcpiGbl_DbLineBuf,
1328 ACPI_DB_LINE_BUFFER_SIZE, NULL);
1329 if (ACPI_FAILURE (Status))
1331 ACPI_EXCEPTION ((AE_INFO, Status, "While parsing command line"));
1335 /* Check for single or multithreaded debug */
1337 if (AcpiGbl_DebuggerConfiguration & DEBUGGER_MULTI_THREADED)
1340 * Signal the debug thread that we have a command to execute,
1341 * and wait for the command to complete.
1343 AcpiOsReleaseMutex (AcpiGbl_DbCommandReady);
1345 Status = AcpiOsAcquireMutex (AcpiGbl_DbCommandComplete,
1347 if (ACPI_FAILURE (Status))
1354 /* Just call to the command line interpreter */
1356 AcpiDbSingleThread ();