summaryrefslogtreecommitdiffstats
path: root/sys/contrib/dev/acpica/components/debugger/dbinput.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/contrib/dev/acpica/components/debugger/dbinput.c')
-rw-r--r--sys/contrib/dev/acpica/components/debugger/dbinput.c260
1 files changed, 146 insertions, 114 deletions
diff --git a/sys/contrib/dev/acpica/components/debugger/dbinput.c b/sys/contrib/dev/acpica/components/debugger/dbinput.c
index 630f399..447f5d2 100644
--- a/sys/contrib/dev/acpica/components/debugger/dbinput.c
+++ b/sys/contrib/dev/acpica/components/debugger/dbinput.c
@@ -46,11 +46,10 @@
#include <contrib/dev/acpica/include/acdebug.h>
-#ifdef ACPI_DEBUGGER
-
#define _COMPONENT ACPI_CA_DEBUGGER
ACPI_MODULE_NAME ("dbinput")
+
/* Local prototypes */
static UINT32
@@ -95,20 +94,15 @@ enum AcpiExDebuggerCommands
CMD_BREAKPOINT,
CMD_BUSINFO,
CMD_CALL,
- CMD_CLOSE,
CMD_DEBUG,
CMD_DISASSEMBLE,
CMD_DISASM,
CMD_DUMP,
- CMD_ENABLEACPI,
CMD_EVALUATE,
- CMD_EVENT,
CMD_EXECUTE,
CMD_EXIT,
CMD_FIND,
CMD_GO,
- CMD_GPE,
- CMD_GPES,
CMD_HANDLERS,
CMD_HELP,
CMD_HELP2,
@@ -120,37 +114,47 @@ enum AcpiExDebuggerCommands
CMD_INTO,
CMD_LEVEL,
CMD_LIST,
- CMD_LOAD,
CMD_LOCALS,
CMD_LOCKS,
CMD_METHODS,
CMD_NAMESPACE,
CMD_NOTIFY,
CMD_OBJECTS,
- CMD_OPEN,
CMD_OSI,
CMD_OWNER,
CMD_PATHS,
- CMD_PREDEFINED,
CMD_PREFIX,
CMD_QUIT,
CMD_REFERENCES,
CMD_RESOURCES,
CMD_RESULTS,
- CMD_SCI,
CMD_SET,
- CMD_SLEEP,
CMD_STATS,
CMD_STOP,
CMD_TABLES,
CMD_TEMPLATE,
- CMD_TERMINATE,
- CMD_TEST,
- CMD_THREADS,
CMD_TRACE,
CMD_TREE,
CMD_TYPE,
- CMD_UNLOAD
+#ifdef ACPI_APPLICATION
+ CMD_ENABLEACPI,
+ CMD_EVENT,
+ CMD_GPE,
+ CMD_GPES,
+ CMD_SCI,
+ CMD_SLEEP,
+
+ CMD_CLOSE,
+ CMD_LOAD,
+ CMD_OPEN,
+ CMD_UNLOAD,
+
+ CMD_TERMINATE,
+ CMD_THREADS,
+
+ CMD_PREDEFINED,
+ CMD_TEST,
+#endif
};
#define CMD_FIRST_VALID 2
@@ -168,20 +172,15 @@ static const ACPI_DB_COMMAND_INFO AcpiGbl_DbCommands[] =
{"BREAKPOINT", 1},
{"BUSINFO", 0},
{"CALL", 0},
- {"CLOSE", 0},
{"DEBUG", 1},
{"DISASSEMBLE", 1},
{"DISASM", 1},
{"DUMP", 1},
- {"ENABLEACPI", 0},
{"EVALUATE", 1},
- {"EVENT", 1},
{"EXECUTE", 1},
{"EXIT", 0},
{"FIND", 1},
{"GO", 0},
- {"GPE", 1},
- {"GPES", 0},
{"HANDLERS", 0},
{"HELP", 0},
{"?", 0},
@@ -193,37 +192,47 @@ static const ACPI_DB_COMMAND_INFO AcpiGbl_DbCommands[] =
{"INTO", 0},
{"LEVEL", 0},
{"LIST", 0},
- {"LOAD", 1},
{"LOCALS", 0},
{"LOCKS", 0},
{"METHODS", 0},
{"NAMESPACE", 0},
{"NOTIFY", 2},
- {"OBJECTS", 1},
- {"OPEN", 1},
+ {"OBJECTS", 0},
{"OSI", 0},
{"OWNER", 1},
{"PATHS", 0},
- {"PREDEFINED", 0},
{"PREFIX", 0},
{"QUIT", 0},
{"REFERENCES", 1},
{"RESOURCES", 0},
{"RESULTS", 0},
- {"SCI", 0},
{"SET", 3},
- {"SLEEP", 0},
{"STATS", 1},
{"STOP", 0},
{"TABLES", 0},
{"TEMPLATE", 1},
- {"TERMINATE", 0},
- {"TEST", 1},
- {"THREADS", 3},
{"TRACE", 1},
{"TREE", 0},
{"TYPE", 1},
+#ifdef ACPI_APPLICATION
+ {"ENABLEACPI", 0},
+ {"EVENT", 1},
+ {"GPE", 1},
+ {"GPES", 0},
+ {"SCI", 0},
+ {"SLEEP", 0},
+
+ {"CLOSE", 0},
+ {"LOAD", 1},
+ {"OPEN", 1},
{"UNLOAD", 1},
+
+ {"TERMINATE", 0},
+ {"THREADS", 3},
+
+ {"PREDEFINED", 0},
+ {"TEST", 1},
+#endif
{NULL, 0}
};
@@ -237,7 +246,6 @@ static const ACPI_DB_COMMAND_HELP AcpiGbl_DbCommandHelp[] =
{1, " Allocations", "Display list of current memory allocations\n"},
{2, " Dump <Address>|<Namepath>", "\n"},
{0, " [Byte|Word|Dword|Qword]", "Display ACPI objects or memory\n"},
- {1, " EnableAcpi", "Enable ACPI (hardware) mode\n"},
{1, " Handlers", "Info about global handlers\n"},
{1, " Help [Command]", "This help screen or individual command\n"},
{1, " History", "Display command history buffer\n"},
@@ -254,7 +262,6 @@ static const ACPI_DB_COMMAND_HELP AcpiGbl_DbCommandHelp[] =
{1, " Stack", "Display CPU stack usage\n"},
{1, " Tables", "Info about current ACPI table(s)\n"},
{1, " Tables", "Display info about loaded ACPI tables\n"},
- {1, " Unload <Namepath>", "Unload an ACPI table via namespace object\n"},
{1, " ! <CommandNumber>", "Execute command from history buffer\n"},
{1, " !!", "Execute last command again\n"},
@@ -266,7 +273,7 @@ static const ACPI_DB_COMMAND_HELP AcpiGbl_DbCommandHelp[] =
{1, " Methods", "Display list of loaded control methods\n"},
{1, " Namespace [Object] [Depth]", "Display loaded namespace tree/subtree\n"},
{1, " Notify <Object> <Value>", "Send a notification on Object\n"},
- {1, " Objects <ObjectType>", "Display all objects of the given type\n"},
+ {1, " Objects [ObjectType]", "Display summary of all objects or just given type\n"},
{1, " Owner <OwnerId> [Depth]", "Display loaded namespace by object owner\n"},
{1, " Paths", "Display full pathnames of namespace objects\n"},
{1, " Predefined", "Check all predefined names\n"},
@@ -275,7 +282,6 @@ static const ACPI_DB_COMMAND_HELP AcpiGbl_DbCommandHelp[] =
{1, " Resources [DeviceName]", "Display Device resources (no arg = all devices)\n"},
{1, " Set N <NamedObject> <Value>", "Set value for named integer\n"},
{1, " Template <Object>", "Format/dump a Buffer/ResourceTemplate\n"},
- {1, " Terminate", "Delete namespace and all internal objects\n"},
{1, " Type <Object>", "Display object type\n"},
{0, "\nControl Method Execution Commands:","\n"},
@@ -297,7 +303,6 @@ static const ACPI_DB_COMMAND_HELP AcpiGbl_DbCommandHelp[] =
{1, " Results", "Display method result stack\n"},
{1, " Set <A|L> <#> <Value>", "Set method data (Arguments/Locals)\n"},
{1, " Stop", "Terminate control method\n"},
- {1, " Thread <Threads><Loops><Namepath>", "Spawn threads to execute method(s)\n"},
{5, " Trace <State> [<Namepath>] [Once]", "Trace control method execution\n"},
{1, " Enable", "Enable all messages\n"},
{1, " Disable", "Disable tracing\n"},
@@ -306,10 +311,12 @@ static const ACPI_DB_COMMAND_HELP AcpiGbl_DbCommandHelp[] =
{1, " Tree", "Display control method calling tree\n"},
{1, " <Enter>", "Single step next AML opcode (over calls)\n"},
- {0, "\nHardware Related Commands:", "\n"},
+#ifdef ACPI_APPLICATION
+ {0, "\nHardware Simulation Commands:", "\n"},
+ {1, " EnableAcpi", "Enable ACPI (hardware) mode\n"},
{1, " Event <F|G> <Value>", "Generate AcpiEvent (Fixed/GPE)\n"},
{1, " Gpe <GpeNum> [GpeBlockDevice]", "Simulate a GPE\n"},
- {1, " Gpes", "Display info on all GPEs\n"},
+ {1, " Gpes", "Display info on all GPE devices\n"},
{1, " Sci", "Generate an SCI\n"},
{1, " Sleep [SleepState]", "Simulate sleep/wake sequence(s) (0-5)\n"},
@@ -317,11 +324,17 @@ static const ACPI_DB_COMMAND_HELP AcpiGbl_DbCommandHelp[] =
{1, " Close", "Close debug output file\n"},
{1, " Load <Input Filename>", "Load ACPI table from a file\n"},
{1, " Open <Output Filename>", "Open a file for debug output\n"},
+ {1, " Unload <Namepath>", "Unload an ACPI table via namespace object\n"},
+
+ {0, "\nUser Space Commands:", "\n"},
+ {1, " Terminate", "Delete namespace and all internal objects\n"},
+ {1, " Thread <Threads><Loops><NamePath>", "Spawn threads to execute method(s)\n"},
{0, "\nDebug Test Commands:", "\n"},
{3, " Test <TestName>", "Invoke a debug test\n"},
{1, " Objects", "Read/write/compare all namespace data objects\n"},
{1, " Predefined", "Execute all ACPI predefined names (_STA, etc.)\n"},
+#endif
{0, NULL, NULL}
};
@@ -645,7 +658,8 @@ AcpiDbGetLine (
if (AcpiUtSafeStrcpy (AcpiGbl_DbParsedBuf, sizeof (AcpiGbl_DbParsedBuf),
InputBuffer))
{
- AcpiOsPrintf ("Buffer overflow while parsing input line (max %u characters)\n",
+ AcpiOsPrintf (
+ "Buffer overflow while parsing input line (max %u characters)\n",
sizeof (AcpiGbl_DbParsedBuf));
return (0);
}
@@ -707,7 +721,7 @@ AcpiDbMatchCommand (
for (i = CMD_FIRST_VALID; AcpiGbl_DbCommands[i].Name; i++)
{
if (strstr (AcpiGbl_DbCommands[i].Name, UserCommand) ==
- AcpiGbl_DbCommands[i].Name)
+ AcpiGbl_DbCommands[i].Name)
{
return (i);
}
@@ -777,7 +791,8 @@ AcpiDbCommandDispatch (
ParamCount, AcpiGbl_DbCommands[CommandIndex].Name,
AcpiGbl_DbCommands[CommandIndex].MinArgs);
- AcpiDbDisplayCommandInfo (AcpiGbl_DbCommands[CommandIndex].Name, FALSE);
+ AcpiDbDisplayCommandInfo (
+ AcpiGbl_DbCommands[CommandIndex].Name, FALSE);
return (AE_CTRL_TRUE);
}
@@ -822,11 +837,6 @@ AcpiDbCommandDispatch (
Status = AE_OK;
break;
- case CMD_CLOSE:
-
- AcpiDbCloseDebugFile ();
- break;
-
case CMD_DEBUG:
AcpiDbExecute (AcpiGbl_DbArgs[1],
@@ -844,23 +854,6 @@ AcpiDbCommandDispatch (
AcpiDbDecodeAndDisplayObject (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]);
break;
- case CMD_ENABLEACPI:
-#if (!ACPI_REDUCED_HARDWARE)
-
- Status = AcpiEnable();
- if (ACPI_FAILURE(Status))
- {
- AcpiOsPrintf("AcpiEnable failed (Status=%X)\n", Status);
- return (Status);
- }
-#endif /* !ACPI_REDUCED_HARDWARE */
- break;
-
- case CMD_EVENT:
-
- AcpiOsPrintf ("Event command not implemented\n");
- break;
-
case CMD_EVALUATE:
case CMD_EXECUTE:
@@ -878,16 +871,6 @@ AcpiDbCommandDispatch (
AcpiGbl_CmSingleStep = FALSE;
return (AE_OK);
- case CMD_GPE:
-
- AcpiDbGenerateGpe (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]);
- break;
-
- case CMD_GPES:
-
- AcpiDbDisplayGpes ();
- break;
-
case CMD_HANDLERS:
AcpiDbDisplayHandlers ();
@@ -949,9 +932,11 @@ AcpiDbCommandDispatch (
if (ParamCount == 0)
{
- AcpiOsPrintf ("Current debug level for file output is: %8.8lX\n",
+ AcpiOsPrintf (
+ "Current debug level for file output is: %8.8lX\n",
AcpiGbl_DbDebugLevel);
- AcpiOsPrintf ("Current debug level for console output is: %8.8lX\n",
+ AcpiOsPrintf (
+ "Current debug level for console output is: %8.8lX\n",
AcpiGbl_DbConsoleDebugLevel);
}
else if (ParamCount == 2)
@@ -978,11 +963,6 @@ AcpiDbCommandDispatch (
AcpiDbDisassembleAml (AcpiGbl_DbArgs[1], Op);
break;
- case CMD_LOAD:
-
- Status = AcpiDbGetTableFromFile (AcpiGbl_DbArgs[1], NULL, FALSE);
- break;
-
case CMD_LOCKS:
AcpiDbDisplayLocks ();
@@ -1015,11 +995,6 @@ AcpiDbCommandDispatch (
Status = AcpiDbDisplayObjects (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]);
break;
- case CMD_OPEN:
-
- AcpiDbOpenDebugFile (AcpiGbl_DbArgs[1]);
- break;
-
case CMD_OSI:
AcpiDbDisplayInterfaces (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]);
@@ -1035,11 +1010,6 @@ AcpiDbCommandDispatch (
AcpiDbDumpNamespacePaths ();
break;
- case CMD_PREDEFINED:
-
- AcpiDbCheckPredefinedNames ();
- break;
-
case CMD_PREFIX:
AcpiDbSetScope (AcpiGbl_DbArgs[1]);
@@ -1060,22 +1030,12 @@ AcpiDbCommandDispatch (
AcpiDbDisplayResults ();
break;
- case CMD_SCI:
-
- AcpiDbGenerateSci ();
- break;
-
case CMD_SET:
AcpiDbSetMethodData (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2],
AcpiGbl_DbArgs[3]);
break;
- case CMD_SLEEP:
-
- Status = AcpiDbSleep (AcpiGbl_DbArgs[1]);
- break;
-
case CMD_STATS:
Status = AcpiDbDisplayStatistics (AcpiGbl_DbArgs[1]);
@@ -1095,6 +1055,81 @@ AcpiDbCommandDispatch (
AcpiDbDisplayTemplate (AcpiGbl_DbArgs[1]);
break;
+ case CMD_TRACE:
+
+ AcpiDbTrace (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2], AcpiGbl_DbArgs[3]);
+ break;
+
+ case CMD_TREE:
+
+ AcpiDbDisplayCallingTree ();
+ break;
+
+ case CMD_TYPE:
+
+ AcpiDbDisplayObjectType (AcpiGbl_DbArgs[1]);
+ break;
+
+#ifdef ACPI_APPLICATION
+
+ /* Hardware simulation commands. */
+
+ case CMD_ENABLEACPI:
+#if (!ACPI_REDUCED_HARDWARE)
+
+ Status = AcpiEnable();
+ if (ACPI_FAILURE(Status))
+ {
+ AcpiOsPrintf("AcpiEnable failed (Status=%X)\n", Status);
+ return (Status);
+ }
+#endif /* !ACPI_REDUCED_HARDWARE */
+ break;
+
+ case CMD_EVENT:
+
+ AcpiOsPrintf ("Event command not implemented\n");
+ break;
+
+ case CMD_GPE:
+
+ AcpiDbGenerateGpe (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]);
+ break;
+
+ case CMD_GPES:
+
+ AcpiDbDisplayGpes ();
+ break;
+
+ case CMD_SCI:
+
+ AcpiDbGenerateSci ();
+ break;
+
+ case CMD_SLEEP:
+
+ Status = AcpiDbSleep (AcpiGbl_DbArgs[1]);
+ break;
+
+ /* File I/O commands. */
+
+ case CMD_CLOSE:
+
+ AcpiDbCloseDebugFile ();
+ break;
+
+ case CMD_LOAD:
+
+ Status = AcpiDbGetTableFromFile (AcpiGbl_DbArgs[1], NULL, FALSE);
+ break;
+
+ case CMD_OPEN:
+
+ AcpiDbOpenDebugFile (AcpiGbl_DbArgs[1]);
+ break;
+
+ /* User space commands. */
+
case CMD_TERMINATE:
AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT);
@@ -1108,36 +1143,29 @@ AcpiDbCommandDispatch (
/* AcpiInitialize (NULL); */
break;
- case CMD_TEST:
-
- AcpiDbExecuteTest (AcpiGbl_DbArgs[1]);
- break;
-
case CMD_THREADS:
AcpiDbCreateExecutionThreads (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2],
AcpiGbl_DbArgs[3]);
break;
- case CMD_TRACE:
-
- AcpiDbTrace (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2], AcpiGbl_DbArgs[3]);
- break;
+ /* Debug test commands. */
- case CMD_TREE:
+ case CMD_PREDEFINED:
- AcpiDbDisplayCallingTree ();
+ AcpiDbCheckPredefinedNames ();
break;
- case CMD_TYPE:
+ case CMD_TEST:
- AcpiDbDisplayObjectType (AcpiGbl_DbArgs[1]);
+ AcpiDbExecuteTest (AcpiGbl_DbArgs[1]);
break;
case CMD_UNLOAD:
AcpiDbUnloadAcpiTable (AcpiGbl_DbArgs[1]);
break;
+#endif
case CMD_EXIT:
case CMD_QUIT:
@@ -1153,7 +1181,9 @@ AcpiDbCommandDispatch (
AcpiDbgLevel = ACPI_DEBUG_DEFAULT;
}
+#ifdef ACPI_APPLICATION
AcpiDbCloseDebugFile ();
+#endif
AcpiGbl_DbTerminateThreads = TRUE;
return (AE_CTRL_TERMINATE);
@@ -1322,6 +1352,10 @@ AcpiDbUserCommands (
}
}
+ /* Shut down the debugger */
+
+ AcpiTerminateDebugger ();
+
/*
* Only this thread (the original thread) should actually terminate the
* subsystem, because all the semaphores are deleted during termination
@@ -1329,5 +1363,3 @@ AcpiDbUserCommands (
Status = AcpiTerminate ();
return (Status);
}
-
-#endif /* ACPI_DEBUGGER */
OpenPOWER on IntegriCloud