Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:24:03

0001 /******************************************************************************
0002  *
0003  * Module Name: utdebug - Debug print/trace routines
0004  *
0005  *****************************************************************************/
0006 
0007 /******************************************************************************
0008  *
0009  * 1. Copyright Notice
0010  *
0011  * Some or all of this work - Copyright (c) 1999 - 2024, Intel Corp.
0012  * All rights reserved.
0013  *
0014  * 2. License
0015  *
0016  * 2.1. This is your license from Intel Corp. under its intellectual property
0017  * rights. You may have additional license terms from the party that provided
0018  * you this software, covering your right to use that party's intellectual
0019  * property rights.
0020  *
0021  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
0022  * copy of the source code appearing in this file ("Covered Code") an
0023  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
0024  * base code distributed originally by Intel ("Original Intel Code") to copy,
0025  * make derivatives, distribute, use and display any portion of the Covered
0026  * Code in any form, with the right to sublicense such rights; and
0027  *
0028  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
0029  * license (with the right to sublicense), under only those claims of Intel
0030  * patents that are infringed by the Original Intel Code, to make, use, sell,
0031  * offer to sell, and import the Covered Code and derivative works thereof
0032  * solely to the minimum extent necessary to exercise the above copyright
0033  * license, and in no event shall the patent license extend to any additions
0034  * to or modifications of the Original Intel Code. No other license or right
0035  * is granted directly or by implication, estoppel or otherwise;
0036  *
0037  * The above copyright and patent license is granted only if the following
0038  * conditions are met:
0039  *
0040  * 3. Conditions
0041  *
0042  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
0043  * Redistribution of source code of any substantial portion of the Covered
0044  * Code or modification with rights to further distribute source must include
0045  * the above Copyright Notice, the above License, this list of Conditions,
0046  * and the following Disclaimer and Export Compliance provision. In addition,
0047  * Licensee must cause all Covered Code to which Licensee contributes to
0048  * contain a file documenting the changes Licensee made to create that Covered
0049  * Code and the date of any change. Licensee must include in that file the
0050  * documentation of any changes made by any predecessor Licensee. Licensee
0051  * must include a prominent statement that the modification is derived,
0052  * directly or indirectly, from Original Intel Code.
0053  *
0054  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
0055  * Redistribution of source code of any substantial portion of the Covered
0056  * Code or modification without rights to further distribute source must
0057  * include the following Disclaimer and Export Compliance provision in the
0058  * documentation and/or other materials provided with distribution. In
0059  * addition, Licensee may not authorize further sublicense of source of any
0060  * portion of the Covered Code, and must include terms to the effect that the
0061  * license from Licensee to its licensee is limited to the intellectual
0062  * property embodied in the software Licensee provides to its licensee, and
0063  * not to intellectual property embodied in modifications its licensee may
0064  * make.
0065  *
0066  * 3.3. Redistribution of Executable. Redistribution in executable form of any
0067  * substantial portion of the Covered Code or modification must reproduce the
0068  * above Copyright Notice, and the following Disclaimer and Export Compliance
0069  * provision in the documentation and/or other materials provided with the
0070  * distribution.
0071  *
0072  * 3.4. Intel retains all right, title, and interest in and to the Original
0073  * Intel Code.
0074  *
0075  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
0076  * Intel shall be used in advertising or otherwise to promote the sale, use or
0077  * other dealings in products derived from or relating to the Covered Code
0078  * without prior written authorization from Intel.
0079  *
0080  * 4. Disclaimer and Export Compliance
0081  *
0082  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
0083  * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
0084  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
0085  * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
0086  * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
0087  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
0088  * PARTICULAR PURPOSE.
0089  *
0090  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
0091  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
0092  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
0093  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
0094  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
0095  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
0096  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
0097  * LIMITED REMEDY.
0098  *
0099  * 4.3. Licensee shall not export, either directly or indirectly, any of this
0100  * software or system incorporating such software without first obtaining any
0101  * required license or other approval from the U. S. Department of Commerce or
0102  * any other agency or department of the United States Government. In the
0103  * event Licensee exports any such software from the United States or
0104  * re-exports any such software from a foreign destination, Licensee shall
0105  * ensure that the distribution and export/re-export of the software is in
0106  * compliance with all laws, regulations, orders, or other restrictions of the
0107  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
0108  * any of its subsidiaries will export/re-export any technical data, process,
0109  * software, or service, directly or indirectly, to any country for which the
0110  * United States government or any agency thereof requires an export license,
0111  * other governmental approval, or letter of assurance, without first obtaining
0112  * such license, approval or letter.
0113  *
0114  *****************************************************************************
0115  *
0116  * Alternatively, you may choose to be licensed under the terms of the
0117  * following license:
0118  *
0119  * Redistribution and use in source and binary forms, with or without
0120  * modification, are permitted provided that the following conditions
0121  * are met:
0122  * 1. Redistributions of source code must retain the above copyright
0123  *    notice, this list of conditions, and the following disclaimer,
0124  *    without modification.
0125  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
0126  *    substantially similar to the "NO WARRANTY" disclaimer below
0127  *    ("Disclaimer") and any redistribution must be conditioned upon
0128  *    including a substantially similar Disclaimer requirement for further
0129  *    binary redistribution.
0130  * 3. Neither the names of the above-listed copyright holders nor the names
0131  *    of any contributors may be used to endorse or promote products derived
0132  *    from this software without specific prior written permission.
0133  *
0134  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
0135  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
0136  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
0137  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
0138  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
0139  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
0140  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
0141  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
0142  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
0143  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
0144  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0145  *
0146  * Alternatively, you may choose to be licensed under the terms of the
0147  * GNU General Public License ("GPL") version 2 as published by the Free
0148  * Software Foundation.
0149  *
0150  *****************************************************************************/
0151 
0152 #define EXPORT_ACPI_INTERFACES
0153 
0154 #include "acpi.h"
0155 #include "accommon.h"
0156 #include "acinterp.h"
0157 
0158 #define _COMPONENT          ACPI_UTILITIES
0159         ACPI_MODULE_NAME    ("utdebug")
0160 
0161 
0162 #ifdef ACPI_DEBUG_OUTPUT
0163 
0164 static ACPI_THREAD_ID       AcpiGbl_PreviousThreadId = (ACPI_THREAD_ID) 0xFFFFFFFF;
0165 static const char           *AcpiGbl_FunctionEntryPrefix = "----Entry";
0166 static const char           *AcpiGbl_FunctionExitPrefix  = "----Exit-";
0167 
0168 
0169 /*******************************************************************************
0170  *
0171  * FUNCTION:    AcpiUtInitStackPtrTrace
0172  *
0173  * PARAMETERS:  None
0174  *
0175  * RETURN:      None
0176  *
0177  * DESCRIPTION: Save the current CPU stack pointer at subsystem startup
0178  *
0179  ******************************************************************************/
0180 
0181 void
0182 AcpiUtInitStackPtrTrace (
0183     void)
0184 {
0185     ACPI_SIZE               CurrentSp;
0186 
0187 
0188 #pragma GCC diagnostic push
0189 #if defined(__GNUC__) && __GNUC__ >= 12
0190 #pragma GCC diagnostic ignored "-Wdangling-pointer="
0191 #endif
0192     AcpiGbl_EntryStackPointer = &CurrentSp;
0193 #pragma GCC diagnostic pop
0194 }
0195 
0196 
0197 /*******************************************************************************
0198  *
0199  * FUNCTION:    AcpiUtTrackStackPtr
0200  *
0201  * PARAMETERS:  None
0202  *
0203  * RETURN:      None
0204  *
0205  * DESCRIPTION: Save the current CPU stack pointer
0206  *
0207  ******************************************************************************/
0208 
0209 void
0210 AcpiUtTrackStackPtr (
0211     void)
0212 {
0213     ACPI_SIZE               CurrentSp;
0214 
0215 
0216     if (&CurrentSp < AcpiGbl_LowestStackPointer)
0217     {
0218 #pragma GCC diagnostic push
0219 #if defined(__GNUC__) && __GNUC__ >= 12
0220 #pragma GCC diagnostic ignored "-Wdangling-pointer="
0221 #endif
0222         AcpiGbl_LowestStackPointer = &CurrentSp;
0223 #pragma GCC diagnostic pop
0224     }
0225 
0226     if (AcpiGbl_NestingLevel > AcpiGbl_DeepestNesting)
0227     {
0228         AcpiGbl_DeepestNesting = AcpiGbl_NestingLevel;
0229     }
0230 }
0231 
0232 
0233 /*******************************************************************************
0234  *
0235  * FUNCTION:    AcpiUtTrimFunctionName
0236  *
0237  * PARAMETERS:  FunctionName        - Ascii string containing a procedure name
0238  *
0239  * RETURN:      Updated pointer to the function name
0240  *
0241  * DESCRIPTION: Remove the "Acpi" prefix from the function name, if present.
0242  *              This allows compiler macros such as __FUNCTION__ to be used
0243  *              with no change to the debug output.
0244  *
0245  ******************************************************************************/
0246 
0247 static const char *
0248 AcpiUtTrimFunctionName (
0249     const char              *FunctionName)
0250 {
0251 
0252     /* All Function names are longer than 4 chars, check is safe */
0253 
0254     if (*(ACPI_CAST_PTR (UINT32, FunctionName)) == ACPI_PREFIX_MIXED)
0255     {
0256         /* This is the case where the original source has not been modified */
0257 
0258         return (FunctionName + 4);
0259     }
0260 
0261     if (*(ACPI_CAST_PTR (UINT32, FunctionName)) == ACPI_PREFIX_LOWER)
0262     {
0263         /* This is the case where the source has been 'linuxized' */
0264 
0265         return (FunctionName + 5);
0266     }
0267 
0268     return (FunctionName);
0269 }
0270 
0271 
0272 /*******************************************************************************
0273  *
0274  * FUNCTION:    AcpiDebugPrint
0275  *
0276  * PARAMETERS:  RequestedDebugLevel - Requested debug print level
0277  *              LineNumber          - Caller's line number (for error output)
0278  *              FunctionName        - Caller's procedure name
0279  *              ModuleName          - Caller's module name
0280  *              ComponentId         - Caller's component ID
0281  *              Format              - Printf format field
0282  *              ...                 - Optional printf arguments
0283  *
0284  * RETURN:      None
0285  *
0286  * DESCRIPTION: Print error message with prefix consisting of the module name,
0287  *              line number, and component ID.
0288  *
0289  ******************************************************************************/
0290 
0291 void  ACPI_INTERNAL_VAR_XFACE
0292 AcpiDebugPrint (
0293     UINT32                  RequestedDebugLevel,
0294     UINT32                  LineNumber,
0295     const char              *FunctionName,
0296     const char              *ModuleName,
0297     UINT32                  ComponentId,
0298     const char              *Format,
0299     ...)
0300 {
0301     ACPI_THREAD_ID          ThreadId;
0302     va_list                 args;
0303 #ifdef ACPI_APPLICATION
0304     int                     FillCount;
0305 #endif
0306 
0307     /* Check if debug output enabled */
0308 
0309     if (!ACPI_IS_DEBUG_ENABLED (RequestedDebugLevel, ComponentId))
0310     {
0311         return;
0312     }
0313 
0314     /*
0315      * Thread tracking and context switch notification
0316      */
0317     ThreadId = AcpiOsGetThreadId ();
0318     if (ThreadId != AcpiGbl_PreviousThreadId)
0319     {
0320         if (ACPI_LV_THREADS & AcpiDbgLevel)
0321         {
0322             AcpiOsPrintf (
0323                 "\n**** Context Switch from TID %u to TID %u ****\n\n",
0324                 (UINT32) AcpiGbl_PreviousThreadId, (UINT32) ThreadId);
0325         }
0326 
0327         AcpiGbl_PreviousThreadId = ThreadId;
0328         AcpiGbl_NestingLevel = 0;
0329     }
0330 
0331     /*
0332      * Display the module name, current line number, thread ID (if requested),
0333      * current procedure nesting level, and the current procedure name
0334      */
0335     AcpiOsPrintf ("%9s-%04d ", ModuleName, LineNumber);
0336 
0337 #ifdef ACPI_APPLICATION
0338     /*
0339      * For AcpiExec/iASL only, emit the thread ID and nesting level.
0340      * Note: nesting level is really only useful during a single-thread
0341      * execution. Otherwise, multiple threads will keep resetting the
0342      * level.
0343      */
0344     if (ACPI_LV_THREADS & AcpiDbgLevel)
0345     {
0346         AcpiOsPrintf ("[%u] ", (UINT32) ThreadId);
0347     }
0348 
0349     FillCount = 48 - AcpiGbl_NestingLevel -
0350         strlen (AcpiUtTrimFunctionName (FunctionName));
0351     if (FillCount < 0)
0352     {
0353         FillCount = 0;
0354     }
0355 
0356     AcpiOsPrintf ("[%02d] %*s",
0357         AcpiGbl_NestingLevel, AcpiGbl_NestingLevel + 1, " ");
0358     AcpiOsPrintf ("%s%*s: ",
0359         AcpiUtTrimFunctionName (FunctionName), FillCount, " ");
0360 
0361 #else
0362     AcpiOsPrintf ("%-22.22s: ", AcpiUtTrimFunctionName (FunctionName));
0363 #endif
0364 
0365     va_start (args, Format);
0366     AcpiOsVprintf (Format, args);
0367     va_end (args);
0368 }
0369 
0370 ACPI_EXPORT_SYMBOL (AcpiDebugPrint)
0371 
0372 
0373 /*******************************************************************************
0374  *
0375  * FUNCTION:    AcpiDebugPrintRaw
0376  *
0377  * PARAMETERS:  RequestedDebugLevel - Requested debug print level
0378  *              LineNumber          - Caller's line number
0379  *              FunctionName        - Caller's procedure name
0380  *              ModuleName          - Caller's module name
0381  *              ComponentId         - Caller's component ID
0382  *              Format              - Printf format field
0383  *              ...                 - Optional printf arguments
0384  *
0385  * RETURN:      None
0386  *
0387  * DESCRIPTION: Print message with no headers. Has same interface as
0388  *              DebugPrint so that the same macros can be used.
0389  *
0390  ******************************************************************************/
0391 
0392 void  ACPI_INTERNAL_VAR_XFACE
0393 AcpiDebugPrintRaw (
0394     UINT32                  RequestedDebugLevel,
0395     UINT32                  LineNumber,
0396     const char              *FunctionName,
0397     const char              *ModuleName,
0398     UINT32                  ComponentId,
0399     const char              *Format,
0400     ...)
0401 {
0402     va_list                 args;
0403 
0404 
0405     /* Check if debug output enabled */
0406 
0407     if (!ACPI_IS_DEBUG_ENABLED (RequestedDebugLevel, ComponentId))
0408     {
0409         return;
0410     }
0411 
0412     va_start (args, Format);
0413     AcpiOsVprintf (Format, args);
0414     va_end (args);
0415 }
0416 
0417 ACPI_EXPORT_SYMBOL (AcpiDebugPrintRaw)
0418 
0419 
0420 /*******************************************************************************
0421  *
0422  * FUNCTION:    AcpiUtTrace
0423  *
0424  * PARAMETERS:  LineNumber          - Caller's line number
0425  *              FunctionName        - Caller's procedure name
0426  *              ModuleName          - Caller's module name
0427  *              ComponentId         - Caller's component ID
0428  *
0429  * RETURN:      None
0430  *
0431  * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is
0432  *              set in DebugLevel
0433  *
0434  ******************************************************************************/
0435 
0436 void
0437 AcpiUtTrace (
0438     UINT32                  LineNumber,
0439     const char              *FunctionName,
0440     const char              *ModuleName,
0441     UINT32                  ComponentId)
0442 {
0443 
0444     AcpiGbl_NestingLevel++;
0445     AcpiUtTrackStackPtr ();
0446 
0447     /* Check if enabled up-front for performance */
0448 
0449     if (ACPI_IS_DEBUG_ENABLED (ACPI_LV_FUNCTIONS, ComponentId))
0450     {
0451         AcpiDebugPrint (ACPI_LV_FUNCTIONS,
0452             LineNumber, FunctionName, ModuleName, ComponentId,
0453             "%s\n", AcpiGbl_FunctionEntryPrefix);
0454     }
0455 }
0456 
0457 ACPI_EXPORT_SYMBOL (AcpiUtTrace)
0458 
0459 
0460 /*******************************************************************************
0461  *
0462  * FUNCTION:    AcpiUtTracePtr
0463  *
0464  * PARAMETERS:  LineNumber          - Caller's line number
0465  *              FunctionName        - Caller's procedure name
0466  *              ModuleName          - Caller's module name
0467  *              ComponentId         - Caller's component ID
0468  *              Pointer             - Pointer to display
0469  *
0470  * RETURN:      None
0471  *
0472  * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is
0473  *              set in DebugLevel
0474  *
0475  ******************************************************************************/
0476 
0477 void
0478 AcpiUtTracePtr (
0479     UINT32                  LineNumber,
0480     const char              *FunctionName,
0481     const char              *ModuleName,
0482     UINT32                  ComponentId,
0483     const void              *Pointer)
0484 {
0485 
0486     AcpiGbl_NestingLevel++;
0487     AcpiUtTrackStackPtr ();
0488 
0489     /* Check if enabled up-front for performance */
0490 
0491     if (ACPI_IS_DEBUG_ENABLED (ACPI_LV_FUNCTIONS, ComponentId))
0492     {
0493         AcpiDebugPrint (ACPI_LV_FUNCTIONS,
0494             LineNumber, FunctionName, ModuleName, ComponentId,
0495             "%s %p\n", AcpiGbl_FunctionEntryPrefix, Pointer);
0496     }
0497 }
0498 
0499 
0500 /*******************************************************************************
0501  *
0502  * FUNCTION:    AcpiUtTraceStr
0503  *
0504  * PARAMETERS:  LineNumber          - Caller's line number
0505  *              FunctionName        - Caller's procedure name
0506  *              ModuleName          - Caller's module name
0507  *              ComponentId         - Caller's component ID
0508  *              String              - Additional string to display
0509  *
0510  * RETURN:      None
0511  *
0512  * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is
0513  *              set in DebugLevel
0514  *
0515  ******************************************************************************/
0516 
0517 void
0518 AcpiUtTraceStr (
0519     UINT32                  LineNumber,
0520     const char              *FunctionName,
0521     const char              *ModuleName,
0522     UINT32                  ComponentId,
0523     const char              *String)
0524 {
0525 
0526     AcpiGbl_NestingLevel++;
0527     AcpiUtTrackStackPtr ();
0528 
0529     /* Check if enabled up-front for performance */
0530 
0531     if (ACPI_IS_DEBUG_ENABLED (ACPI_LV_FUNCTIONS, ComponentId))
0532     {
0533         AcpiDebugPrint (ACPI_LV_FUNCTIONS,
0534             LineNumber, FunctionName, ModuleName, ComponentId,
0535             "%s %s\n", AcpiGbl_FunctionEntryPrefix, String);
0536     }
0537 }
0538 
0539 
0540 /*******************************************************************************
0541  *
0542  * FUNCTION:    AcpiUtTraceU32
0543  *
0544  * PARAMETERS:  LineNumber          - Caller's line number
0545  *              FunctionName        - Caller's procedure name
0546  *              ModuleName          - Caller's module name
0547  *              ComponentId         - Caller's component ID
0548  *              Integer             - Integer to display
0549  *
0550  * RETURN:      None
0551  *
0552  * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is
0553  *              set in DebugLevel
0554  *
0555  ******************************************************************************/
0556 
0557 void
0558 AcpiUtTraceU32 (
0559     UINT32                  LineNumber,
0560     const char              *FunctionName,
0561     const char              *ModuleName,
0562     UINT32                  ComponentId,
0563     UINT32                  Integer)
0564 {
0565 
0566     AcpiGbl_NestingLevel++;
0567     AcpiUtTrackStackPtr ();
0568 
0569     /* Check if enabled up-front for performance */
0570 
0571     if (ACPI_IS_DEBUG_ENABLED (ACPI_LV_FUNCTIONS, ComponentId))
0572     {
0573         AcpiDebugPrint (ACPI_LV_FUNCTIONS,
0574             LineNumber, FunctionName, ModuleName, ComponentId,
0575             "%s %08X\n", AcpiGbl_FunctionEntryPrefix, Integer);
0576     }
0577 }
0578 
0579 
0580 /*******************************************************************************
0581  *
0582  * FUNCTION:    AcpiUtExit
0583  *
0584  * PARAMETERS:  LineNumber          - Caller's line number
0585  *              FunctionName        - Caller's procedure name
0586  *              ModuleName          - Caller's module name
0587  *              ComponentId         - Caller's component ID
0588  *
0589  * RETURN:      None
0590  *
0591  * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is
0592  *              set in DebugLevel
0593  *
0594  ******************************************************************************/
0595 
0596 void
0597 AcpiUtExit (
0598     UINT32                  LineNumber,
0599     const char              *FunctionName,
0600     const char              *ModuleName,
0601     UINT32                  ComponentId)
0602 {
0603 
0604     /* Check if enabled up-front for performance */
0605 
0606     if (ACPI_IS_DEBUG_ENABLED (ACPI_LV_FUNCTIONS, ComponentId))
0607     {
0608         AcpiDebugPrint (ACPI_LV_FUNCTIONS,
0609             LineNumber, FunctionName, ModuleName, ComponentId,
0610             "%s\n", AcpiGbl_FunctionExitPrefix);
0611     }
0612 
0613     if (AcpiGbl_NestingLevel)
0614     {
0615         AcpiGbl_NestingLevel--;
0616     }
0617 }
0618 
0619 ACPI_EXPORT_SYMBOL (AcpiUtExit)
0620 
0621 
0622 /*******************************************************************************
0623  *
0624  * FUNCTION:    AcpiUtStatusExit
0625  *
0626  * PARAMETERS:  LineNumber          - Caller's line number
0627  *              FunctionName        - Caller's procedure name
0628  *              ModuleName          - Caller's module name
0629  *              ComponentId         - Caller's component ID
0630  *              Status              - Exit status code
0631  *
0632  * RETURN:      None
0633  *
0634  * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is
0635  *              set in DebugLevel. Prints exit status also.
0636  *
0637  ******************************************************************************/
0638 
0639 void
0640 AcpiUtStatusExit (
0641     UINT32                  LineNumber,
0642     const char              *FunctionName,
0643     const char              *ModuleName,
0644     UINT32                  ComponentId,
0645     ACPI_STATUS             Status)
0646 {
0647 
0648     /* Check if enabled up-front for performance */
0649 
0650     if (ACPI_IS_DEBUG_ENABLED (ACPI_LV_FUNCTIONS, ComponentId))
0651     {
0652         if (ACPI_SUCCESS (Status))
0653         {
0654             AcpiDebugPrint (ACPI_LV_FUNCTIONS,
0655                 LineNumber, FunctionName, ModuleName, ComponentId,
0656                 "%s %s\n", AcpiGbl_FunctionExitPrefix,
0657                 AcpiFormatException (Status));
0658         }
0659         else
0660         {
0661             AcpiDebugPrint (ACPI_LV_FUNCTIONS,
0662                 LineNumber, FunctionName, ModuleName, ComponentId,
0663                 "%s ****Exception****: %s\n", AcpiGbl_FunctionExitPrefix,
0664                 AcpiFormatException (Status));
0665         }
0666     }
0667 
0668     if (AcpiGbl_NestingLevel)
0669     {
0670         AcpiGbl_NestingLevel--;
0671     }
0672 }
0673 
0674 ACPI_EXPORT_SYMBOL (AcpiUtStatusExit)
0675 
0676 
0677 /*******************************************************************************
0678  *
0679  * FUNCTION:    AcpiUtValueExit
0680  *
0681  * PARAMETERS:  LineNumber          - Caller's line number
0682  *              FunctionName        - Caller's procedure name
0683  *              ModuleName          - Caller's module name
0684  *              ComponentId         - Caller's component ID
0685  *              Value               - Value to be printed with exit msg
0686  *
0687  * RETURN:      None
0688  *
0689  * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is
0690  *              set in DebugLevel. Prints exit value also.
0691  *
0692  ******************************************************************************/
0693 
0694 void
0695 AcpiUtValueExit (
0696     UINT32                  LineNumber,
0697     const char              *FunctionName,
0698     const char              *ModuleName,
0699     UINT32                  ComponentId,
0700     UINT64                  Value)
0701 {
0702 
0703     /* Check if enabled up-front for performance */
0704 
0705     if (ACPI_IS_DEBUG_ENABLED (ACPI_LV_FUNCTIONS, ComponentId))
0706     {
0707         AcpiDebugPrint (ACPI_LV_FUNCTIONS,
0708             LineNumber, FunctionName, ModuleName, ComponentId,
0709             "%s %8.8X%8.8X\n", AcpiGbl_FunctionExitPrefix,
0710             ACPI_FORMAT_UINT64 (Value));
0711     }
0712 
0713     if (AcpiGbl_NestingLevel)
0714     {
0715         AcpiGbl_NestingLevel--;
0716     }
0717 }
0718 
0719 ACPI_EXPORT_SYMBOL (AcpiUtValueExit)
0720 
0721 
0722 /*******************************************************************************
0723  *
0724  * FUNCTION:    AcpiUtPtrExit
0725  *
0726  * PARAMETERS:  LineNumber          - Caller's line number
0727  *              FunctionName        - Caller's procedure name
0728  *              ModuleName          - Caller's module name
0729  *              ComponentId         - Caller's component ID
0730  *              Ptr                 - Pointer to display
0731  *
0732  * RETURN:      None
0733  *
0734  * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is
0735  *              set in DebugLevel. Prints exit value also.
0736  *
0737  ******************************************************************************/
0738 
0739 void
0740 AcpiUtPtrExit (
0741     UINT32                  LineNumber,
0742     const char              *FunctionName,
0743     const char              *ModuleName,
0744     UINT32                  ComponentId,
0745     UINT8                   *Ptr)
0746 {
0747 
0748     /* Check if enabled up-front for performance */
0749 
0750     if (ACPI_IS_DEBUG_ENABLED (ACPI_LV_FUNCTIONS, ComponentId))
0751     {
0752         AcpiDebugPrint (ACPI_LV_FUNCTIONS,
0753             LineNumber, FunctionName, ModuleName, ComponentId,
0754             "%s %p\n", AcpiGbl_FunctionExitPrefix, Ptr);
0755     }
0756 
0757     if (AcpiGbl_NestingLevel)
0758     {
0759         AcpiGbl_NestingLevel--;
0760     }
0761 }
0762 
0763 
0764 /*******************************************************************************
0765  *
0766  * FUNCTION:    AcpiUtStrExit
0767  *
0768  * PARAMETERS:  LineNumber          - Caller's line number
0769  *              FunctionName        - Caller's procedure name
0770  *              ModuleName          - Caller's module name
0771  *              ComponentId         - Caller's component ID
0772  *              String              - String to display
0773  *
0774  * RETURN:      None
0775  *
0776  * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is
0777  *              set in DebugLevel. Prints exit value also.
0778  *
0779  ******************************************************************************/
0780 
0781 void
0782 AcpiUtStrExit (
0783     UINT32                  LineNumber,
0784     const char              *FunctionName,
0785     const char              *ModuleName,
0786     UINT32                  ComponentId,
0787     const char              *String)
0788 {
0789 
0790     /* Check if enabled up-front for performance */
0791 
0792     if (ACPI_IS_DEBUG_ENABLED (ACPI_LV_FUNCTIONS, ComponentId))
0793     {
0794         AcpiDebugPrint (ACPI_LV_FUNCTIONS,
0795             LineNumber, FunctionName, ModuleName, ComponentId,
0796             "%s %s\n", AcpiGbl_FunctionExitPrefix, String);
0797     }
0798 
0799     if (AcpiGbl_NestingLevel)
0800     {
0801         AcpiGbl_NestingLevel--;
0802     }
0803 }
0804 
0805 
0806 /*******************************************************************************
0807  *
0808  * FUNCTION:    AcpiTracePoint
0809  *
0810  * PARAMETERS:  Type                - Trace event type
0811  *              Begin               - TRUE if before execution
0812  *              Aml                 - Executed AML address
0813  *              Pathname            - Object path
0814  *              Pointer             - Pointer to the related object
0815  *
0816  * RETURN:      None
0817  *
0818  * DESCRIPTION: Interpreter execution trace.
0819  *
0820  ******************************************************************************/
0821 
0822 void
0823 AcpiTracePoint (
0824     ACPI_TRACE_EVENT_TYPE   Type,
0825     BOOLEAN                 Begin,
0826     UINT8                   *Aml,
0827     char                    *Pathname)
0828 {
0829 
0830     ACPI_FUNCTION_ENTRY ();
0831 
0832     AcpiExTracePoint (Type, Begin, Aml, Pathname);
0833 
0834 #ifdef ACPI_USE_SYSTEM_TRACER
0835     AcpiOsTracePoint (Type, Begin, Aml, Pathname);
0836 #endif
0837 }
0838 
0839 ACPI_EXPORT_SYMBOL (AcpiTracePoint)
0840 
0841 
0842 #endif