diff options
| author | Jung-uk Kim <jkim@FreeBSD.org> | 2015-07-20 22:31:50 +0000 | 
|---|---|---|
| committer | Jung-uk Kim <jkim@FreeBSD.org> | 2015-07-20 22:31:50 +0000 | 
| commit | 136eac2a0638d3c751b1987603f71a9ae26879fd (patch) | |
| tree | 1e61df024e8a47b6bc4e25d07f455c9dcd7e2dc8 /source/components/debugger/dbcmds.c | |
| parent | f3bbb1ca6c1b2b877d015a8f5f0c67e48a7a57ae (diff) | |
Notes
Diffstat (limited to 'source/components/debugger/dbcmds.c')
| -rw-r--r-- | source/components/debugger/dbcmds.c | 86 | 
1 files changed, 86 insertions, 0 deletions
diff --git a/source/components/debugger/dbcmds.c b/source/components/debugger/dbcmds.c index 4a2c4e850107..d22bf4ca79e2 100644 --- a/source/components/debugger/dbcmds.c +++ b/source/components/debugger/dbcmds.c @@ -86,6 +86,8 @@ AcpiDbDoOneSleepState (      UINT8                   SleepState); +static char                 *AcpiDbTraceMethodName = NULL; +  /*******************************************************************************   *   * FUNCTION:    AcpiDbConvertToNode @@ -1226,4 +1228,88 @@ AcpiDbGenerateSci (  #endif /* !ACPI_REDUCED_HARDWARE */ + +/******************************************************************************* + * + * FUNCTION:    AcpiDbTrace + * + * PARAMETERS:  EnableArg           - ENABLE/AML to enable tracer + *                                    DISABLE to disable tracer + *              MethodArg           - Method to trace + *              OnceArg             - Whether trace once + * + * RETURN:      None + * + * DESCRIPTION: Control method tracing facility + * + ******************************************************************************/ + +void +AcpiDbTrace ( +    char                    *EnableArg, +    char                    *MethodArg, +    char                    *OnceArg) +{ +    UINT32                  DebugLevel = 0; +    UINT32                  DebugLayer = 0; +    UINT32                  Flags = 0; + + +    if (EnableArg) +    { +        AcpiUtStrupr (EnableArg); +    } +    if (OnceArg) +    { +        AcpiUtStrupr (OnceArg); +    } +    if (MethodArg) +    { +        if (AcpiDbTraceMethodName) +        { +            ACPI_FREE (AcpiDbTraceMethodName); +            AcpiDbTraceMethodName = NULL; +        } +        AcpiDbTraceMethodName = ACPI_ALLOCATE (strlen (MethodArg) + 1); +        if (!AcpiDbTraceMethodName) +        { +            AcpiOsPrintf ("Failed to allocate method name (%s)\n", MethodArg); +            return; +        } +        strcpy (AcpiDbTraceMethodName, MethodArg); +    } +    if (!strcmp (EnableArg, "ENABLE") || +        !strcmp (EnableArg, "METHOD") || +        !strcmp (EnableArg, "OPCODE")) +    { +        if (!strcmp (EnableArg, "ENABLE")) +        { +            /* Inherit current console settings */ + +            DebugLevel = AcpiGbl_DbConsoleDebugLevel; +            DebugLayer = AcpiDbgLayer; +        } +        else +        { +            /* Restrict console output to trace points only */ + +            DebugLevel = ACPI_LV_TRACE_POINT; +            DebugLayer = ACPI_EXECUTER; +        } + +        Flags = ACPI_TRACE_ENABLED; +        if (!strcmp (EnableArg, "OPCODE")) +        { +            Flags |= ACPI_TRACE_OPCODE; +        } +        if (OnceArg && !strcmp (OnceArg, "ONCE")) +        { +            Flags |= ACPI_TRACE_ONESHOT; +        } +    } + +    (void) AcpiDebugTrace (AcpiDbTraceMethodName, +                DebugLevel, DebugLayer, Flags); +} +  #endif /* ACPI_DEBUGGER */  | 
