1 /*******************************************************************************
3 * Module Name: dbinput - user front-end to the AML debugger
5 ******************************************************************************/
7 /******************************************************************************
11 * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
12 * All rights reserved.
16 * 2.1. This is your license from Intel Corp. under its intellectual property
17 * rights. You may have additional license terms from the party that provided
18 * you this software, covering your right to use that party's intellectual
21 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
22 * copy of the source code appearing in this file ("Covered Code") an
23 * irrevocable, perpetual, worldwide license under Intel's copyrights in the
24 * base code distributed originally by Intel ("Original Intel Code") to copy,
25 * make derivatives, distribute, use and display any portion of the Covered
26 * Code in any form, with the right to sublicense such rights; and
28 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
29 * license (with the right to sublicense), under only those claims of Intel
30 * patents that are infringed by the Original Intel Code, to make, use, sell,
31 * offer to sell, and import the Covered Code and derivative works thereof
32 * solely to the minimum extent necessary to exercise the above copyright
33 * license, and in no event shall the patent license extend to any additions
34 * to or modifications of the Original Intel Code. No other license or right
35 * is granted directly or by implication, estoppel or otherwise;
37 * The above copyright and patent license is granted only if the following
42 * 3.1. Redistribution of Source with Rights to Further Distribute Source.
43 * Redistribution of source code of any substantial portion of the Covered
44 * Code or modification with rights to further distribute source must include
45 * the above Copyright Notice, the above License, this list of Conditions,
46 * and the following Disclaimer and Export Compliance provision. In addition,
47 * Licensee must cause all Covered Code to which Licensee contributes to
48 * contain a file documenting the changes Licensee made to create that Covered
49 * Code and the date of any change. Licensee must include in that file the
50 * documentation of any changes made by any predecessor Licensee. Licensee
51 * must include a prominent statement that the modification is derived,
52 * directly or indirectly, from Original Intel Code.
54 * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
55 * Redistribution of source code of any substantial portion of the Covered
56 * Code or modification without rights to further distribute source must
57 * include the following Disclaimer and Export Compliance provision in the
58 * documentation and/or other materials provided with distribution. In
59 * addition, Licensee may not authorize further sublicense of source of any
60 * portion of the Covered Code, and must include terms to the effect that the
61 * license from Licensee to its licensee is limited to the intellectual
62 * property embodied in the software Licensee provides to its licensee, and
63 * not to intellectual property embodied in modifications its licensee may
66 * 3.3. Redistribution of Executable. Redistribution in executable form of any
67 * substantial portion of the Covered Code or modification must reproduce the
68 * above Copyright Notice, and the following Disclaimer and Export Compliance
69 * provision in the documentation and/or other materials provided with the
72 * 3.4. Intel retains all right, title, and interest in and to the Original
75 * 3.5. Neither the name Intel nor any other trademark owned or controlled by
76 * Intel shall be used in advertising or otherwise to promote the sale, use or
77 * other dealings in products derived from or relating to the Covered Code
78 * without prior written authorization from Intel.
80 * 4. Disclaimer and Export Compliance
82 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
83 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
84 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
85 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
86 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
87 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
90 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
91 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
92 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
93 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
94 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
95 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
96 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
99 * 4.3. Licensee shall not export, either directly or indirectly, any of this
100 * software or system incorporating such software without first obtaining any
101 * required license or other approval from the U. S. Department of Commerce or
102 * any other agency or department of the United States Government. In the
103 * event Licensee exports any such software from the United States or
104 * re-exports any such software from a foreign destination, Licensee shall
105 * ensure that the distribution and export/re-export of the software is in
106 * compliance with all laws, regulations, orders, or other restrictions of the
107 * U.S. Export Administration Regulations. Licensee agrees that neither it nor
108 * any of its subsidiaries will export/re-export any technical data, process,
109 * software, or service, directly or indirectly, to any country for which the
110 * United States government or any agency thereof requires an export license,
111 * other governmental approval, or letter of assurance, without first obtaining
112 * such license, approval or letter.
114 *****************************************************************************/
118 #include "accommon.h"
124 #define _COMPONENT ACPI_CA_DEBUGGER
125 ACPI_MODULE_NAME ("dbinput")
127 /* Local prototypes */
147 * Top-level debugger commands.
149 * This list of commands must match the string table below it
151 enum AcpiExDebuggerCommands
214 #define CMD_FIRST_VALID 2
217 /* Second parameter is the required argument count */
219 static const COMMAND_INFO AcpiGbl_DbCommands[] =
284 /*******************************************************************************
286 * FUNCTION: AcpiDbDisplayHelp
292 * DESCRIPTION: Print a usage message.
294 ******************************************************************************/
301 AcpiOsPrintf ("\nGeneral-Purpose Commands:\n");
302 AcpiOsPrintf (" Allocations Display list of current memory allocations\n");
303 AcpiOsPrintf (" Dump <Address>|<Namepath>\n");
304 AcpiOsPrintf (" [Byte|Word|Dword|Qword] Display ACPI objects or memory\n");
305 AcpiOsPrintf (" EnableAcpi Enable ACPI (hardware) mode\n");
306 AcpiOsPrintf (" Handlers Info about global handlers\n");
307 AcpiOsPrintf (" Help This help screen\n");
308 AcpiOsPrintf (" History Display command history buffer\n");
309 AcpiOsPrintf (" Level [<DebugLevel>] [console] Get/Set debug level for file or console\n");
310 AcpiOsPrintf (" Locks Current status of internal mutexes\n");
311 AcpiOsPrintf (" Osi [Install|Remove <name>] Display or modify global _OSI list\n");
312 AcpiOsPrintf (" Quit or Exit Exit this command\n");
313 AcpiOsPrintf (" Stats [Allocations|Memory|Misc|\n");
314 AcpiOsPrintf (" Objects|Sizes|Stack|Tables] Display namespace and memory statistics\n");
315 AcpiOsPrintf (" Allocations Display list of current memory allocations\n");
316 AcpiOsPrintf (" Memory Dump internal memory lists\n");
317 AcpiOsPrintf (" Misc Namespace search and mutex stats\n");
318 AcpiOsPrintf (" Objects Summary of namespace objects\n");
319 AcpiOsPrintf (" Sizes Sizes for each of the internal objects\n");
320 AcpiOsPrintf (" Stack Display CPU stack usage\n");
321 AcpiOsPrintf (" Tables Info about current ACPI table(s)\n");
322 AcpiOsPrintf (" Tables Display info about loaded ACPI tables\n");
323 AcpiOsPrintf (" Unload <TableSig> [Instance] Unload an ACPI table\n");
324 AcpiOsPrintf (" ! <CommandNumber> Execute command from history buffer\n");
325 AcpiOsPrintf (" !! Execute last command again\n");
327 AcpiOsPrintf ("\nNamespace Access Commands:\n");
328 AcpiOsPrintf (" Businfo Display system bus info\n");
329 AcpiOsPrintf (" Disassemble <Method> Disassemble a control method\n");
330 AcpiOsPrintf (" Event <F|G> <Value> Generate AcpiEvent (Fixed/GPE)\n");
331 AcpiOsPrintf (" Find <AcpiName> (? is wildcard) Find ACPI name(s) with wildcards\n");
332 AcpiOsPrintf (" Gpe <GpeNum> <GpeBlock> Simulate a GPE\n");
333 AcpiOsPrintf (" Gpes Display info on all GPEs\n");
334 AcpiOsPrintf (" Integrity Validate namespace integrity\n");
335 AcpiOsPrintf (" Methods Display list of loaded control methods\n");
336 AcpiOsPrintf (" Namespace [Object] [Depth] Display loaded namespace tree/subtree\n");
337 AcpiOsPrintf (" Notify <Object> <Value> Send a notification on Object\n");
338 AcpiOsPrintf (" Objects <ObjectType> Display all objects of the given type\n");
339 AcpiOsPrintf (" Owner <OwnerId> [Depth] Display loaded namespace by object owner\n");
340 AcpiOsPrintf (" Predefined Check all predefined names\n");
341 AcpiOsPrintf (" Prefix [<NamePath>] Set or Get current execution prefix\n");
342 AcpiOsPrintf (" References <Addr> Find all references to object at addr\n");
343 AcpiOsPrintf (" Resources <Device> Get and display Device resources\n");
344 AcpiOsPrintf (" Set N <NamedObject> <Value> Set value for named integer\n");
345 AcpiOsPrintf (" Sleep <SleepState> Simulate sleep/wake sequence\n");
346 AcpiOsPrintf (" Terminate Delete namespace and all internal objects\n");
347 AcpiOsPrintf (" Type <Object> Display object type\n");
349 AcpiOsPrintf ("\nControl Method Execution Commands:\n");
350 AcpiOsPrintf (" Arguments (or Args) Display method arguments\n");
351 AcpiOsPrintf (" Breakpoint <AmlOffset> Set an AML execution breakpoint\n");
352 AcpiOsPrintf (" Call Run to next control method invocation\n");
353 AcpiOsPrintf (" Debug <Namepath> [Arguments] Single Step a control method\n");
354 AcpiOsPrintf (" Execute <Namepath> [Arguments] Execute control method\n");
355 AcpiOsPrintf (" Hex Integer Integer method argument\n");
356 AcpiOsPrintf (" \"Ascii String\" String method argument\n");
357 AcpiOsPrintf (" (Byte List) Buffer method argument\n");
358 AcpiOsPrintf (" [Package Element List] Package method argument\n");
359 AcpiOsPrintf (" Go Allow method to run to completion\n");
360 AcpiOsPrintf (" Information Display info about the current method\n");
361 AcpiOsPrintf (" Into Step into (not over) a method call\n");
362 AcpiOsPrintf (" List [# of Aml Opcodes] Display method ASL statements\n");
363 AcpiOsPrintf (" Locals Display method local variables\n");
364 AcpiOsPrintf (" Results Display method result stack\n");
365 AcpiOsPrintf (" Set <A|L> <#> <Value> Set method data (Arguments/Locals)\n");
366 AcpiOsPrintf (" Stop Terminate control method\n");
367 AcpiOsPrintf (" Thread <Threads><Loops><NamePath> Spawn threads to execute method(s)\n");
368 AcpiOsPrintf (" Trace <method name> Trace method execution\n");
369 AcpiOsPrintf (" Tree Display control method calling tree\n");
370 AcpiOsPrintf (" <Enter> Single step next AML opcode (over calls)\n");
372 AcpiOsPrintf ("\nFile I/O Commands:\n");
373 AcpiOsPrintf (" Close Close debug output file\n");
374 AcpiOsPrintf (" Load <Input Filename> Load ACPI table from a file\n");
375 AcpiOsPrintf (" Open <Output Filename> Open a file for debug output\n");
379 /*******************************************************************************
381 * FUNCTION: AcpiDbGetNextToken
383 * PARAMETERS: String - Command buffer
384 * Next - Return value, end of next token
386 * RETURN: Pointer to the start of the next token.
388 * DESCRIPTION: Command line parsing. Get the next token on the command line
390 ******************************************************************************/
396 ACPI_OBJECT_TYPE *ReturnType)
400 ACPI_OBJECT_TYPE Type = ACPI_TYPE_INTEGER;
403 /* At end of buffer? */
405 if (!String || !(*String))
410 /* Remove any spaces at the beginning */
414 while (*String && (*String == ' '))
429 /* This is a quoted string, scan until closing quote */
433 Type = ACPI_TYPE_STRING;
435 /* Find end of string */
437 while (*String && (*String != '"'))
445 /* This is the start of a buffer, scan until closing paren */
449 Type = ACPI_TYPE_BUFFER;
451 /* Find end of buffer */
453 while (*String && (*String != ')'))
461 /* This is the start of a package, scan until closing bracket */
466 Type = ACPI_TYPE_PACKAGE;
468 /* Find end of package (closing bracket) */
472 /* Handle String package elements */
476 /* Find end of string */
479 while (*String && (*String != '"'))
488 else if (*String == '[')
490 Depth++; /* A nested package declaration */
492 else if (*String == ']')
495 if (Depth == 0) /* Found final package closing bracket */
509 /* Find end of token */
511 while (*String && (*String != ' '))
533 /*******************************************************************************
535 * FUNCTION: AcpiDbGetLine
537 * PARAMETERS: InputBuffer - Command line buffer
539 * RETURN: Count of arguments to the command
541 * DESCRIPTION: Get the next command line from the user. Gets entire line
542 * up to the next newline
544 ******************************************************************************/
556 ACPI_STRCPY (AcpiGbl_DbParsedBuf, InputBuffer);
558 This = AcpiGbl_DbParsedBuf;
559 for (i = 0; i < ACPI_DEBUGGER_MAX_ARGS; i++)
561 AcpiGbl_DbArgs[i] = AcpiDbGetNextToken (This, &Next,
562 &AcpiGbl_DbArgTypes[i]);
563 if (!AcpiGbl_DbArgs[i])
571 /* Uppercase the actual command */
573 if (AcpiGbl_DbArgs[0])
575 AcpiUtStrupr (AcpiGbl_DbArgs[0]);
581 Count--; /* Number of args only */
588 /*******************************************************************************
590 * FUNCTION: AcpiDbMatchCommand
592 * PARAMETERS: UserCommand - User command line
594 * RETURN: Index into command array, -1 if not found
596 * DESCRIPTION: Search command array for a command match
598 ******************************************************************************/
607 if (!UserCommand || UserCommand[0] == 0)
612 for (i = CMD_FIRST_VALID; AcpiGbl_DbCommands[i].Name; i++)
614 if (ACPI_STRSTR (AcpiGbl_DbCommands[i].Name, UserCommand) ==
615 AcpiGbl_DbCommands[i].Name)
621 /* Command not recognized */
623 return (CMD_NOT_FOUND);
627 /*******************************************************************************
629 * FUNCTION: AcpiDbCommandDispatch
631 * PARAMETERS: InputBuffer - Command line buffer
632 * WalkState - Current walk
633 * Op - Current (executing) parse op
637 * DESCRIPTION: Command dispatcher.
639 ******************************************************************************/
642 AcpiDbCommandDispatch (
644 ACPI_WALK_STATE *WalkState,
645 ACPI_PARSE_OBJECT *Op)
651 ACPI_STATUS Status = AE_CTRL_TRUE;
654 /* If AcpiTerminate has been called, terminate this thread */
656 if (AcpiGbl_DbTerminateThreads)
658 return (AE_CTRL_TERMINATE);
661 ParamCount = AcpiDbGetLine (InputBuffer);
662 CommandIndex = AcpiDbMatchCommand (AcpiGbl_DbArgs[0]);
665 /* Verify that we have the minimum number of params */
667 if (ParamCount < AcpiGbl_DbCommands[CommandIndex].MinArgs)
669 AcpiOsPrintf ("%u parameters entered, [%s] requires %u parameters\n",
670 ParamCount, AcpiGbl_DbCommands[CommandIndex].Name,
671 AcpiGbl_DbCommands[CommandIndex].MinArgs);
673 return (AE_CTRL_TRUE);
676 /* Decode and dispatch the command */
678 switch (CommandIndex)
687 case CMD_ALLOCATIONS:
689 #ifdef ACPI_DBG_TRACK_ALLOCATIONS
690 AcpiUtDumpAllocations ((UINT32) -1, NULL);
696 AcpiDbDisplayArguments ();
700 AcpiDbBatchExecute (AcpiGbl_DbArgs[1]);
704 AcpiDbSetMethodBreakpoint (AcpiGbl_DbArgs[1], WalkState, Op);
712 AcpiDbSetMethodCallBreakpoint (Op);
717 AcpiDbCloseDebugFile ();
721 AcpiDbExecute (AcpiGbl_DbArgs[1],
722 &AcpiGbl_DbArgs[2], &AcpiGbl_DbArgTypes[2], EX_SINGLE_STEP);
725 case CMD_DISASSEMBLE:
726 (void) AcpiDbDisassembleMethod (AcpiGbl_DbArgs[1]);
730 AcpiDbDecodeAndDisplayObject (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]);
734 Status = AcpiEnable();
735 if (ACPI_FAILURE(Status))
737 AcpiOsPrintf("AcpiEnable failed (Status=%X)\n", Status);
743 AcpiOsPrintf ("Event command not implemented\n");
747 AcpiDbExecute (AcpiGbl_DbArgs[1],
748 &AcpiGbl_DbArgs[2], &AcpiGbl_DbArgTypes[2], EX_NO_SINGLE_STEP);
752 Status = AcpiDbFindNameInNamespace (AcpiGbl_DbArgs[1]);
756 AcpiGbl_CmSingleStep = FALSE;
760 AcpiDbGenerateGpe (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]);
764 AcpiDbDisplayGpes ();
768 AcpiDbDisplayHandlers ();
773 AcpiDbDisplayHelp ();
777 AcpiDbDisplayHistory ();
780 case CMD_HISTORY_EXE:
781 CommandLine = AcpiDbGetFromHistory (AcpiGbl_DbArgs[1]);
784 return (AE_CTRL_TRUE);
787 Status = AcpiDbCommandDispatch (CommandLine, WalkState, Op);
790 case CMD_HISTORY_LAST:
791 CommandLine = AcpiDbGetFromHistory (NULL);
794 return (AE_CTRL_TRUE);
797 Status = AcpiDbCommandDispatch (CommandLine, WalkState, Op);
800 case CMD_INFORMATION:
801 AcpiDbDisplayMethodInfo (Op);
805 AcpiDbCheckIntegrity ();
811 AcpiGbl_CmSingleStep = TRUE;
819 AcpiOsPrintf ("Current debug level for file output is: %8.8lX\n",
820 AcpiGbl_DbDebugLevel);
821 AcpiOsPrintf ("Current debug level for console output is: %8.8lX\n",
822 AcpiGbl_DbConsoleDebugLevel);
824 else if (ParamCount == 2)
826 Temp = AcpiGbl_DbConsoleDebugLevel;
827 AcpiGbl_DbConsoleDebugLevel = ACPI_STRTOUL (AcpiGbl_DbArgs[1],
830 "Debug Level for console output was %8.8lX, now %8.8lX\n",
831 Temp, AcpiGbl_DbConsoleDebugLevel);
835 Temp = AcpiGbl_DbDebugLevel;
836 AcpiGbl_DbDebugLevel = ACPI_STRTOUL (AcpiGbl_DbArgs[1], NULL, 16);
838 "Debug Level for file output was %8.8lX, now %8.8lX\n",
839 Temp, AcpiGbl_DbDebugLevel);
844 AcpiDbDisassembleAml (AcpiGbl_DbArgs[1], Op);
848 Status = AcpiDbGetTableFromFile (AcpiGbl_DbArgs[1], NULL);
852 AcpiDbDisplayLocks ();
856 AcpiDbDisplayLocals ();
860 Status = AcpiDbDisplayObjects ("METHOD", AcpiGbl_DbArgs[1]);
864 AcpiDbDumpNamespace (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]);
868 Temp = ACPI_STRTOUL (AcpiGbl_DbArgs[2], NULL, 0);
869 AcpiDbSendNotify (AcpiGbl_DbArgs[1], Temp);
873 AcpiUtStrupr (AcpiGbl_DbArgs[1]);
874 Status = AcpiDbDisplayObjects (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]);
878 AcpiDbOpenDebugFile (AcpiGbl_DbArgs[1]);
882 AcpiDbDisplayInterfaces (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]);
886 AcpiDbDumpNamespaceByOwner (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]);
890 AcpiDbCheckPredefinedNames ();
894 AcpiDbSetScope (AcpiGbl_DbArgs[1]);
898 AcpiDbFindReferences (AcpiGbl_DbArgs[1]);
902 AcpiDbDisplayResources (AcpiGbl_DbArgs[1]);
906 AcpiDbDisplayResults ();
910 AcpiDbSetMethodData (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2],
915 Status = AcpiDbSleep (AcpiGbl_DbArgs[1]);
919 Status = AcpiDbDisplayStatistics (AcpiGbl_DbArgs[1]);
923 return (AE_NOT_IMPLEMENTED);
926 AcpiDbDisplayTableInfo (AcpiGbl_DbArgs[1]);
930 AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT);
931 AcpiUtSubsystemShutdown ();
934 * TBD: [Restructure] Need some way to re-initialize without
935 * re-creating the semaphores!
938 /* AcpiInitialize (NULL); */
942 AcpiDbCreateExecutionThreads (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2],
947 (void) AcpiDebugTrace (AcpiGbl_DbArgs[1],0,0,1);
951 AcpiDbDisplayCallingTree ();
955 AcpiDbDisplayObjectType (AcpiGbl_DbArgs[1]);
959 AcpiDbUnloadAcpiTable (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]);
966 AcpiOsPrintf ("Method execution terminated\n");
967 return (AE_CTRL_TERMINATE);
970 if (!AcpiGbl_DbOutputToFile)
972 AcpiDbgLevel = ACPI_DEBUG_DEFAULT;
975 AcpiDbCloseDebugFile ();
976 AcpiGbl_DbTerminateThreads = TRUE;
977 return (AE_CTRL_TERMINATE);
981 AcpiOsPrintf ("Unknown Command\n");
982 return (AE_CTRL_TRUE);
985 if (ACPI_SUCCESS (Status))
987 Status = AE_CTRL_TRUE;
990 /* Add all commands that come here to the history buffer */
992 AcpiDbAddToHistory (InputBuffer);
997 /*******************************************************************************
999 * FUNCTION: AcpiDbExecuteThread
1001 * PARAMETERS: Context - Not used
1005 * DESCRIPTION: Debugger execute thread. Waits for a command line, then
1006 * simply dispatches it.
1008 ******************************************************************************/
1010 void ACPI_SYSTEM_XFACE
1011 AcpiDbExecuteThread (
1014 ACPI_STATUS Status = AE_OK;
1015 ACPI_STATUS MStatus;
1018 while (Status != AE_CTRL_TERMINATE)
1020 AcpiGbl_MethodExecuting = FALSE;
1021 AcpiGbl_StepToNextCall = FALSE;
1023 MStatus = AcpiUtAcquireMutex (ACPI_MTX_DEBUG_CMD_READY);
1024 if (ACPI_FAILURE (MStatus))
1029 Status = AcpiDbCommandDispatch (AcpiGbl_DbLineBuf, NULL, NULL);
1031 MStatus = AcpiUtReleaseMutex (ACPI_MTX_DEBUG_CMD_COMPLETE);
1032 if (ACPI_FAILURE (MStatus))
1040 /*******************************************************************************
1042 * FUNCTION: AcpiDbSingleThread
1048 * DESCRIPTION: Debugger execute thread. Waits for a command line, then
1049 * simply dispatches it.
1051 ******************************************************************************/
1054 AcpiDbSingleThread (
1058 AcpiGbl_MethodExecuting = FALSE;
1059 AcpiGbl_StepToNextCall = FALSE;
1061 (void) AcpiDbCommandDispatch (AcpiGbl_DbLineBuf, NULL, NULL);
1065 /*******************************************************************************
1067 * FUNCTION: AcpiDbUserCommands
1069 * PARAMETERS: Prompt - User prompt (depends on mode)
1070 * Op - Current executing parse op
1074 * DESCRIPTION: Command line execution for the AML debugger. Commands are
1075 * matched and dispatched here.
1077 ******************************************************************************/
1080 AcpiDbUserCommands (
1082 ACPI_PARSE_OBJECT *Op)
1084 ACPI_STATUS Status = AE_OK;
1087 /* TBD: [Restructure] Need a separate command line buffer for step mode */
1089 while (!AcpiGbl_DbTerminateThreads)
1091 /* Force output to console until a command is entered */
1093 AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
1095 /* Different prompt if method is executing */
1097 if (!AcpiGbl_MethodExecuting)
1099 AcpiOsPrintf ("%1c ", ACPI_DEBUGGER_COMMAND_PROMPT);
1103 AcpiOsPrintf ("%1c ", ACPI_DEBUGGER_EXECUTE_PROMPT);
1106 /* Get the user input line */
1108 Status = AcpiOsGetLine (AcpiGbl_DbLineBuf,
1109 ACPI_DB_LINE_BUFFER_SIZE, NULL);
1110 if (ACPI_FAILURE (Status))
1112 ACPI_EXCEPTION ((AE_INFO, Status, "While parsing command line"));
1116 /* Check for single or multithreaded debug */
1118 if (AcpiGbl_DebuggerConfiguration & DEBUGGER_MULTI_THREADED)
1121 * Signal the debug thread that we have a command to execute,
1122 * and wait for the command to complete.
1124 Status = AcpiUtReleaseMutex (ACPI_MTX_DEBUG_CMD_READY);
1125 if (ACPI_FAILURE (Status))
1130 Status = AcpiUtAcquireMutex (ACPI_MTX_DEBUG_CMD_COMPLETE);
1131 if (ACPI_FAILURE (Status))
1138 /* Just call to the command line interpreter */
1140 AcpiDbSingleThread ();
1145 * Only this thread (the original thread) should actually terminate the
1146 * subsystem, because all the semaphores are deleted during termination
1148 Status = AcpiTerminate ();
1152 #endif /* ACPI_DEBUGGER */