summaryrefslogtreecommitdiff
path: root/source/components/debugger/dbinput.c
diff options
context:
space:
mode:
authorLv Zheng <lv.zheng@intel.com>2016-11-03 01:17:13 +0800
committerLv Zheng <lv.zheng@intel.com>2016-11-03 01:17:13 +0800
commite76eb8b36ace880e4d475880db1128a206e57b6f (patch)
tree83b5b9a652d3dc85eaca7785891d71054f94e11c /source/components/debugger/dbinput.c
parentf0071e71698ac492bc9abb46d671d3bea2d3ffbc (diff)
downloadacpica-e76eb8b36ace880e4d475880db1128a206e57b6f.tar.gz
Debugger: Convert some mechanisms to OSPM specific
The following mechanisms are OSPM specific: 1. Redirect output destination to console: no file redirection will be needed by an in-kernel debugger, there is even no file can be accessed when the debugger is running in the kernel mode. 2. Output command prompts: programs other than acpiexec can have different prompt characters and the prompt characters may be implemented as a special character sequence to form a char device IO protocol. 3. Command ready/complete handshake: OSPM debugger may wait more conditions to implement OSPM specific semantics (for example, FIFO full/empty conditions for O_NONBLOCK or IO open/close conditions). Leaving such OSPM specific stuffs in the ACPICA debugger core blocks Linux debugger IO driver implementation. Several new OSL APIs are provided by this patch: 1. AcpiOsInitializeDebugger: initialize debugger. 2. AcpiOsTerminateDebugger: reversal of AcpiOsInitializeDebugger. 3. AcpiOsWaitCommandReady: putting debugger task into wait state when a command is not ready. OSPMs can terminate command loop by returning AE_CTRL_TERMINATE from this API. Normally, wait_event() or WaitForMultipleObject() may be used to implement this API. 4. AcpiOsNotifyCommandComplete: putting user task into running state when a command has been completed. OSPMs can terminate command loop by returning AE_CTRL_TERMINATE from this API. Normally, wake_up() or SetEvent() may be used to implement this API. This patch also converts current command signaling implementation into a generic debugger layer (osgendbg.c) to be used by the existing OSPMs or acpiexec, in return, Linux can have chance to implement its own command handshake mechanism. This patch also implements acpiexec batch mode in a multi-threading mode comaptible style as a demo (this can be confirmed by configuring acpiexec into DEBUGGER_MULTI_THREADED mode where the batch mode is still working). Lv Zheng. Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Diffstat (limited to 'source/components/debugger/dbinput.c')
-rw-r--r--source/components/debugger/dbinput.c111
1 files changed, 20 insertions, 91 deletions
diff --git a/source/components/debugger/dbinput.c b/source/components/debugger/dbinput.c
index f41ad81fd..6bcb84be5 100644
--- a/source/components/debugger/dbinput.c
+++ b/source/components/debugger/dbinput.c
@@ -136,10 +136,6 @@ AcpiDbMatchCommand (
char *UserCommand);
static void
-AcpiDbSingleThread (
- void);
-
-static void
AcpiDbDisplayCommandInfo (
const char *Command,
BOOLEAN DisplayAll);
@@ -1303,61 +1299,17 @@ void ACPI_SYSTEM_XFACE
AcpiDbExecuteThread (
void *Context)
{
- ACPI_STATUS Status = AE_OK;
- ACPI_STATUS MStatus;
-
-
- while (Status != AE_CTRL_TERMINATE && !AcpiGbl_DbTerminateLoop)
- {
- AcpiGbl_MethodExecuting = FALSE;
- AcpiGbl_StepToNextCall = FALSE;
- MStatus = AcpiOsAcquireMutex (AcpiGbl_DbCommandReady,
- ACPI_WAIT_FOREVER);
- if (ACPI_FAILURE (MStatus))
- {
- return;
- }
-
- Status = AcpiDbCommandDispatch (AcpiGbl_DbLineBuf, NULL, NULL);
-
- AcpiOsReleaseMutex (AcpiGbl_DbCommandComplete);
- }
+ (void) AcpiDbUserCommands ();
AcpiGbl_DbThreadsTerminated = TRUE;
}
/*******************************************************************************
*
- * FUNCTION: AcpiDbSingleThread
- *
- * PARAMETERS: None
- *
- * RETURN: None
- *
- * DESCRIPTION: Debugger execute thread. Waits for a command line, then
- * simply dispatches it.
- *
- ******************************************************************************/
-
-static void
-AcpiDbSingleThread (
- void)
-{
-
- AcpiGbl_MethodExecuting = FALSE;
- AcpiGbl_StepToNextCall = FALSE;
-
- (void) AcpiDbCommandDispatch (AcpiGbl_DbLineBuf, NULL, NULL);
-}
-
-
-/*******************************************************************************
- *
* FUNCTION: AcpiDbUserCommands
*
- * PARAMETERS: Prompt - User prompt (depends on mode)
- * Op - Current executing parse op
+ * PARAMETERS: None
*
* RETURN: None
*
@@ -1368,8 +1320,7 @@ AcpiDbSingleThread (
ACPI_STATUS
AcpiDbUserCommands (
- char Prompt,
- ACPI_PARSE_OBJECT *Op)
+ void)
{
ACPI_STATUS Status = AE_OK;
@@ -1380,55 +1331,33 @@ AcpiDbUserCommands (
while (!AcpiGbl_DbTerminateLoop)
{
- /* Force output to console until a command is entered */
-
- AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
-
- /* Different prompt if method is executing */
+ /* Wait the readiness of the command */
- if (!AcpiGbl_MethodExecuting)
- {
- AcpiOsPrintf ("%1c ", ACPI_DEBUGGER_COMMAND_PROMPT);
- }
- else
+ Status = AcpiOsWaitCommandReady ();
+ if (ACPI_FAILURE (Status))
{
- AcpiOsPrintf ("%1c ", ACPI_DEBUGGER_EXECUTE_PROMPT);
+ break;
}
- /* Get the user input line */
+ /* Just call to the command line interpreter */
- Status = AcpiOsGetLine (AcpiGbl_DbLineBuf,
- ACPI_DB_LINE_BUFFER_SIZE, NULL);
- if (ACPI_FAILURE (Status))
- {
- ACPI_EXCEPTION ((AE_INFO, Status, "While parsing command line"));
- return (Status);
- }
+ AcpiGbl_MethodExecuting = FALSE;
+ AcpiGbl_StepToNextCall = FALSE;
- /* Check for single or multithreaded debug */
+ (void) AcpiDbCommandDispatch (AcpiGbl_DbLineBuf, NULL, NULL);
- if (AcpiGbl_DebuggerConfiguration & DEBUGGER_MULTI_THREADED)
- {
- /*
- * Signal the debug thread that we have a command to execute,
- * and wait for the command to complete.
- */
- AcpiOsReleaseMutex (AcpiGbl_DbCommandReady);
-
- Status = AcpiOsAcquireMutex (AcpiGbl_DbCommandComplete,
- ACPI_WAIT_FOREVER);
- if (ACPI_FAILURE (Status))
- {
- return (Status);
- }
- }
- else
- {
- /* Just call to the command line interpreter */
+ /* Notify the completion of the command */
- AcpiDbSingleThread ();
+ Status = AcpiOsNotifyCommandComplete ();
+ if (ACPI_FAILURE (Status))
+ {
+ break;
}
}
+ if (ACPI_FAILURE (Status) && Status != AE_CTRL_TERMINATE)
+ {
+ ACPI_EXCEPTION ((AE_INFO, Status, "While parsing command line"));
+ }
return (Status);
}