Home | History | Annotate | Line # | Download | only in utilities
utdebug.c revision 1.1.1.10
      1      1.1    jruoho /******************************************************************************
      2      1.1    jruoho  *
      3  1.1.1.3  christos  * Module Name: utdebug - Debug print/trace routines
      4      1.1    jruoho  *
      5      1.1    jruoho  *****************************************************************************/
      6      1.1    jruoho 
      7  1.1.1.2    jruoho /*
      8  1.1.1.7  christos  * Copyright (C) 2000 - 2016, Intel Corp.
      9      1.1    jruoho  * All rights reserved.
     10      1.1    jruoho  *
     11  1.1.1.2    jruoho  * Redistribution and use in source and binary forms, with or without
     12  1.1.1.2    jruoho  * modification, are permitted provided that the following conditions
     13  1.1.1.2    jruoho  * are met:
     14  1.1.1.2    jruoho  * 1. Redistributions of source code must retain the above copyright
     15  1.1.1.2    jruoho  *    notice, this list of conditions, and the following disclaimer,
     16  1.1.1.2    jruoho  *    without modification.
     17  1.1.1.2    jruoho  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
     18  1.1.1.2    jruoho  *    substantially similar to the "NO WARRANTY" disclaimer below
     19  1.1.1.2    jruoho  *    ("Disclaimer") and any redistribution must be conditioned upon
     20  1.1.1.2    jruoho  *    including a substantially similar Disclaimer requirement for further
     21  1.1.1.2    jruoho  *    binary redistribution.
     22  1.1.1.2    jruoho  * 3. Neither the names of the above-listed copyright holders nor the names
     23  1.1.1.2    jruoho  *    of any contributors may be used to endorse or promote products derived
     24  1.1.1.2    jruoho  *    from this software without specific prior written permission.
     25  1.1.1.2    jruoho  *
     26  1.1.1.2    jruoho  * Alternatively, this software may be distributed under the terms of the
     27  1.1.1.2    jruoho  * GNU General Public License ("GPL") version 2 as published by the Free
     28  1.1.1.2    jruoho  * Software Foundation.
     29  1.1.1.2    jruoho  *
     30  1.1.1.2    jruoho  * NO WARRANTY
     31  1.1.1.2    jruoho  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     32  1.1.1.2    jruoho  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     33  1.1.1.2    jruoho  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
     34  1.1.1.2    jruoho  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     35  1.1.1.2    jruoho  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     36  1.1.1.2    jruoho  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     37  1.1.1.2    jruoho  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     38  1.1.1.2    jruoho  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
     39  1.1.1.2    jruoho  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
     40  1.1.1.2    jruoho  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     41  1.1.1.2    jruoho  * POSSIBILITY OF SUCH DAMAGES.
     42  1.1.1.2    jruoho  */
     43      1.1    jruoho 
     44  1.1.1.3  christos #define EXPORT_ACPI_INTERFACES
     45      1.1    jruoho 
     46      1.1    jruoho #include "acpi.h"
     47      1.1    jruoho #include "accommon.h"
     48  1.1.1.6  christos #include "acinterp.h"
     49      1.1    jruoho 
     50      1.1    jruoho #define _COMPONENT          ACPI_UTILITIES
     51      1.1    jruoho         ACPI_MODULE_NAME    ("utdebug")
     52      1.1    jruoho 
     53      1.1    jruoho 
     54      1.1    jruoho #ifdef ACPI_DEBUG_OUTPUT
     55      1.1    jruoho 
     56  1.1.1.8  christos static ACPI_THREAD_ID       AcpiGbl_PreviousThreadId = (ACPI_THREAD_ID) 0xFFFFFFFF;
     57  1.1.1.8  christos static const char           *AcpiGbl_FunctionEntryPrefix = "----Entry";
     58  1.1.1.8  christos static const char           *AcpiGbl_FunctionExitPrefix  = "----Exit-";
     59      1.1    jruoho 
     60      1.1    jruoho 
     61      1.1    jruoho /*******************************************************************************
     62      1.1    jruoho  *
     63      1.1    jruoho  * FUNCTION:    AcpiUtInitStackPtrTrace
     64      1.1    jruoho  *
     65      1.1    jruoho  * PARAMETERS:  None
     66      1.1    jruoho  *
     67      1.1    jruoho  * RETURN:      None
     68      1.1    jruoho  *
     69      1.1    jruoho  * DESCRIPTION: Save the current CPU stack pointer at subsystem startup
     70      1.1    jruoho  *
     71      1.1    jruoho  ******************************************************************************/
     72      1.1    jruoho 
     73      1.1    jruoho void
     74      1.1    jruoho AcpiUtInitStackPtrTrace (
     75      1.1    jruoho     void)
     76      1.1    jruoho {
     77      1.1    jruoho     ACPI_SIZE               CurrentSp;
     78      1.1    jruoho 
     79      1.1    jruoho 
     80      1.1    jruoho     AcpiGbl_EntryStackPointer = &CurrentSp;
     81      1.1    jruoho }
     82      1.1    jruoho 
     83      1.1    jruoho 
     84      1.1    jruoho /*******************************************************************************
     85      1.1    jruoho  *
     86      1.1    jruoho  * FUNCTION:    AcpiUtTrackStackPtr
     87      1.1    jruoho  *
     88      1.1    jruoho  * PARAMETERS:  None
     89      1.1    jruoho  *
     90      1.1    jruoho  * RETURN:      None
     91      1.1    jruoho  *
     92      1.1    jruoho  * DESCRIPTION: Save the current CPU stack pointer
     93      1.1    jruoho  *
     94      1.1    jruoho  ******************************************************************************/
     95      1.1    jruoho 
     96      1.1    jruoho void
     97      1.1    jruoho AcpiUtTrackStackPtr (
     98      1.1    jruoho     void)
     99      1.1    jruoho {
    100      1.1    jruoho     ACPI_SIZE               CurrentSp;
    101      1.1    jruoho 
    102      1.1    jruoho 
    103      1.1    jruoho     if (&CurrentSp < AcpiGbl_LowestStackPointer)
    104      1.1    jruoho     {
    105      1.1    jruoho         AcpiGbl_LowestStackPointer = &CurrentSp;
    106      1.1    jruoho     }
    107      1.1    jruoho 
    108      1.1    jruoho     if (AcpiGbl_NestingLevel > AcpiGbl_DeepestNesting)
    109      1.1    jruoho     {
    110      1.1    jruoho         AcpiGbl_DeepestNesting = AcpiGbl_NestingLevel;
    111      1.1    jruoho     }
    112      1.1    jruoho }
    113      1.1    jruoho 
    114      1.1    jruoho 
    115      1.1    jruoho /*******************************************************************************
    116      1.1    jruoho  *
    117      1.1    jruoho  * FUNCTION:    AcpiUtTrimFunctionName
    118      1.1    jruoho  *
    119      1.1    jruoho  * PARAMETERS:  FunctionName        - Ascii string containing a procedure name
    120      1.1    jruoho  *
    121      1.1    jruoho  * RETURN:      Updated pointer to the function name
    122      1.1    jruoho  *
    123      1.1    jruoho  * DESCRIPTION: Remove the "Acpi" prefix from the function name, if present.
    124      1.1    jruoho  *              This allows compiler macros such as __FUNCTION__ to be used
    125      1.1    jruoho  *              with no change to the debug output.
    126      1.1    jruoho  *
    127      1.1    jruoho  ******************************************************************************/
    128      1.1    jruoho 
    129      1.1    jruoho static const char *
    130      1.1    jruoho AcpiUtTrimFunctionName (
    131      1.1    jruoho     const char              *FunctionName)
    132      1.1    jruoho {
    133      1.1    jruoho 
    134      1.1    jruoho     /* All Function names are longer than 4 chars, check is safe */
    135      1.1    jruoho 
    136      1.1    jruoho     if (*(ACPI_CAST_PTR (UINT32, FunctionName)) == ACPI_PREFIX_MIXED)
    137      1.1    jruoho     {
    138      1.1    jruoho         /* This is the case where the original source has not been modified */
    139      1.1    jruoho 
    140      1.1    jruoho         return (FunctionName + 4);
    141      1.1    jruoho     }
    142      1.1    jruoho 
    143      1.1    jruoho     if (*(ACPI_CAST_PTR (UINT32, FunctionName)) == ACPI_PREFIX_LOWER)
    144      1.1    jruoho     {
    145      1.1    jruoho         /* This is the case where the source has been 'linuxized' */
    146      1.1    jruoho 
    147      1.1    jruoho         return (FunctionName + 5);
    148      1.1    jruoho     }
    149      1.1    jruoho 
    150      1.1    jruoho     return (FunctionName);
    151      1.1    jruoho }
    152      1.1    jruoho 
    153      1.1    jruoho 
    154      1.1    jruoho /*******************************************************************************
    155      1.1    jruoho  *
    156      1.1    jruoho  * FUNCTION:    AcpiDebugPrint
    157      1.1    jruoho  *
    158      1.1    jruoho  * PARAMETERS:  RequestedDebugLevel - Requested debug print level
    159      1.1    jruoho  *              LineNumber          - Caller's line number (for error output)
    160      1.1    jruoho  *              FunctionName        - Caller's procedure name
    161      1.1    jruoho  *              ModuleName          - Caller's module name
    162      1.1    jruoho  *              ComponentId         - Caller's component ID
    163      1.1    jruoho  *              Format              - Printf format field
    164      1.1    jruoho  *              ...                 - Optional printf arguments
    165      1.1    jruoho  *
    166      1.1    jruoho  * RETURN:      None
    167      1.1    jruoho  *
    168      1.1    jruoho  * DESCRIPTION: Print error message with prefix consisting of the module name,
    169      1.1    jruoho  *              line number, and component ID.
    170      1.1    jruoho  *
    171      1.1    jruoho  ******************************************************************************/
    172      1.1    jruoho 
    173      1.1    jruoho void  ACPI_INTERNAL_VAR_XFACE
    174      1.1    jruoho AcpiDebugPrint (
    175      1.1    jruoho     UINT32                  RequestedDebugLevel,
    176      1.1    jruoho     UINT32                  LineNumber,
    177      1.1    jruoho     const char              *FunctionName,
    178      1.1    jruoho     const char              *ModuleName,
    179      1.1    jruoho     UINT32                  ComponentId,
    180      1.1    jruoho     const char              *Format,
    181      1.1    jruoho     ...)
    182      1.1    jruoho {
    183      1.1    jruoho     ACPI_THREAD_ID          ThreadId;
    184      1.1    jruoho     va_list                 args;
    185      1.1    jruoho 
    186      1.1    jruoho 
    187  1.1.1.3  christos     /* Check if debug output enabled */
    188  1.1.1.3  christos 
    189  1.1.1.3  christos     if (!ACPI_IS_DEBUG_ENABLED (RequestedDebugLevel, ComponentId))
    190      1.1    jruoho     {
    191      1.1    jruoho         return;
    192      1.1    jruoho     }
    193      1.1    jruoho 
    194      1.1    jruoho     /*
    195      1.1    jruoho      * Thread tracking and context switch notification
    196      1.1    jruoho      */
    197      1.1    jruoho     ThreadId = AcpiOsGetThreadId ();
    198  1.1.1.8  christos     if (ThreadId != AcpiGbl_PreviousThreadId)
    199      1.1    jruoho     {
    200      1.1    jruoho         if (ACPI_LV_THREADS & AcpiDbgLevel)
    201      1.1    jruoho         {
    202      1.1    jruoho             AcpiOsPrintf (
    203  1.1.1.2    jruoho                 "\n**** Context Switch from TID %u to TID %u ****\n\n",
    204  1.1.1.8  christos                 (UINT32) AcpiGbl_PreviousThreadId, (UINT32) ThreadId);
    205      1.1    jruoho         }
    206      1.1    jruoho 
    207  1.1.1.8  christos         AcpiGbl_PreviousThreadId = ThreadId;
    208  1.1.1.3  christos         AcpiGbl_NestingLevel = 0;
    209      1.1    jruoho     }
    210      1.1    jruoho 
    211      1.1    jruoho     /*
    212      1.1    jruoho      * Display the module name, current line number, thread ID (if requested),
    213      1.1    jruoho      * current procedure nesting level, and the current procedure name
    214      1.1    jruoho      */
    215  1.1.1.3  christos     AcpiOsPrintf ("%9s-%04ld ", ModuleName, LineNumber);
    216      1.1    jruoho 
    217  1.1.1.3  christos #ifdef ACPI_APPLICATION
    218  1.1.1.3  christos     /*
    219  1.1.1.3  christos      * For AcpiExec/iASL only, emit the thread ID and nesting level.
    220  1.1.1.3  christos      * Note: nesting level is really only useful during a single-thread
    221  1.1.1.3  christos      * execution. Otherwise, multiple threads will keep resetting the
    222  1.1.1.3  christos      * level.
    223  1.1.1.3  christos      */
    224      1.1    jruoho     if (ACPI_LV_THREADS & AcpiDbgLevel)
    225      1.1    jruoho     {
    226  1.1.1.2    jruoho         AcpiOsPrintf ("[%u] ", (UINT32) ThreadId);
    227      1.1    jruoho     }
    228      1.1    jruoho 
    229  1.1.1.3  christos     AcpiOsPrintf ("[%02ld] ", AcpiGbl_NestingLevel);
    230  1.1.1.3  christos #endif
    231  1.1.1.3  christos 
    232  1.1.1.3  christos     AcpiOsPrintf ("%-22.22s: ", AcpiUtTrimFunctionName (FunctionName));
    233      1.1    jruoho 
    234      1.1    jruoho     va_start (args, Format);
    235      1.1    jruoho     AcpiOsVprintf (Format, args);
    236      1.1    jruoho     va_end (args);
    237      1.1    jruoho }
    238      1.1    jruoho 
    239      1.1    jruoho ACPI_EXPORT_SYMBOL (AcpiDebugPrint)
    240      1.1    jruoho 
    241      1.1    jruoho 
    242      1.1    jruoho /*******************************************************************************
    243      1.1    jruoho  *
    244      1.1    jruoho  * FUNCTION:    AcpiDebugPrintRaw
    245      1.1    jruoho  *
    246      1.1    jruoho  * PARAMETERS:  RequestedDebugLevel - Requested debug print level
    247      1.1    jruoho  *              LineNumber          - Caller's line number
    248      1.1    jruoho  *              FunctionName        - Caller's procedure name
    249      1.1    jruoho  *              ModuleName          - Caller's module name
    250      1.1    jruoho  *              ComponentId         - Caller's component ID
    251      1.1    jruoho  *              Format              - Printf format field
    252      1.1    jruoho  *              ...                 - Optional printf arguments
    253      1.1    jruoho  *
    254      1.1    jruoho  * RETURN:      None
    255      1.1    jruoho  *
    256  1.1.1.3  christos  * DESCRIPTION: Print message with no headers. Has same interface as
    257      1.1    jruoho  *              DebugPrint so that the same macros can be used.
    258      1.1    jruoho  *
    259      1.1    jruoho  ******************************************************************************/
    260      1.1    jruoho 
    261      1.1    jruoho void  ACPI_INTERNAL_VAR_XFACE
    262      1.1    jruoho AcpiDebugPrintRaw (
    263      1.1    jruoho     UINT32                  RequestedDebugLevel,
    264      1.1    jruoho     UINT32                  LineNumber,
    265      1.1    jruoho     const char              *FunctionName,
    266      1.1    jruoho     const char              *ModuleName,
    267      1.1    jruoho     UINT32                  ComponentId,
    268      1.1    jruoho     const char              *Format,
    269      1.1    jruoho     ...)
    270      1.1    jruoho {
    271      1.1    jruoho     va_list                 args;
    272      1.1    jruoho 
    273      1.1    jruoho 
    274  1.1.1.3  christos     /* Check if debug output enabled */
    275  1.1.1.3  christos 
    276  1.1.1.3  christos     if (!ACPI_IS_DEBUG_ENABLED (RequestedDebugLevel, ComponentId))
    277      1.1    jruoho     {
    278      1.1    jruoho         return;
    279      1.1    jruoho     }
    280      1.1    jruoho 
    281      1.1    jruoho     va_start (args, Format);
    282      1.1    jruoho     AcpiOsVprintf (Format, args);
    283      1.1    jruoho     va_end (args);
    284      1.1    jruoho }
    285      1.1    jruoho 
    286      1.1    jruoho ACPI_EXPORT_SYMBOL (AcpiDebugPrintRaw)
    287      1.1    jruoho 
    288      1.1    jruoho 
    289      1.1    jruoho /*******************************************************************************
    290      1.1    jruoho  *
    291      1.1    jruoho  * FUNCTION:    AcpiUtTrace
    292      1.1    jruoho  *
    293      1.1    jruoho  * PARAMETERS:  LineNumber          - Caller's line number
    294      1.1    jruoho  *              FunctionName        - Caller's procedure name
    295      1.1    jruoho  *              ModuleName          - Caller's module name
    296      1.1    jruoho  *              ComponentId         - Caller's component ID
    297      1.1    jruoho  *
    298      1.1    jruoho  * RETURN:      None
    299      1.1    jruoho  *
    300  1.1.1.3  christos  * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is
    301      1.1    jruoho  *              set in DebugLevel
    302      1.1    jruoho  *
    303      1.1    jruoho  ******************************************************************************/
    304      1.1    jruoho 
    305      1.1    jruoho void
    306      1.1    jruoho AcpiUtTrace (
    307      1.1    jruoho     UINT32                  LineNumber,
    308      1.1    jruoho     const char              *FunctionName,
    309      1.1    jruoho     const char              *ModuleName,
    310      1.1    jruoho     UINT32                  ComponentId)
    311      1.1    jruoho {
    312      1.1    jruoho 
    313      1.1    jruoho     AcpiGbl_NestingLevel++;
    314      1.1    jruoho     AcpiUtTrackStackPtr ();
    315      1.1    jruoho 
    316  1.1.1.3  christos     /* Check if enabled up-front for performance */
    317  1.1.1.3  christos 
    318  1.1.1.3  christos     if (ACPI_IS_DEBUG_ENABLED (ACPI_LV_FUNCTIONS, ComponentId))
    319  1.1.1.3  christos     {
    320  1.1.1.3  christos         AcpiDebugPrint (ACPI_LV_FUNCTIONS,
    321  1.1.1.3  christos             LineNumber, FunctionName, ModuleName, ComponentId,
    322  1.1.1.8  christos             "%s\n", AcpiGbl_FunctionEntryPrefix);
    323  1.1.1.3  christos     }
    324      1.1    jruoho }
    325      1.1    jruoho 
    326      1.1    jruoho ACPI_EXPORT_SYMBOL (AcpiUtTrace)
    327      1.1    jruoho 
    328      1.1    jruoho 
    329      1.1    jruoho /*******************************************************************************
    330      1.1    jruoho  *
    331      1.1    jruoho  * FUNCTION:    AcpiUtTracePtr
    332      1.1    jruoho  *
    333      1.1    jruoho  * PARAMETERS:  LineNumber          - Caller's line number
    334      1.1    jruoho  *              FunctionName        - Caller's procedure name
    335      1.1    jruoho  *              ModuleName          - Caller's module name
    336      1.1    jruoho  *              ComponentId         - Caller's component ID
    337      1.1    jruoho  *              Pointer             - Pointer to display
    338      1.1    jruoho  *
    339      1.1    jruoho  * RETURN:      None
    340      1.1    jruoho  *
    341  1.1.1.3  christos  * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is
    342      1.1    jruoho  *              set in DebugLevel
    343      1.1    jruoho  *
    344      1.1    jruoho  ******************************************************************************/
    345      1.1    jruoho 
    346      1.1    jruoho void
    347      1.1    jruoho AcpiUtTracePtr (
    348      1.1    jruoho     UINT32                  LineNumber,
    349      1.1    jruoho     const char              *FunctionName,
    350      1.1    jruoho     const char              *ModuleName,
    351      1.1    jruoho     UINT32                  ComponentId,
    352  1.1.1.8  christos     const void              *Pointer)
    353      1.1    jruoho {
    354  1.1.1.3  christos 
    355      1.1    jruoho     AcpiGbl_NestingLevel++;
    356      1.1    jruoho     AcpiUtTrackStackPtr ();
    357      1.1    jruoho 
    358  1.1.1.3  christos     /* Check if enabled up-front for performance */
    359  1.1.1.3  christos 
    360  1.1.1.3  christos     if (ACPI_IS_DEBUG_ENABLED (ACPI_LV_FUNCTIONS, ComponentId))
    361  1.1.1.3  christos     {
    362  1.1.1.3  christos         AcpiDebugPrint (ACPI_LV_FUNCTIONS,
    363  1.1.1.3  christos             LineNumber, FunctionName, ModuleName, ComponentId,
    364  1.1.1.8  christos             "%s %p\n", AcpiGbl_FunctionEntryPrefix, Pointer);
    365  1.1.1.3  christos     }
    366      1.1    jruoho }
    367      1.1    jruoho 
    368      1.1    jruoho 
    369      1.1    jruoho /*******************************************************************************
    370      1.1    jruoho  *
    371      1.1    jruoho  * FUNCTION:    AcpiUtTraceStr
    372      1.1    jruoho  *
    373      1.1    jruoho  * PARAMETERS:  LineNumber          - Caller's line number
    374      1.1    jruoho  *              FunctionName        - Caller's procedure name
    375      1.1    jruoho  *              ModuleName          - Caller's module name
    376      1.1    jruoho  *              ComponentId         - Caller's component ID
    377      1.1    jruoho  *              String              - Additional string to display
    378      1.1    jruoho  *
    379      1.1    jruoho  * RETURN:      None
    380      1.1    jruoho  *
    381  1.1.1.3  christos  * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is
    382      1.1    jruoho  *              set in DebugLevel
    383      1.1    jruoho  *
    384      1.1    jruoho  ******************************************************************************/
    385      1.1    jruoho 
    386      1.1    jruoho void
    387      1.1    jruoho AcpiUtTraceStr (
    388      1.1    jruoho     UINT32                  LineNumber,
    389      1.1    jruoho     const char              *FunctionName,
    390      1.1    jruoho     const char              *ModuleName,
    391      1.1    jruoho     UINT32                  ComponentId,
    392  1.1.1.8  christos     const char              *String)
    393      1.1    jruoho {
    394      1.1    jruoho 
    395      1.1    jruoho     AcpiGbl_NestingLevel++;
    396      1.1    jruoho     AcpiUtTrackStackPtr ();
    397      1.1    jruoho 
    398  1.1.1.3  christos     /* Check if enabled up-front for performance */
    399  1.1.1.3  christos 
    400  1.1.1.3  christos     if (ACPI_IS_DEBUG_ENABLED (ACPI_LV_FUNCTIONS, ComponentId))
    401  1.1.1.3  christos     {
    402  1.1.1.3  christos         AcpiDebugPrint (ACPI_LV_FUNCTIONS,
    403  1.1.1.3  christos             LineNumber, FunctionName, ModuleName, ComponentId,
    404  1.1.1.8  christos             "%s %s\n", AcpiGbl_FunctionEntryPrefix, String);
    405  1.1.1.3  christos     }
    406      1.1    jruoho }
    407      1.1    jruoho 
    408      1.1    jruoho 
    409      1.1    jruoho /*******************************************************************************
    410      1.1    jruoho  *
    411      1.1    jruoho  * FUNCTION:    AcpiUtTraceU32
    412      1.1    jruoho  *
    413      1.1    jruoho  * PARAMETERS:  LineNumber          - Caller's line number
    414      1.1    jruoho  *              FunctionName        - Caller's procedure name
    415      1.1    jruoho  *              ModuleName          - Caller's module name
    416      1.1    jruoho  *              ComponentId         - Caller's component ID
    417      1.1    jruoho  *              Integer             - Integer to display
    418      1.1    jruoho  *
    419      1.1    jruoho  * RETURN:      None
    420      1.1    jruoho  *
    421  1.1.1.3  christos  * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is
    422      1.1    jruoho  *              set in DebugLevel
    423      1.1    jruoho  *
    424      1.1    jruoho  ******************************************************************************/
    425      1.1    jruoho 
    426      1.1    jruoho void
    427      1.1    jruoho AcpiUtTraceU32 (
    428      1.1    jruoho     UINT32                  LineNumber,
    429      1.1    jruoho     const char              *FunctionName,
    430      1.1    jruoho     const char              *ModuleName,
    431      1.1    jruoho     UINT32                  ComponentId,
    432      1.1    jruoho     UINT32                  Integer)
    433      1.1    jruoho {
    434      1.1    jruoho 
    435      1.1    jruoho     AcpiGbl_NestingLevel++;
    436      1.1    jruoho     AcpiUtTrackStackPtr ();
    437      1.1    jruoho 
    438  1.1.1.3  christos     /* Check if enabled up-front for performance */
    439  1.1.1.3  christos 
    440  1.1.1.3  christos     if (ACPI_IS_DEBUG_ENABLED (ACPI_LV_FUNCTIONS, ComponentId))
    441  1.1.1.3  christos     {
    442  1.1.1.3  christos         AcpiDebugPrint (ACPI_LV_FUNCTIONS,
    443  1.1.1.3  christos             LineNumber, FunctionName, ModuleName, ComponentId,
    444  1.1.1.8  christos             "%s %08X\n", AcpiGbl_FunctionEntryPrefix, Integer);
    445  1.1.1.3  christos     }
    446      1.1    jruoho }
    447      1.1    jruoho 
    448      1.1    jruoho 
    449      1.1    jruoho /*******************************************************************************
    450      1.1    jruoho  *
    451      1.1    jruoho  * FUNCTION:    AcpiUtExit
    452      1.1    jruoho  *
    453      1.1    jruoho  * PARAMETERS:  LineNumber          - Caller's line number
    454      1.1    jruoho  *              FunctionName        - Caller's procedure name
    455      1.1    jruoho  *              ModuleName          - Caller's module name
    456      1.1    jruoho  *              ComponentId         - Caller's component ID
    457      1.1    jruoho  *
    458      1.1    jruoho  * RETURN:      None
    459      1.1    jruoho  *
    460  1.1.1.3  christos  * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is
    461      1.1    jruoho  *              set in DebugLevel
    462      1.1    jruoho  *
    463      1.1    jruoho  ******************************************************************************/
    464      1.1    jruoho 
    465      1.1    jruoho void
    466      1.1    jruoho AcpiUtExit (
    467      1.1    jruoho     UINT32                  LineNumber,
    468      1.1    jruoho     const char              *FunctionName,
    469      1.1    jruoho     const char              *ModuleName,
    470      1.1    jruoho     UINT32                  ComponentId)
    471      1.1    jruoho {
    472      1.1    jruoho 
    473  1.1.1.3  christos     /* Check if enabled up-front for performance */
    474  1.1.1.3  christos 
    475  1.1.1.3  christos     if (ACPI_IS_DEBUG_ENABLED (ACPI_LV_FUNCTIONS, ComponentId))
    476  1.1.1.3  christos     {
    477  1.1.1.3  christos         AcpiDebugPrint (ACPI_LV_FUNCTIONS,
    478  1.1.1.3  christos             LineNumber, FunctionName, ModuleName, ComponentId,
    479  1.1.1.8  christos             "%s\n", AcpiGbl_FunctionExitPrefix);
    480  1.1.1.3  christos     }
    481      1.1    jruoho 
    482  1.1.1.3  christos     if (AcpiGbl_NestingLevel)
    483  1.1.1.3  christos     {
    484  1.1.1.3  christos         AcpiGbl_NestingLevel--;
    485  1.1.1.3  christos     }
    486      1.1    jruoho }
    487      1.1    jruoho 
    488      1.1    jruoho ACPI_EXPORT_SYMBOL (AcpiUtExit)
    489      1.1    jruoho 
    490      1.1    jruoho 
    491      1.1    jruoho /*******************************************************************************
    492      1.1    jruoho  *
    493      1.1    jruoho  * FUNCTION:    AcpiUtStatusExit
    494      1.1    jruoho  *
    495      1.1    jruoho  * PARAMETERS:  LineNumber          - Caller's line number
    496      1.1    jruoho  *              FunctionName        - Caller's procedure name
    497      1.1    jruoho  *              ModuleName          - Caller's module name
    498      1.1    jruoho  *              ComponentId         - Caller's component ID
    499      1.1    jruoho  *              Status              - Exit status code
    500      1.1    jruoho  *
    501      1.1    jruoho  * RETURN:      None
    502      1.1    jruoho  *
    503  1.1.1.3  christos  * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is
    504  1.1.1.3  christos  *              set in DebugLevel. Prints exit status also.
    505      1.1    jruoho  *
    506      1.1    jruoho  ******************************************************************************/
    507      1.1    jruoho 
    508      1.1    jruoho void
    509      1.1    jruoho AcpiUtStatusExit (
    510      1.1    jruoho     UINT32                  LineNumber,
    511      1.1    jruoho     const char              *FunctionName,
    512      1.1    jruoho     const char              *ModuleName,
    513      1.1    jruoho     UINT32                  ComponentId,
    514      1.1    jruoho     ACPI_STATUS             Status)
    515      1.1    jruoho {
    516      1.1    jruoho 
    517  1.1.1.3  christos     /* Check if enabled up-front for performance */
    518  1.1.1.3  christos 
    519  1.1.1.3  christos     if (ACPI_IS_DEBUG_ENABLED (ACPI_LV_FUNCTIONS, ComponentId))
    520      1.1    jruoho     {
    521  1.1.1.3  christos         if (ACPI_SUCCESS (Status))
    522  1.1.1.3  christos         {
    523  1.1.1.3  christos             AcpiDebugPrint (ACPI_LV_FUNCTIONS,
    524  1.1.1.3  christos                 LineNumber, FunctionName, ModuleName, ComponentId,
    525  1.1.1.8  christos                 "%s %s\n", AcpiGbl_FunctionExitPrefix,
    526  1.1.1.3  christos                 AcpiFormatException (Status));
    527  1.1.1.3  christos         }
    528  1.1.1.3  christos         else
    529  1.1.1.3  christos         {
    530  1.1.1.3  christos             AcpiDebugPrint (ACPI_LV_FUNCTIONS,
    531  1.1.1.3  christos                 LineNumber, FunctionName, ModuleName, ComponentId,
    532  1.1.1.8  christos                 "%s ****Exception****: %s\n", AcpiGbl_FunctionExitPrefix,
    533  1.1.1.3  christos                 AcpiFormatException (Status));
    534  1.1.1.3  christos         }
    535      1.1    jruoho     }
    536  1.1.1.3  christos 
    537  1.1.1.3  christos     if (AcpiGbl_NestingLevel)
    538      1.1    jruoho     {
    539  1.1.1.3  christos         AcpiGbl_NestingLevel--;
    540      1.1    jruoho     }
    541      1.1    jruoho }
    542      1.1    jruoho 
    543      1.1    jruoho ACPI_EXPORT_SYMBOL (AcpiUtStatusExit)
    544      1.1    jruoho 
    545      1.1    jruoho 
    546      1.1    jruoho /*******************************************************************************
    547      1.1    jruoho  *
    548      1.1    jruoho  * FUNCTION:    AcpiUtValueExit
    549      1.1    jruoho  *
    550      1.1    jruoho  * PARAMETERS:  LineNumber          - Caller's line number
    551      1.1    jruoho  *              FunctionName        - Caller's procedure name
    552      1.1    jruoho  *              ModuleName          - Caller's module name
    553      1.1    jruoho  *              ComponentId         - Caller's component ID
    554      1.1    jruoho  *              Value               - Value to be printed with exit msg
    555      1.1    jruoho  *
    556      1.1    jruoho  * RETURN:      None
    557      1.1    jruoho  *
    558  1.1.1.3  christos  * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is
    559  1.1.1.3  christos  *              set in DebugLevel. Prints exit value also.
    560      1.1    jruoho  *
    561      1.1    jruoho  ******************************************************************************/
    562      1.1    jruoho 
    563      1.1    jruoho void
    564      1.1    jruoho AcpiUtValueExit (
    565      1.1    jruoho     UINT32                  LineNumber,
    566      1.1    jruoho     const char              *FunctionName,
    567      1.1    jruoho     const char              *ModuleName,
    568      1.1    jruoho     UINT32                  ComponentId,
    569      1.1    jruoho     UINT64                  Value)
    570      1.1    jruoho {
    571      1.1    jruoho 
    572  1.1.1.3  christos     /* Check if enabled up-front for performance */
    573  1.1.1.3  christos 
    574  1.1.1.3  christos     if (ACPI_IS_DEBUG_ENABLED (ACPI_LV_FUNCTIONS, ComponentId))
    575  1.1.1.3  christos     {
    576  1.1.1.3  christos         AcpiDebugPrint (ACPI_LV_FUNCTIONS,
    577  1.1.1.3  christos             LineNumber, FunctionName, ModuleName, ComponentId,
    578  1.1.1.8  christos             "%s %8.8X%8.8X\n", AcpiGbl_FunctionExitPrefix,
    579  1.1.1.3  christos             ACPI_FORMAT_UINT64 (Value));
    580  1.1.1.3  christos     }
    581      1.1    jruoho 
    582  1.1.1.3  christos     if (AcpiGbl_NestingLevel)
    583  1.1.1.3  christos     {
    584  1.1.1.3  christos         AcpiGbl_NestingLevel--;
    585  1.1.1.3  christos     }
    586      1.1    jruoho }
    587      1.1    jruoho 
    588      1.1    jruoho ACPI_EXPORT_SYMBOL (AcpiUtValueExit)
    589      1.1    jruoho 
    590      1.1    jruoho 
    591      1.1    jruoho /*******************************************************************************
    592      1.1    jruoho  *
    593      1.1    jruoho  * FUNCTION:    AcpiUtPtrExit
    594      1.1    jruoho  *
    595      1.1    jruoho  * PARAMETERS:  LineNumber          - Caller's line number
    596      1.1    jruoho  *              FunctionName        - Caller's procedure name
    597      1.1    jruoho  *              ModuleName          - Caller's module name
    598      1.1    jruoho  *              ComponentId         - Caller's component ID
    599      1.1    jruoho  *              Ptr                 - Pointer to display
    600      1.1    jruoho  *
    601      1.1    jruoho  * RETURN:      None
    602      1.1    jruoho  *
    603  1.1.1.3  christos  * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is
    604  1.1.1.3  christos  *              set in DebugLevel. Prints exit value also.
    605      1.1    jruoho  *
    606      1.1    jruoho  ******************************************************************************/
    607      1.1    jruoho 
    608      1.1    jruoho void
    609      1.1    jruoho AcpiUtPtrExit (
    610      1.1    jruoho     UINT32                  LineNumber,
    611      1.1    jruoho     const char              *FunctionName,
    612      1.1    jruoho     const char              *ModuleName,
    613      1.1    jruoho     UINT32                  ComponentId,
    614      1.1    jruoho     UINT8                   *Ptr)
    615      1.1    jruoho {
    616      1.1    jruoho 
    617  1.1.1.3  christos     /* Check if enabled up-front for performance */
    618      1.1    jruoho 
    619  1.1.1.3  christos     if (ACPI_IS_DEBUG_ENABLED (ACPI_LV_FUNCTIONS, ComponentId))
    620      1.1    jruoho     {
    621  1.1.1.3  christos         AcpiDebugPrint (ACPI_LV_FUNCTIONS,
    622  1.1.1.3  christos             LineNumber, FunctionName, ModuleName, ComponentId,
    623  1.1.1.8  christos             "%s %p\n", AcpiGbl_FunctionExitPrefix, Ptr);
    624      1.1    jruoho     }
    625      1.1    jruoho 
    626  1.1.1.3  christos     if (AcpiGbl_NestingLevel)
    627      1.1    jruoho     {
    628  1.1.1.3  christos         AcpiGbl_NestingLevel--;
    629      1.1    jruoho     }
    630      1.1    jruoho }
    631      1.1    jruoho 
    632  1.1.1.6  christos 
    633  1.1.1.6  christos /*******************************************************************************
    634  1.1.1.6  christos  *
    635  1.1.1.9  christos  * FUNCTION:    AcpiUtStrExit
    636  1.1.1.9  christos  *
    637  1.1.1.9  christos  * PARAMETERS:  LineNumber          - Caller's line number
    638  1.1.1.9  christos  *              FunctionName        - Caller's procedure name
    639  1.1.1.9  christos  *              ModuleName          - Caller's module name
    640  1.1.1.9  christos  *              ComponentId         - Caller's component ID
    641  1.1.1.9  christos  *              String              - String to display
    642  1.1.1.9  christos  *
    643  1.1.1.9  christos  * RETURN:      None
    644  1.1.1.9  christos  *
    645  1.1.1.9  christos  * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is
    646  1.1.1.9  christos  *              set in DebugLevel. Prints exit value also.
    647  1.1.1.9  christos  *
    648  1.1.1.9  christos  ******************************************************************************/
    649  1.1.1.9  christos 
    650  1.1.1.9  christos void
    651  1.1.1.9  christos AcpiUtStrExit (
    652  1.1.1.9  christos     UINT32                  LineNumber,
    653  1.1.1.9  christos     const char              *FunctionName,
    654  1.1.1.9  christos     const char              *ModuleName,
    655  1.1.1.9  christos     UINT32                  ComponentId,
    656  1.1.1.9  christos     const char              *String)
    657  1.1.1.9  christos {
    658  1.1.1.9  christos 
    659  1.1.1.9  christos     /* Check if enabled up-front for performance */
    660  1.1.1.9  christos 
    661  1.1.1.9  christos     if (ACPI_IS_DEBUG_ENABLED (ACPI_LV_FUNCTIONS, ComponentId))
    662  1.1.1.9  christos     {
    663  1.1.1.9  christos         AcpiDebugPrint (ACPI_LV_FUNCTIONS,
    664  1.1.1.9  christos             LineNumber, FunctionName, ModuleName, ComponentId,
    665  1.1.1.9  christos             "%s %s\n", AcpiGbl_FunctionExitPrefix, String);
    666  1.1.1.9  christos     }
    667  1.1.1.9  christos 
    668  1.1.1.9  christos     if (AcpiGbl_NestingLevel)
    669  1.1.1.9  christos     {
    670  1.1.1.9  christos         AcpiGbl_NestingLevel--;
    671  1.1.1.9  christos     }
    672  1.1.1.9  christos }
    673  1.1.1.9  christos 
    674  1.1.1.9  christos 
    675  1.1.1.9  christos /*******************************************************************************
    676  1.1.1.9  christos  *
    677  1.1.1.6  christos  * FUNCTION:    AcpiTracePoint
    678  1.1.1.6  christos  *
    679  1.1.1.6  christos  * PARAMETERS:  Type                - Trace event type
    680  1.1.1.6  christos  *              Begin               - TRUE if before execution
    681  1.1.1.6  christos  *              Aml                 - Executed AML address
    682  1.1.1.6  christos  *              Pathname            - Object path
    683  1.1.1.6  christos  *              Pointer             - Pointer to the related object
    684  1.1.1.6  christos  *
    685  1.1.1.6  christos  * RETURN:      None
    686  1.1.1.6  christos  *
    687  1.1.1.6  christos  * DESCRIPTION: Interpreter execution trace.
    688  1.1.1.6  christos  *
    689  1.1.1.6  christos  ******************************************************************************/
    690  1.1.1.6  christos 
    691  1.1.1.6  christos void
    692  1.1.1.6  christos AcpiTracePoint (
    693  1.1.1.6  christos     ACPI_TRACE_EVENT_TYPE   Type,
    694  1.1.1.6  christos     BOOLEAN                 Begin,
    695  1.1.1.6  christos     UINT8                   *Aml,
    696  1.1.1.6  christos     char                    *Pathname)
    697  1.1.1.6  christos {
    698  1.1.1.6  christos 
    699  1.1.1.6  christos     ACPI_FUNCTION_ENTRY ();
    700  1.1.1.6  christos 
    701  1.1.1.6  christos     AcpiExTracePoint (Type, Begin, Aml, Pathname);
    702  1.1.1.6  christos 
    703  1.1.1.6  christos #ifdef ACPI_USE_SYSTEM_TRACER
    704  1.1.1.6  christos     AcpiOsTracePoint (Type, Begin, Aml, Pathname);
    705  1.1.1.6  christos #endif
    706  1.1.1.6  christos }
    707  1.1.1.6  christos 
    708  1.1.1.6  christos ACPI_EXPORT_SYMBOL (AcpiTracePoint)
    709  1.1.1.6  christos 
    710  1.1.1.3  christos #endif
    711