ACPI_STATUS AcpiOsWaitCommandReady ( void) { ACPI_STATUS Status = AE_OK; if (AcpiGbl_DebuggerConfiguration == DEBUGGER_MULTI_THREADED) { Status = AE_TIME; while (Status == AE_TIME) { if (AcpiGbl_DbTerminateLoop) { Status = AE_CTRL_TERMINATE; } else { Status = AcpiOsAcquireMutex (AcpiGbl_DbCommandReady, 1000); } } } else { /* Force output to console until a command is entered */ AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT); /* Different prompt if method is executing */ if (!AcpiGbl_MethodExecuting) { AcpiOsPrintf ("%1c ", ACPI_DEBUGGER_COMMAND_PROMPT); } else { AcpiOsPrintf ("%1c ", ACPI_DEBUGGER_EXECUTE_PROMPT); } /* Get the user input line */ Status = AcpiOsGetLine (AcpiGbl_DbLineBuf, ACPI_DB_LINE_BUFFER_SIZE, NULL); } if (ACPI_FAILURE (Status) && Status != AE_CTRL_TERMINATE) { ACPI_EXCEPTION ((AE_INFO, Status, "While parsing/handling command line")); } return (Status); }
static ACPI_STATUS AcpiDbStartCommand ( ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op) { ACPI_STATUS Status; /* TBD: [Investigate] are there namespace locking issues here? */ /* AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); */ /* Go into the command loop and await next user command */ AcpiGbl_MethodExecuting = TRUE; Status = AE_CTRL_TRUE; while (Status == AE_CTRL_TRUE) { if (AcpiGbl_DebuggerConfiguration == DEBUGGER_MULTI_THREADED) { /* Handshake with the front-end that gets user command lines */ Status = AcpiUtReleaseMutex (ACPI_MTX_DEBUG_CMD_COMPLETE); if (ACPI_FAILURE (Status)) { return (Status); } Status = AcpiUtAcquireMutex (ACPI_MTX_DEBUG_CMD_READY); if (ACPI_FAILURE (Status)) { return (Status); } } else { /* Single threaded, we must get a command line ourselves */ /* Force output to console until a command is entered */ AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT); /* Different prompt if method is executing */ if (!AcpiGbl_MethodExecuting) { AcpiOsPrintf ("%1c ", ACPI_DEBUGGER_COMMAND_PROMPT); } else { AcpiOsPrintf ("%1c ", ACPI_DEBUGGER_EXECUTE_PROMPT); } /* Get the user input line */ (void) AcpiOsGetLine (AcpiGbl_DbLineBuf); } Status = AcpiDbCommandDispatch (AcpiGbl_DbLineBuf, WalkState, Op); } /* AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); */ return (Status); }
ACPI_STATUS AcpiDbUserCommands ( char Prompt, ACPI_PARSE_OBJECT *Op) { ACPI_STATUS Status = AE_OK; AcpiOsPrintf ("\n"); /* TBD: [Restructure] Need a separate command line buffer for step mode */ while (!AcpiGbl_DbTerminateThreads) { /* Force output to console until a command is entered */ AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT); /* Different prompt if method is executing */ if (!AcpiGbl_MethodExecuting) { AcpiOsPrintf ("%1c ", ACPI_DEBUGGER_COMMAND_PROMPT); } else { AcpiOsPrintf ("%1c ", ACPI_DEBUGGER_EXECUTE_PROMPT); } /* Get the user input line */ 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); } /* Check for single or multithreaded debug */ 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); if (ACPI_FAILURE (Status)) { return (Status); } Status = AcpiOsAcquireMutex (AcpiGbl_DbCommandComplete, ACPI_WAIT_FOREVER); if (ACPI_FAILURE (Status)) { return (Status); } } else { /* Just call to the command line interpreter */ AcpiDbSingleThread (); } } /* Shut down the debugger */ AcpiTerminateDebugger (); /* * Only this thread (the original thread) should actually terminate the * subsystem, because all the semaphores are deleted during termination */ Status = AcpiTerminate (); return (Status); }
static void AcpiDbRunRemoteDebugger ( char *BatchBuffer) { ACPI_STATUS Status; char *Ptr = BatchBuffer; char *Cmd = Ptr; while (!AcpiGbl_DbTerminateLoop) { if (BatchBuffer) { if (*Ptr) { while (*Ptr) { if (*Ptr == ',') { /* Convert commas to spaces */ *Ptr = ' '; } else if (*Ptr == ';') { *Ptr = '\0'; continue; } Ptr++; } strncpy (AcpiGbl_DbLineBuf, Cmd, ACPI_DB_LINE_BUFFER_SIZE); Ptr++; Cmd = Ptr; } else { return; } } else { /* Force output to console until a command is entered */ AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT); /* Different prompt if method is executing */ if (!AcpiGbl_MethodExecuting) { AcpiOsPrintf ("%1c ", ACPI_DEBUGGER_COMMAND_PROMPT); } else { AcpiOsPrintf ("%1c ", ACPI_DEBUGGER_EXECUTE_PROMPT); } /* Get the user input line */ Status = AcpiOsGetLine (AcpiGbl_DbLineBuf, ACPI_DB_LINE_BUFFER_SIZE, NULL); if (ACPI_FAILURE (Status)) { return; } } /* * 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; } } }
ACPI_STATUS AcpiDbUserCommands ( NATIVE_CHAR Prompt, ACPI_PARSE_OBJECT *Op) { ACPI_STATUS Status = AE_OK; /* TBD: [Restructure] Need a separate command line buffer for step mode */ while (!AcpiGbl_DbTerminateThreads) { /* Force output to console until a command is entered */ AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT); /* Different prompt if method is executing */ if (!AcpiGbl_MethodExecuting) { AcpiOsPrintf ("%1c ", ACPI_DEBUGGER_COMMAND_PROMPT); } else { AcpiOsPrintf ("%1c ", ACPI_DEBUGGER_EXECUTE_PROMPT); } /* Get the user input line */ (void) AcpiOsGetLine (AcpiGbl_DbLineBuf); /* Check for single or multithreaded debug */ if (AcpiGbl_DebuggerConfiguration & DEBUGGER_MULTI_THREADED) { /* * Signal the debug thread that we have a command to execute, * and wait for the command to 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 */ AcpiDbSingleThread (); } } /* * Only this thread (the original thread) should actually terminate the subsystem, * because all the semaphores are deleted during termination */ Status = AcpiTerminate (); return (Status); }