summaryrefslogtreecommitdiffstats
path: root/sys/contrib/dev/acpica/dbinput.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/contrib/dev/acpica/dbinput.c')
-rw-r--r--sys/contrib/dev/acpica/dbinput.c119
1 files changed, 43 insertions, 76 deletions
diff --git a/sys/contrib/dev/acpica/dbinput.c b/sys/contrib/dev/acpica/dbinput.c
index 5e85c98..e5e938b 100644
--- a/sys/contrib/dev/acpica/dbinput.c
+++ b/sys/contrib/dev/acpica/dbinput.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dbinput - user front-end to the AML debugger
- * $Revision: 72 $
+ * $Revision: 80 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -126,56 +126,14 @@
#ifdef ENABLE_DEBUGGER
#define _COMPONENT ACPI_DEBUGGER
- MODULE_NAME ("dbinput")
+ ACPI_MODULE_NAME ("dbinput")
/*
- * Globals that are specific to the debugger
- */
-
-NATIVE_CHAR AcpiGbl_DbLineBuf[80];
-NATIVE_CHAR AcpiGbl_DbParsedBuf[80];
-NATIVE_CHAR AcpiGbl_DbScopeBuf[40];
-NATIVE_CHAR AcpiGbl_DbDebugFilename[40];
-NATIVE_CHAR *AcpiGbl_DbArgs[DB_MAX_ARGS];
-NATIVE_CHAR *AcpiGbl_DbBuffer = NULL;
-NATIVE_CHAR *AcpiGbl_DbFilename = NULL;
-BOOLEAN AcpiGbl_DbOutputToFile = FALSE;
-
-UINT32 AcpiGbl_DbDebugLevel = ACPI_LV_VERBOSITY2;
-UINT32 AcpiGbl_DbConsoleDebugLevel = NORMAL_DEFAULT | ACPI_LV_TABLES;
-UINT8 AcpiGbl_DbOutputFlags = DB_CONSOLE_OUTPUT;
-
-
-BOOLEAN AcpiGbl_DbOpt_tables = FALSE;
-BOOLEAN AcpiGbl_DbOpt_disasm = FALSE;
-BOOLEAN AcpiGbl_DbOpt_stats = FALSE;
-BOOLEAN AcpiGbl_DbOpt_parse_jit = FALSE;
-BOOLEAN AcpiGbl_DbOpt_verbose = TRUE;
-BOOLEAN AcpiGbl_DbOpt_ini_methods = TRUE;
-
-/*
- * Statistic globals
- */
-UINT16 AcpiGbl_ObjTypeCount[INTERNAL_TYPE_NODE_MAX+1];
-UINT16 AcpiGbl_NodeTypeCount[INTERNAL_TYPE_NODE_MAX+1];
-UINT16 AcpiGbl_ObjTypeCountMisc;
-UINT16 AcpiGbl_NodeTypeCountMisc;
-UINT32 AcpiGbl_NumNodes;
-UINT32 AcpiGbl_NumObjects;
-
-
-UINT32 AcpiGbl_SizeOfParseTree;
-UINT32 AcpiGbl_SizeOfMethodTrees;
-UINT32 AcpiGbl_SizeOfNodeEntries;
-UINT32 AcpiGbl_SizeOfAcpiObjects;
-
-/*
* Top-level debugger commands.
*
* This list of commands must match the string table below it
*/
-
enum AcpiExDebuggerCommands
{
CMD_NOT_FOUND = 0,
@@ -316,13 +274,11 @@ AcpiDbDisplayHelp (
}
-
/*
* Parameter is the command class
*
* The idea here is to keep each class of commands smaller than a screenful
*/
-
switch (HelpType[0])
{
case 'G':
@@ -413,6 +369,7 @@ AcpiDbGetNextToken (
{
NATIVE_CHAR *Start;
+
/* At end of buffer? */
if (!String || !(*String))
@@ -420,7 +377,6 @@ AcpiDbGetNextToken (
return (NULL);
}
-
/* Get rid of any spaces at the beginning */
if (*String == ' ')
@@ -445,12 +401,10 @@ AcpiDbGetNextToken (
String++;
}
-
if (!(*String))
{
*Next = NULL;
}
-
else
{
*String = 0;
@@ -484,11 +438,11 @@ AcpiDbGetLine (
NATIVE_CHAR *This;
- STRCPY (AcpiGbl_DbParsedBuf, InputBuffer);
- STRUPR (AcpiGbl_DbParsedBuf);
+ ACPI_STRCPY (AcpiGbl_DbParsedBuf, InputBuffer);
+ ACPI_STRUPR (AcpiGbl_DbParsedBuf);
This = AcpiGbl_DbParsedBuf;
- for (i = 0; i < DB_MAX_ARGS; i++)
+ for (i = 0; i < ACPI_DEBUGGER_MAX_ARGS; i++)
{
AcpiGbl_DbArgs[i] = AcpiDbGetNextToken (This, &Next);
if (!AcpiGbl_DbArgs[i])
@@ -499,12 +453,11 @@ AcpiDbGetLine (
This = Next;
}
-
/* Uppercase the actual command */
if (AcpiGbl_DbArgs[0])
{
- STRUPR (AcpiGbl_DbArgs[0]);
+ ACPI_STRUPR (AcpiGbl_DbArgs[0]);
}
Count = i;
@@ -543,7 +496,8 @@ AcpiDbMatchCommand (
for (i = CMD_FIRST_VALID; AcpiGbl_DbCommands[i].Name; i++)
{
- if (STRSTR (AcpiGbl_DbCommands[i].Name, UserCommand) == AcpiGbl_DbCommands[i].Name)
+ if (ACPI_STRSTR (AcpiGbl_DbCommands[i].Name, UserCommand) ==
+ AcpiGbl_DbCommands[i].Name)
{
return (i);
}
@@ -693,7 +647,6 @@ AcpiDbCommandDispatch (
Status = AE_CTRL_TRUE;
}
return (Status);
- break;
case CMD_HISTORY_LAST:
CommandLine = AcpiDbGetFromHistory (NULL);
@@ -717,9 +670,6 @@ AcpiDbCommandDispatch (
if (Op)
{
AcpiGbl_CmSingleStep = TRUE;
-
-/* TBD: Must get current walk state */
- /* AcpiGbl_MethodBreakpoint = 0; */
return (AE_OK);
}
break;
@@ -733,13 +683,13 @@ AcpiDbCommandDispatch (
else if (ParamCount == 2)
{
Temp = AcpiGbl_DbConsoleDebugLevel;
- AcpiGbl_DbConsoleDebugLevel = STRTOUL (AcpiGbl_DbArgs[1], NULL, 16);
+ AcpiGbl_DbConsoleDebugLevel = ACPI_STRTOUL (AcpiGbl_DbArgs[1], NULL, 16);
AcpiOsPrintf ("Debug Level for console output was %8.8lX, now %8.8lX\n", Temp, AcpiGbl_DbConsoleDebugLevel);
}
else
{
Temp = AcpiGbl_DbDebugLevel;
- AcpiGbl_DbDebugLevel = STRTOUL (AcpiGbl_DbArgs[1], NULL, 16);
+ AcpiGbl_DbDebugLevel = ACPI_STRTOUL (AcpiGbl_DbArgs[1], NULL, 16);
AcpiOsPrintf ("Debug Level for file output was %8.8lX, now %8.8lX\n", Temp, AcpiGbl_DbDebugLevel);
}
break;
@@ -773,12 +723,12 @@ AcpiDbCommandDispatch (
break;
case CMD_NOTIFY:
- Temp = STRTOUL (AcpiGbl_DbArgs[2], NULL, 0);
+ Temp = ACPI_STRTOUL (AcpiGbl_DbArgs[2], NULL, 0);
AcpiDbSendNotify (AcpiGbl_DbArgs[1], Temp);
break;
case CMD_OBJECT:
- AcpiDbDisplayObjects (STRUPR (AcpiGbl_DbArgs[1]), AcpiGbl_DbArgs[2]);
+ AcpiDbDisplayObjects (ACPI_STRUPR (AcpiGbl_DbArgs[1]), AcpiGbl_DbArgs[2]);
break;
case CMD_OPEN:
@@ -815,14 +765,13 @@ AcpiDbCommandDispatch (
case CMD_STOP:
return (AE_AML_ERROR);
- break;
case CMD_TABLES:
AcpiDbDisplayTableInfo (AcpiGbl_DbArgs[1]);
break;
case CMD_TERMINATE:
- AcpiDbSetOutputDestination (DB_REDIRECTABLE_OUTPUT);
+ AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT);
AcpiUtSubsystemShutdown ();
/* TBD: [Restructure] Need some way to re-initialize without re-creating the semaphores! */
@@ -895,6 +844,7 @@ AcpiDbExecuteThread (
void *Context)
{
ACPI_STATUS Status = AE_OK;
+ ACPI_STATUS MStatus;
while (Status != AE_CTRL_TERMINATE)
@@ -902,9 +852,19 @@ AcpiDbExecuteThread (
AcpiGbl_MethodExecuting = FALSE;
AcpiGbl_StepToNextCall = FALSE;
- AcpiUtAcquireMutex (ACPI_MTX_DEBUG_CMD_READY);
+ MStatus = AcpiUtAcquireMutex (ACPI_MTX_DEBUG_CMD_READY);
+ if (ACPI_FAILURE (MStatus))
+ {
+ return;
+ }
+
Status = AcpiDbCommandDispatch (AcpiGbl_DbLineBuf, NULL, NULL);
- AcpiUtReleaseMutex (ACPI_MTX_DEBUG_CMD_COMPLETE);
+
+ MStatus = AcpiUtReleaseMutex (ACPI_MTX_DEBUG_CMD_COMPLETE);
+ if (ACPI_FAILURE (MStatus))
+ {
+ return;
+ }
}
}
@@ -926,7 +886,7 @@ void
AcpiDbSingleThread (
void)
{
- ACPI_STATUS Status = AE_OK;
+ ACPI_STATUS Status;
AcpiGbl_MethodExecuting = FALSE;
@@ -964,17 +924,17 @@ AcpiDbUserCommands (
{
/* Force output to console until a command is entered */
- AcpiDbSetOutputDestination (DB_CONSOLE_OUTPUT);
+ AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
/* Different prompt if method is executing */
if (!AcpiGbl_MethodExecuting)
{
- AcpiOsPrintf ("%1c ", DB_COMMAND_PROMPT);
+ AcpiOsPrintf ("%1c ", ACPI_DEBUGGER_COMMAND_PROMPT);
}
else
{
- AcpiOsPrintf ("%1c ", DB_EXECUTE_PROMPT);
+ AcpiOsPrintf ("%1c ", ACPI_DEBUGGER_EXECUTE_PROMPT);
}
/* Get the user input line */
@@ -990,10 +950,18 @@ AcpiDbUserCommands (
* Signal the debug thread that we have a command to execute,
* and wait for the command to complete.
*/
- AcpiUtReleaseMutex (ACPI_MTX_DEBUG_CMD_READY);
- AcpiUtAcquireMutex (ACPI_MTX_DEBUG_CMD_COMPLETE);
+ Status = AcpiUtReleaseMutex (ACPI_MTX_DEBUG_CMD_READY);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ Status = AcpiUtAcquireMutex (ACPI_MTX_DEBUG_CMD_COMPLETE);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
}
-
else
{
/* Just call to the command line interpreter */
@@ -1002,7 +970,6 @@ AcpiDbUserCommands (
}
}
-
/*
* Only this thread (the original thread) should actually terminate the subsystem,
* because all the semaphores are deleted during termination
OpenPOWER on IntegriCloud