From fba7fc7e34e95963b681b882698b951b35d1ba48 Mon Sep 17 00:00:00 2001 From: Jung-uk Kim Date: Tue, 1 Nov 2005 22:11:18 +0000 Subject: Vendor import of Intel ACPI-CA 20051021 --- sys/contrib/dev/acpica/dbinput.c | 136 +++++++++++++++++++++++++-------------- 1 file changed, 87 insertions(+), 49 deletions(-) (limited to 'sys/contrib/dev/acpica/dbinput.c') diff --git a/sys/contrib/dev/acpica/dbinput.c b/sys/contrib/dev/acpica/dbinput.c index 7f3a968b665a..4b27946872ac 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: 101 $ + * $Revision: 1.111 $ * ******************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp. * All rights reserved. * * 2. License @@ -124,6 +124,29 @@ #define _COMPONENT ACPI_CA_DEBUGGER ACPI_MODULE_NAME ("dbinput") +/* Local prototypes */ + +static char * +AcpiDbGetNextToken ( + char *String, + char **Next); + +static UINT32 +AcpiDbGetLine ( + char *InputBuffer); + +static UINT32 +AcpiDbMatchCommand ( + char *UserCommand); + +static void +AcpiDbSingleThread ( + void); + +static void +AcpiDbDisplayHelp ( + char *HelpType); + /* * Top-level debugger commands. @@ -138,6 +161,7 @@ enum AcpiExDebuggerCommands CMD_ARGS, CMD_ARGUMENTS, CMD_BREAKPOINT, + CMD_BUSINFO, CMD_CALL, CMD_CLOSE, CMD_DEBUG, @@ -182,6 +206,7 @@ enum AcpiExDebuggerCommands CMD_TABLES, CMD_TERMINATE, CMD_THREADS, + CMD_TRACE, CMD_TREE, CMD_TYPE, CMD_UNLOAD @@ -189,7 +214,6 @@ enum AcpiExDebuggerCommands #define CMD_FIRST_VALID 2 - static const COMMAND_INFO AcpiGbl_DbCommands[] = { {"", 0}, @@ -198,6 +222,7 @@ static const COMMAND_INFO AcpiGbl_DbCommands[] = {"ARGS", 0}, {"ARGUMENTS", 0}, {"BREAKPOINT", 1}, + {"BUSINFO", 0}, {"CALL", 0}, {"CLOSE", 0}, {"DEBUG", 1}, @@ -242,6 +267,7 @@ static const COMMAND_INFO AcpiGbl_DbCommands[] = {"TABLES", 0}, {"TERMINATE", 0}, {"THREADS", 3}, + {"TRACE", 1}, {"TREE", 0}, {"TYPE", 1}, {"UNLOAD", 1}, @@ -261,11 +287,12 @@ static const COMMAND_INFO AcpiGbl_DbCommands[] = * ******************************************************************************/ -void +static void AcpiDbDisplayHelp ( char *HelpType) { + AcpiUtStrupr (HelpType); /* No parameter, just give the overview */ @@ -321,20 +348,22 @@ AcpiDbDisplayHelp ( case 'N': AcpiOsPrintf ("\nNamespace Access Commands\n\n"); + AcpiOsPrintf ("Businfo Display system bus info\n"); AcpiOsPrintf ("Disassemble Disassemble a control method\n"); AcpiOsPrintf ("Event Generate AcpiEvent (Fixed/GPE)\n"); - AcpiOsPrintf ("Find (? is wildcard) Find ACPI name(s) with wildcards\n"); + AcpiOsPrintf ("Find (? is wildcard) Find ACPI name(s) with wildcards\n"); AcpiOsPrintf ("Gpe Simulate a GPE\n"); AcpiOsPrintf ("Gpes Display info on all GPEs\n"); AcpiOsPrintf ("Integrity Validate namespace integrity\n"); - AcpiOsPrintf ("Method Display list of loaded control methods\n"); - AcpiOsPrintf ("Namespace [|] [Depth] Display loaded namespace tree/subtree\n"); - AcpiOsPrintf ("Notify Send a notification\n"); + AcpiOsPrintf ("Methods Display list of loaded control methods\n"); + AcpiOsPrintf ("Namespace [Object] [Depth] Display loaded namespace tree/subtree\n"); + AcpiOsPrintf ("Notify Send a notification on Object\n"); AcpiOsPrintf ("Objects Display all objects of the given type\n"); AcpiOsPrintf ("Owner [Depth] Display loaded namespace by object owner\n"); AcpiOsPrintf ("Prefix [] Set or Get current execution prefix\n"); AcpiOsPrintf ("References Find all references to object at addr\n"); - AcpiOsPrintf ("Resources xxx Get and display resources\n"); + AcpiOsPrintf ("Resources Get and display Device resources\n"); + AcpiOsPrintf ("Set N Set value for named integer\n"); AcpiOsPrintf ("Sleep Simulate sleep/wake sequence\n"); AcpiOsPrintf ("Terminate Delete namespace and all internal objects\n"); AcpiOsPrintf ("Thread Spawn threads to execute method(s)\n"); @@ -356,6 +385,7 @@ AcpiDbDisplayHelp ( AcpiOsPrintf ("Results Display method result stack\n"); AcpiOsPrintf ("Set <#> Set method data (Arguments/Locals)\n"); AcpiOsPrintf ("Stop Terminate control method\n"); + AcpiOsPrintf ("Trace Trace method execution\n"); AcpiOsPrintf ("Tree Display control method calling tree\n"); AcpiOsPrintf (" Single step next AML opcode (over calls)\n"); return; @@ -387,7 +417,7 @@ AcpiDbDisplayHelp ( * ******************************************************************************/ -char * +static char * AcpiDbGetNextToken ( char *String, char **Next) @@ -446,14 +476,14 @@ AcpiDbGetNextToken ( * * PARAMETERS: InputBuffer - Command line buffer * - * RETURN: None + * RETURN: Count of arguments to the command * * DESCRIPTION: Get the next command line from the user. Gets entire line * up to the next newline * ******************************************************************************/ -UINT32 +static UINT32 AcpiDbGetLine ( char *InputBuffer) { @@ -464,7 +494,6 @@ AcpiDbGetLine ( ACPI_STRCPY (AcpiGbl_DbParsedBuf, InputBuffer); - ACPI_STRUPR (AcpiGbl_DbParsedBuf); This = AcpiGbl_DbParsedBuf; for (i = 0; i < ACPI_DEBUGGER_MAX_ARGS; i++) @@ -482,7 +511,7 @@ AcpiDbGetLine ( if (AcpiGbl_DbArgs[0]) { - ACPI_STRUPR (AcpiGbl_DbArgs[0]); + AcpiUtStrupr (AcpiGbl_DbArgs[0]); } Count = i; @@ -507,7 +536,7 @@ AcpiDbGetLine ( * ******************************************************************************/ -UINT32 +static UINT32 AcpiDbMatchCommand ( char *UserCommand) { @@ -544,7 +573,7 @@ AcpiDbMatchCommand ( * * RETURN: Status * - * DESCRIPTION: Command dispatcher. Called from two places: + * DESCRIPTION: Command dispatcher. * ******************************************************************************/ @@ -577,7 +606,9 @@ AcpiDbCommandDispatch ( if (ParamCount < AcpiGbl_DbCommands[CommandIndex].MinArgs) { AcpiOsPrintf ("%d parameters entered, [%s] requires %d parameters\n", - ParamCount, AcpiGbl_DbCommands[CommandIndex].Name, AcpiGbl_DbCommands[CommandIndex].MinArgs); + ParamCount, AcpiGbl_DbCommands[CommandIndex].Name, + AcpiGbl_DbCommands[CommandIndex].MinArgs); + return (AE_CTRL_TRUE); } @@ -608,6 +639,10 @@ AcpiDbCommandDispatch ( AcpiDbSetMethodBreakpoint (AcpiGbl_DbArgs[1], WalkState, Op); break; + case CMD_BUSINFO: + AcpiDbGetBusInfo (); + break; + case CMD_CALL: AcpiDbSetMethodCallBreakpoint (Op); Status = AE_OK; @@ -622,7 +657,7 @@ AcpiDbCommandDispatch ( break; case CMD_DISASSEMBLE: - AcpiDbDisassembleMethod (AcpiGbl_DbArgs[1]); + (void) AcpiDbDisassembleMethod (AcpiGbl_DbArgs[1]); break; case CMD_DUMP: @@ -643,7 +678,8 @@ AcpiDbCommandDispatch ( break; case CMD_EXECUTE: - AcpiDbExecute (AcpiGbl_DbArgs[1], &AcpiGbl_DbArgs[2], EX_NO_SINGLE_STEP); + AcpiDbExecute (AcpiGbl_DbArgs[1], + &AcpiGbl_DbArgs[2], EX_NO_SINGLE_STEP); break; case CMD_FIND: @@ -679,10 +715,6 @@ AcpiDbCommandDispatch ( } Status = AcpiDbCommandDispatch (CommandLine, WalkState, Op); - if (ACPI_SUCCESS (Status)) - { - Status = AE_CTRL_TRUE; - } return (Status); case CMD_HISTORY_LAST: @@ -693,10 +725,6 @@ AcpiDbCommandDispatch ( } Status = AcpiDbCommandDispatch (CommandLine, WalkState, Op); - if (ACPI_SUCCESS (Status)) - { - Status = AE_CTRL_TRUE; - } return (Status); case CMD_INFORMATION: @@ -718,20 +746,27 @@ AcpiDbCommandDispatch ( case CMD_LEVEL: if (ParamCount == 0) { - AcpiOsPrintf ("Current debug level for file output is: %8.8lX\n", AcpiGbl_DbDebugLevel); - AcpiOsPrintf ("Current debug level for console output is: %8.8lX\n", AcpiGbl_DbConsoleDebugLevel); + AcpiOsPrintf ("Current debug level for file output is: %8.8lX\n", + AcpiGbl_DbDebugLevel); + AcpiOsPrintf ("Current debug level for console output is: %8.8lX\n", + AcpiGbl_DbConsoleDebugLevel); } else if (ParamCount == 2) { Temp = AcpiGbl_DbConsoleDebugLevel; - 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); + 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 = ACPI_STRTOUL (AcpiGbl_DbArgs[1], NULL, 16); - AcpiOsPrintf ("Debug Level for file output was %8.8lX, now %8.8lX\n", Temp, AcpiGbl_DbDebugLevel); + AcpiOsPrintf ( + "Debug Level for file output was %8.8lX, now %8.8lX\n", + Temp, AcpiGbl_DbDebugLevel); } break; @@ -741,10 +776,6 @@ AcpiDbCommandDispatch ( case CMD_LOAD: Status = AcpiDbGetTableFromFile (AcpiGbl_DbArgs[1], NULL); - if (ACPI_FAILURE (Status)) - { - return (Status); - } break; case CMD_LOCKS: @@ -769,7 +800,7 @@ AcpiDbCommandDispatch ( break; case CMD_OBJECT: - ACPI_STRUPR (AcpiGbl_DbArgs[1]); + AcpiUtStrupr (AcpiGbl_DbArgs[1]); Status = AcpiDbDisplayObjects (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]); break; @@ -798,7 +829,8 @@ AcpiDbCommandDispatch ( break; case CMD_SET: - AcpiDbSetMethodData (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2], AcpiGbl_DbArgs[3]); + AcpiDbSetMethodData (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2], + AcpiGbl_DbArgs[3]); break; case CMD_SLEEP: @@ -820,13 +852,21 @@ AcpiDbCommandDispatch ( AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT); AcpiUtSubsystemShutdown (); - /* TBD: [Restructure] Need some way to re-initialize without re-creating the semaphores! */ + /* + * TBD: [Restructure] Need some way to re-initialize without + * re-creating the semaphores! + */ /* AcpiInitialize (NULL); */ break; case CMD_THREADS: - AcpiDbCreateExecutionThreads (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2], AcpiGbl_DbArgs[3]); + AcpiDbCreateExecutionThreads (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2], + AcpiGbl_DbArgs[3]); + break; + + case CMD_TRACE: + AcpiDebugTrace (AcpiGbl_DbArgs[1],0,0,1); break; case CMD_TREE: @@ -854,13 +894,8 @@ AcpiDbCommandDispatch ( AcpiDbgLevel = ACPI_DEBUG_DEFAULT; } - /* Shutdown */ - - /* AcpiUtSubsystemShutdown (); */ AcpiDbCloseDebugFile (); - AcpiGbl_DbTerminateThreads = TRUE; - return (AE_CTRL_TERMINATE); case CMD_NOT_FOUND: @@ -869,6 +904,10 @@ AcpiDbCommandDispatch ( return (AE_CTRL_TRUE); } + if (ACPI_SUCCESS (Status)) + { + Status = AE_CTRL_TRUE; + } /* Add all commands that come here to the history buffer */ @@ -933,7 +972,7 @@ AcpiDbExecuteThread ( * ******************************************************************************/ -void +static void AcpiDbSingleThread ( void) { @@ -1019,13 +1058,12 @@ AcpiDbUserCommands ( } /* - * Only this thread (the original thread) should actually terminate the subsystem, - * because all the semaphores are deleted during termination + * Only this thread (the original thread) should actually terminate the + * subsystem, because all the semaphores are deleted during termination */ Status = AcpiTerminate (); return (Status); } - #endif /* ACPI_DEBUGGER */ -- cgit v1.2.3