diff options
Diffstat (limited to 'sys/contrib/dev/acpica/dbxface.c')
-rw-r--r-- | sys/contrib/dev/acpica/dbxface.c | 188 |
1 files changed, 122 insertions, 66 deletions
diff --git a/sys/contrib/dev/acpica/dbxface.c b/sys/contrib/dev/acpica/dbxface.c index a1636a4..74542bd 100644 --- a/sys/contrib/dev/acpica/dbxface.c +++ b/sys/contrib/dev/acpica/dbxface.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: dbxface - AML Debugger external interfaces - * $Revision: 65 $ + * $Revision: 70 $ * ******************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. * All rights reserved. * * 2. License @@ -129,6 +129,113 @@ /******************************************************************************* * + * FUNCTION: AcpiDbStartCommand + * + * PARAMETERS: WalkState - Current walk + * + * RETURN: Status + * + * DESCRIPTION: Enter debugger command loop + * + ******************************************************************************/ + +ACPI_STATUS +AcpiDbStartCommand ( + ACPI_WALK_STATE *WalkState, + ACPI_PARSE_OBJECT *Op) +{ + ACPI_STATUS Status; + + + /* TBD: [Investigate] what are the 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); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDbMethodEnd + * + * PARAMETERS: WalkState - Current walk + * + * RETURN: Status + * + * DESCRIPTION: + * + ******************************************************************************/ + +void +AcpiDbMethodEnd ( + ACPI_WALK_STATE *WalkState) +{ + + if (!AcpiGbl_CmSingleStep) + { + return; + } + + AcpiOsPrintf ("<Method Terminating>\n"); + + AcpiDbStartCommand (WalkState, NULL); +} + + +/******************************************************************************* + * * FUNCTION: AcpiDbSingleStep * * PARAMETERS: WalkState - Current walk @@ -156,6 +263,15 @@ AcpiDbSingleStep ( ACPI_FUNCTION_ENTRY (); + + /* Check the abort flag */ + + if (AcpiGbl_AbortMethod) + { + AcpiGbl_AbortMethod = FALSE; + return (AE_ABORT_METHOD); + } + /* Check for single-step breakpoint */ if (WalkState->MethodBreakpoint && @@ -181,7 +297,6 @@ AcpiDbSingleStep ( WalkState->MethodBreakpoint = 0; } - /* * Check if this is an opcode that we are interested in -- * namely, opcodes that have arguments @@ -269,9 +384,7 @@ AcpiDbSingleStep ( /* Now we can display it */ -#ifdef ACPI_DISASSEMBLER AcpiDmDisassemble (WalkState, DisplayOp, ACPI_UINT32_MAX); -#endif if ((Op->Common.AmlOpcode == AML_IF_OP) || (Op->Common.AmlOpcode == AML_WHILE_OP)) @@ -285,7 +398,6 @@ AcpiDbSingleStep ( AcpiOsPrintf ("Predicate = [False], Skipping IF block\n"); } } - else if (Op->Common.AmlOpcode == AML_ELSE_OP) { AcpiOsPrintf ("Predicate = [False], ELSE block was executed\n"); @@ -342,60 +454,7 @@ AcpiDbSingleStep ( } - /* TBD: [Investigate] what are the 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); */ + Status = AcpiDbStartCommand (WalkState, Op); /* User commands complete, continue execution of the interrupted method */ @@ -428,15 +487,13 @@ AcpiDbInitialize (void) AcpiGbl_DbOutputToFile = FALSE; AcpiGbl_DbDebugLevel = ACPI_LV_VERBOSITY2; - AcpiGbl_DbConsoleDebugLevel = NORMAL_DEFAULT | ACPI_LV_TABLES; + AcpiGbl_DbConsoleDebugLevel = ACPI_NORMAL_DEFAULT | ACPI_LV_TABLES; AcpiGbl_DbOutputFlags = ACPI_DB_CONSOLE_OUTPUT; AcpiGbl_DbOpt_tables = FALSE; - AcpiGbl_DbOpt_stats = FALSE; -#ifdef ACPI_DISASSEMBLER AcpiGbl_DbOpt_disasm = FALSE; + AcpiGbl_DbOpt_stats = FALSE; AcpiGbl_DbOpt_verbose = TRUE; -#endif AcpiGbl_DbOpt_ini_methods = TRUE; AcpiGbl_DbBuffer = AcpiOsAllocate (ACPI_DEBUG_BUFFER_SIZE); @@ -467,6 +524,7 @@ AcpiDbInitialize (void) AcpiOsPrintf ("Could not get debugger mutex\n"); return (Status); } + Status = AcpiUtAcquireMutex (ACPI_MTX_DEBUG_CMD_READY); if (ACPI_FAILURE (Status)) { @@ -484,13 +542,11 @@ AcpiDbInitialize (void) } } -#ifdef ACPI_DISASSEMBLER if (!AcpiGbl_DbOpt_verbose) { AcpiGbl_DbOpt_disasm = TRUE; AcpiGbl_DbOpt_stats = FALSE; } -#endif return (AE_OK); } |