1 /*******************************************************************************
3 * Module Name: dbinput - user front-end to the AML debugger
5 ******************************************************************************/
7 /******************************************************************************
11 * Some or all of this work - Copyright (c) 1999 - 2010, 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 *****************************************************************************/
117 #include <contrib/dev/acpica/include/acpi.h>
118 #include <contrib/dev/acpica/include/accommon.h>
119 #include <contrib/dev/acpica/include/acdebug.h>
124 #define _COMPONENT ACPI_CA_DEBUGGER
125 ACPI_MODULE_NAME ("dbinput")
127 /* Local prototypes */
152 * Top-level debugger commands.
154 * This list of commands must match the string table below it
156 enum AcpiExDebuggerCommands
217 #define CMD_FIRST_VALID 2
220 /* Second parameter is the required argument count */
222 static const COMMAND_INFO AcpiGbl_DbCommands[] =
285 /*******************************************************************************
287 * FUNCTION: AcpiDbDisplayHelp
289 * PARAMETERS: HelpType - Subcommand (optional)
293 * DESCRIPTION: Print a usage message.
295 ******************************************************************************/
302 AcpiUtStrupr (HelpType);
304 /* No parameter, just give the overview */
308 AcpiOsPrintf ("ACPI CA Debugger Commands\n\n");
309 AcpiOsPrintf ("The following classes of commands are available. Help is available for\n");
310 AcpiOsPrintf ("each class by entering \"Help <ClassName>\"\n\n");
311 AcpiOsPrintf (" [GENERAL] General-Purpose Commands\n");
312 AcpiOsPrintf (" [NAMESPACE] Namespace Access Commands\n");
313 AcpiOsPrintf (" [METHOD] Control Method Execution Commands\n");
314 AcpiOsPrintf (" [STATISTICS] Statistical Information\n");
315 AcpiOsPrintf (" [FILE] File I/O Commands\n");
320 * Parameter is the command class
322 * The idea here is to keep each class of commands smaller than a screenful
327 AcpiOsPrintf ("\nGeneral-Purpose Commands\n\n");
328 AcpiOsPrintf ("Allocations Display list of current memory allocations\n");
329 AcpiOsPrintf ("Dump <Address>|<Namepath>\n");
330 AcpiOsPrintf (" [Byte|Word|Dword|Qword] Display ACPI objects or memory\n");
331 AcpiOsPrintf ("EnableAcpi Enable ACPI (hardware) mode\n");
332 AcpiOsPrintf ("Help This help screen\n");
333 AcpiOsPrintf ("History Display command history buffer\n");
334 AcpiOsPrintf ("Level [<DebugLevel>] [console] Get/Set debug level for file or console\n");
335 AcpiOsPrintf ("Locks Current status of internal mutexes\n");
336 AcpiOsPrintf ("Quit or Exit Exit this command\n");
337 AcpiOsPrintf ("Stats [Allocations|Memory|Misc\n");
338 AcpiOsPrintf (" |Objects|Sizes|Stack|Tables] Display namespace and memory statistics\n");
339 AcpiOsPrintf ("Tables Display info about loaded ACPI tables\n");
340 AcpiOsPrintf ("Unload <TableSig> [Instance] Unload an ACPI table\n");
341 AcpiOsPrintf ("! <CommandNumber> Execute command from history buffer\n");
342 AcpiOsPrintf ("!! Execute last command again\n");
346 AcpiOsPrintf ("\nStats Subcommands\n\n");
347 AcpiOsPrintf ("Allocations Display list of current memory allocations\n");
348 AcpiOsPrintf ("Memory Dump internal memory lists\n");
349 AcpiOsPrintf ("Misc Namespace search and mutex stats\n");
350 AcpiOsPrintf ("Objects Summary of namespace objects\n");
351 AcpiOsPrintf ("Sizes Sizes for each of the internal objects\n");
352 AcpiOsPrintf ("Stack Display CPU stack usage\n");
353 AcpiOsPrintf ("Tables Info about current ACPI table(s)\n");
357 AcpiOsPrintf ("\nNamespace Access Commands\n\n");
358 AcpiOsPrintf ("Businfo Display system bus info\n");
359 AcpiOsPrintf ("Disassemble <Method> Disassemble a control method\n");
360 AcpiOsPrintf ("Event <F|G> <Value> Generate AcpiEvent (Fixed/GPE)\n");
361 AcpiOsPrintf ("Find <AcpiName> (? is wildcard) Find ACPI name(s) with wildcards\n");
362 AcpiOsPrintf ("Gpe <GpeNum> <GpeBlock> Simulate a GPE\n");
363 AcpiOsPrintf ("Gpes Display info on all GPEs\n");
364 AcpiOsPrintf ("Integrity Validate namespace integrity\n");
365 AcpiOsPrintf ("Methods Display list of loaded control methods\n");
366 AcpiOsPrintf ("Namespace [Object] [Depth] Display loaded namespace tree/subtree\n");
367 AcpiOsPrintf ("Notify <Object> <Value> Send a notification on Object\n");
368 AcpiOsPrintf ("Objects <ObjectType> Display all objects of the given type\n");
369 AcpiOsPrintf ("Owner <OwnerId> [Depth] Display loaded namespace by object owner\n");
370 AcpiOsPrintf ("Predefined Check all predefined names\n");
371 AcpiOsPrintf ("Prefix [<NamePath>] Set or Get current execution prefix\n");
372 AcpiOsPrintf ("References <Addr> Find all references to object at addr\n");
373 AcpiOsPrintf ("Resources <Device> Get and display Device resources\n");
374 AcpiOsPrintf ("Set N <NamedObject> <Value> Set value for named integer\n");
375 AcpiOsPrintf ("Sleep <SleepState> Simulate sleep/wake sequence\n");
376 AcpiOsPrintf ("Terminate Delete namespace and all internal objects\n");
377 AcpiOsPrintf ("Type <Object> Display object type\n");
381 AcpiOsPrintf ("\nControl Method Execution Commands\n\n");
382 AcpiOsPrintf ("Arguments (or Args) Display method arguments\n");
383 AcpiOsPrintf ("Breakpoint <AmlOffset> Set an AML execution breakpoint\n");
384 AcpiOsPrintf ("Call Run to next control method invocation\n");
385 AcpiOsPrintf ("Debug <Namepath> [Arguments] Single Step a control method\n");
386 AcpiOsPrintf ("Execute <Namepath> [Arguments] Execute control method\n");
387 AcpiOsPrintf ("Go Allow method to run to completion\n");
388 AcpiOsPrintf ("Information Display info about the current method\n");
389 AcpiOsPrintf ("Into Step into (not over) a method call\n");
390 AcpiOsPrintf ("List [# of Aml Opcodes] Display method ASL statements\n");
391 AcpiOsPrintf ("Locals Display method local variables\n");
392 AcpiOsPrintf ("Results Display method result stack\n");
393 AcpiOsPrintf ("Set <A|L> <#> <Value> Set method data (Arguments/Locals)\n");
394 AcpiOsPrintf ("Stop Terminate control method\n");
395 AcpiOsPrintf ("Thread <Threads><Loops><NamePath> Spawn threads to execute method(s)\n");
396 AcpiOsPrintf ("Trace <method name> Trace method execution\n");
397 AcpiOsPrintf ("Tree Display control method calling tree\n");
398 AcpiOsPrintf ("<Enter> Single step next AML opcode (over calls)\n");
402 AcpiOsPrintf ("\nFile I/O Commands\n\n");
403 AcpiOsPrintf ("Close Close debug output file\n");
404 AcpiOsPrintf ("Open <Output Filename> Open a file for debug output\n");
405 AcpiOsPrintf ("Load <Input Filename> Load ACPI table from a file\n");
409 AcpiOsPrintf ("Unrecognized Command Class: %s\n", HelpType);
415 /*******************************************************************************
417 * FUNCTION: AcpiDbGetNextToken
419 * PARAMETERS: String - Command buffer
420 * Next - Return value, end of next token
422 * RETURN: Pointer to the start of the next token.
424 * DESCRIPTION: Command line parsing. Get the next token on the command line
426 ******************************************************************************/
436 /* At end of buffer? */
438 if (!String || !(*String))
443 /* Get rid of any spaces at the beginning */
447 while (*String && (*String == ' '))
460 /* Find end of token */
462 while (*String && (*String != ' '))
481 /*******************************************************************************
483 * FUNCTION: AcpiDbGetLine
485 * PARAMETERS: InputBuffer - Command line buffer
487 * RETURN: Count of arguments to the command
489 * DESCRIPTION: Get the next command line from the user. Gets entire line
490 * up to the next newline
492 ******************************************************************************/
504 ACPI_STRCPY (AcpiGbl_DbParsedBuf, InputBuffer);
506 This = AcpiGbl_DbParsedBuf;
507 for (i = 0; i < ACPI_DEBUGGER_MAX_ARGS; i++)
509 AcpiGbl_DbArgs[i] = AcpiDbGetNextToken (This, &Next);
510 if (!AcpiGbl_DbArgs[i])
518 /* Uppercase the actual command */
520 if (AcpiGbl_DbArgs[0])
522 AcpiUtStrupr (AcpiGbl_DbArgs[0]);
528 Count--; /* Number of args only */
535 /*******************************************************************************
537 * FUNCTION: AcpiDbMatchCommand
539 * PARAMETERS: UserCommand - User command line
541 * RETURN: Index into command array, -1 if not found
543 * DESCRIPTION: Search command array for a command match
545 ******************************************************************************/
554 if (!UserCommand || UserCommand[0] == 0)
559 for (i = CMD_FIRST_VALID; AcpiGbl_DbCommands[i].Name; i++)
561 if (ACPI_STRSTR (AcpiGbl_DbCommands[i].Name, UserCommand) ==
562 AcpiGbl_DbCommands[i].Name)
568 /* Command not recognized */
570 return (CMD_NOT_FOUND);
574 /*******************************************************************************
576 * FUNCTION: AcpiDbCommandDispatch
578 * PARAMETERS: InputBuffer - Command line buffer
579 * WalkState - Current walk
580 * Op - Current (executing) parse op
584 * DESCRIPTION: Command dispatcher.
586 ******************************************************************************/
589 AcpiDbCommandDispatch (
591 ACPI_WALK_STATE *WalkState,
592 ACPI_PARSE_OBJECT *Op)
598 ACPI_STATUS Status = AE_CTRL_TRUE;
601 /* If AcpiTerminate has been called, terminate this thread */
603 if (AcpiGbl_DbTerminateThreads)
605 return (AE_CTRL_TERMINATE);
608 ParamCount = AcpiDbGetLine (InputBuffer);
609 CommandIndex = AcpiDbMatchCommand (AcpiGbl_DbArgs[0]);
612 /* Verify that we have the minimum number of params */
614 if (ParamCount < AcpiGbl_DbCommands[CommandIndex].MinArgs)
616 AcpiOsPrintf ("%d parameters entered, [%s] requires %d parameters\n",
617 ParamCount, AcpiGbl_DbCommands[CommandIndex].Name,
618 AcpiGbl_DbCommands[CommandIndex].MinArgs);
620 return (AE_CTRL_TRUE);
623 /* Decode and dispatch the command */
625 switch (CommandIndex)
634 case CMD_ALLOCATIONS:
636 #ifdef ACPI_DBG_TRACK_ALLOCATIONS
637 AcpiUtDumpAllocations ((UINT32) -1, NULL);
643 AcpiDbDisplayArguments ();
647 AcpiDbBatchExecute (AcpiGbl_DbArgs[1]);
651 AcpiDbSetMethodBreakpoint (AcpiGbl_DbArgs[1], WalkState, Op);
659 AcpiDbSetMethodCallBreakpoint (Op);
664 AcpiDbCloseDebugFile ();
668 AcpiDbExecute (AcpiGbl_DbArgs[1], &AcpiGbl_DbArgs[2], EX_SINGLE_STEP);
671 case CMD_DISASSEMBLE:
672 (void) AcpiDbDisassembleMethod (AcpiGbl_DbArgs[1]);
676 AcpiDbDecodeAndDisplayObject (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]);
680 Status = AcpiEnable();
681 if (ACPI_FAILURE(Status))
683 AcpiOsPrintf("AcpiEnable failed (Status=%X)\n", Status);
689 AcpiOsPrintf ("Event command not implemented\n");
693 AcpiDbExecute (AcpiGbl_DbArgs[1],
694 &AcpiGbl_DbArgs[2], EX_NO_SINGLE_STEP);
698 Status = AcpiDbFindNameInNamespace (AcpiGbl_DbArgs[1]);
702 AcpiGbl_CmSingleStep = FALSE;
706 AcpiDbGenerateGpe (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]);
710 AcpiDbDisplayGpes ();
715 AcpiDbDisplayHelp (AcpiGbl_DbArgs[1]);
719 AcpiDbDisplayHistory ();
722 case CMD_HISTORY_EXE:
723 CommandLine = AcpiDbGetFromHistory (AcpiGbl_DbArgs[1]);
726 return (AE_CTRL_TRUE);
729 Status = AcpiDbCommandDispatch (CommandLine, WalkState, Op);
732 case CMD_HISTORY_LAST:
733 CommandLine = AcpiDbGetFromHistory (NULL);
736 return (AE_CTRL_TRUE);
739 Status = AcpiDbCommandDispatch (CommandLine, WalkState, Op);
742 case CMD_INFORMATION:
743 AcpiDbDisplayMethodInfo (Op);
747 AcpiDbCheckIntegrity ();
753 AcpiGbl_CmSingleStep = TRUE;
761 AcpiOsPrintf ("Current debug level for file output is: %8.8lX\n",
762 AcpiGbl_DbDebugLevel);
763 AcpiOsPrintf ("Current debug level for console output is: %8.8lX\n",
764 AcpiGbl_DbConsoleDebugLevel);
766 else if (ParamCount == 2)
768 Temp = AcpiGbl_DbConsoleDebugLevel;
769 AcpiGbl_DbConsoleDebugLevel = ACPI_STRTOUL (AcpiGbl_DbArgs[1],
772 "Debug Level for console output was %8.8lX, now %8.8lX\n",
773 Temp, AcpiGbl_DbConsoleDebugLevel);
777 Temp = AcpiGbl_DbDebugLevel;
778 AcpiGbl_DbDebugLevel = ACPI_STRTOUL (AcpiGbl_DbArgs[1], NULL, 16);
780 "Debug Level for file output was %8.8lX, now %8.8lX\n",
781 Temp, AcpiGbl_DbDebugLevel);
786 AcpiDbDisassembleAml (AcpiGbl_DbArgs[1], Op);
790 Status = AcpiDbGetTableFromFile (AcpiGbl_DbArgs[1], NULL);
794 AcpiDbDisplayLocks ();
798 AcpiDbDisplayLocals ();
802 Status = AcpiDbDisplayObjects ("METHOD", AcpiGbl_DbArgs[1]);
806 AcpiDbDumpNamespace (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]);
810 Temp = ACPI_STRTOUL (AcpiGbl_DbArgs[2], NULL, 0);
811 AcpiDbSendNotify (AcpiGbl_DbArgs[1], Temp);
815 AcpiUtStrupr (AcpiGbl_DbArgs[1]);
816 Status = AcpiDbDisplayObjects (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]);
820 AcpiDbOpenDebugFile (AcpiGbl_DbArgs[1]);
824 AcpiDbDumpNamespaceByOwner (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]);
828 AcpiDbCheckPredefinedNames ();
832 AcpiDbSetScope (AcpiGbl_DbArgs[1]);
836 AcpiDbFindReferences (AcpiGbl_DbArgs[1]);
840 AcpiDbDisplayResources (AcpiGbl_DbArgs[1]);
844 AcpiDbDisplayResults ();
848 AcpiDbSetMethodData (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2],
853 Status = AcpiDbSleep (AcpiGbl_DbArgs[1]);
857 Status = AcpiDbDisplayStatistics (AcpiGbl_DbArgs[1]);
861 return (AE_NOT_IMPLEMENTED);
864 AcpiDbDisplayTableInfo (AcpiGbl_DbArgs[1]);
868 AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT);
869 AcpiUtSubsystemShutdown ();
872 * TBD: [Restructure] Need some way to re-initialize without
873 * re-creating the semaphores!
876 /* AcpiInitialize (NULL); */
880 AcpiDbCreateExecutionThreads (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2],
885 (void) AcpiDebugTrace (AcpiGbl_DbArgs[1],0,0,1);
889 AcpiDbDisplayCallingTree ();
893 AcpiDbDisplayObjectType (AcpiGbl_DbArgs[1]);
897 AcpiDbUnloadAcpiTable (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]);
904 AcpiOsPrintf ("Method execution terminated\n");
905 return (AE_CTRL_TERMINATE);
908 if (!AcpiGbl_DbOutputToFile)
910 AcpiDbgLevel = ACPI_DEBUG_DEFAULT;
913 AcpiDbCloseDebugFile ();
914 AcpiGbl_DbTerminateThreads = TRUE;
915 return (AE_CTRL_TERMINATE);
919 AcpiOsPrintf ("Unknown Command\n");
920 return (AE_CTRL_TRUE);
923 if (ACPI_SUCCESS (Status))
925 Status = AE_CTRL_TRUE;
928 /* Add all commands that come here to the history buffer */
930 AcpiDbAddToHistory (InputBuffer);
935 /*******************************************************************************
937 * FUNCTION: AcpiDbExecuteThread
939 * PARAMETERS: Context - Not used
943 * DESCRIPTION: Debugger execute thread. Waits for a command line, then
944 * simply dispatches it.
946 ******************************************************************************/
948 void ACPI_SYSTEM_XFACE
949 AcpiDbExecuteThread (
952 ACPI_STATUS Status = AE_OK;
956 while (Status != AE_CTRL_TERMINATE)
958 AcpiGbl_MethodExecuting = FALSE;
959 AcpiGbl_StepToNextCall = FALSE;
961 MStatus = AcpiUtAcquireMutex (ACPI_MTX_DEBUG_CMD_READY);
962 if (ACPI_FAILURE (MStatus))
967 Status = AcpiDbCommandDispatch (AcpiGbl_DbLineBuf, NULL, NULL);
969 MStatus = AcpiUtReleaseMutex (ACPI_MTX_DEBUG_CMD_COMPLETE);
970 if (ACPI_FAILURE (MStatus))
978 /*******************************************************************************
980 * FUNCTION: AcpiDbSingleThread
986 * DESCRIPTION: Debugger execute thread. Waits for a command line, then
987 * simply dispatches it.
989 ******************************************************************************/
996 AcpiGbl_MethodExecuting = FALSE;
997 AcpiGbl_StepToNextCall = FALSE;
999 (void) AcpiDbCommandDispatch (AcpiGbl_DbLineBuf, NULL, NULL);
1003 /*******************************************************************************
1005 * FUNCTION: AcpiDbUserCommands
1007 * PARAMETERS: Prompt - User prompt (depends on mode)
1008 * Op - Current executing parse op
1012 * DESCRIPTION: Command line execution for the AML debugger. Commands are
1013 * matched and dispatched here.
1015 ******************************************************************************/
1018 AcpiDbUserCommands (
1020 ACPI_PARSE_OBJECT *Op)
1022 ACPI_STATUS Status = AE_OK;
1025 /* TBD: [Restructure] Need a separate command line buffer for step mode */
1027 while (!AcpiGbl_DbTerminateThreads)
1029 /* Force output to console until a command is entered */
1031 AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
1033 /* Different prompt if method is executing */
1035 if (!AcpiGbl_MethodExecuting)
1037 AcpiOsPrintf ("%1c ", ACPI_DEBUGGER_COMMAND_PROMPT);
1041 AcpiOsPrintf ("%1c ", ACPI_DEBUGGER_EXECUTE_PROMPT);
1044 /* Get the user input line */
1046 (void) AcpiOsGetLine (AcpiGbl_DbLineBuf);
1048 /* Check for single or multithreaded debug */
1050 if (AcpiGbl_DebuggerConfiguration & DEBUGGER_MULTI_THREADED)
1053 * Signal the debug thread that we have a command to execute,
1054 * and wait for the command to complete.
1056 Status = AcpiUtReleaseMutex (ACPI_MTX_DEBUG_CMD_READY);
1057 if (ACPI_FAILURE (Status))
1062 Status = AcpiUtAcquireMutex (ACPI_MTX_DEBUG_CMD_COMPLETE);
1063 if (ACPI_FAILURE (Status))
1070 /* Just call to the command line interpreter */
1072 AcpiDbSingleThread ();
1077 * Only this thread (the original thread) should actually terminate the
1078 * subsystem, because all the semaphores are deleted during termination
1080 Status = AcpiTerminate ();
1084 #endif /* ACPI_DEBUGGER */