10174267aSFredrik Holmqvist /******************************************************************************
20174267aSFredrik Holmqvist *
3c70258b7SJérôme Duval * Module Name: utdebug - Debug print/trace routines
40174267aSFredrik Holmqvist *
50174267aSFredrik Holmqvist *****************************************************************************/
60174267aSFredrik Holmqvist
70174267aSFredrik Holmqvist /******************************************************************************
80174267aSFredrik Holmqvist *
90174267aSFredrik Holmqvist * 1. Copyright Notice
100174267aSFredrik Holmqvist *
11*6dde014fSPulkoMandy * Some or all of this work - Copyright (c) 1999 - 2024, Intel Corp.
120174267aSFredrik Holmqvist * All rights reserved.
130174267aSFredrik Holmqvist *
140174267aSFredrik Holmqvist * 2. License
150174267aSFredrik Holmqvist *
160174267aSFredrik Holmqvist * 2.1. This is your license from Intel Corp. under its intellectual property
170174267aSFredrik Holmqvist * rights. You may have additional license terms from the party that provided
180174267aSFredrik Holmqvist * you this software, covering your right to use that party's intellectual
190174267aSFredrik Holmqvist * property rights.
200174267aSFredrik Holmqvist *
210174267aSFredrik Holmqvist * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
220174267aSFredrik Holmqvist * copy of the source code appearing in this file ("Covered Code") an
230174267aSFredrik Holmqvist * irrevocable, perpetual, worldwide license under Intel's copyrights in the
240174267aSFredrik Holmqvist * base code distributed originally by Intel ("Original Intel Code") to copy,
250174267aSFredrik Holmqvist * make derivatives, distribute, use and display any portion of the Covered
260174267aSFredrik Holmqvist * Code in any form, with the right to sublicense such rights; and
270174267aSFredrik Holmqvist *
280174267aSFredrik Holmqvist * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
290174267aSFredrik Holmqvist * license (with the right to sublicense), under only those claims of Intel
300174267aSFredrik Holmqvist * patents that are infringed by the Original Intel Code, to make, use, sell,
310174267aSFredrik Holmqvist * offer to sell, and import the Covered Code and derivative works thereof
320174267aSFredrik Holmqvist * solely to the minimum extent necessary to exercise the above copyright
330174267aSFredrik Holmqvist * license, and in no event shall the patent license extend to any additions
340174267aSFredrik Holmqvist * to or modifications of the Original Intel Code. No other license or right
350174267aSFredrik Holmqvist * is granted directly or by implication, estoppel or otherwise;
360174267aSFredrik Holmqvist *
370174267aSFredrik Holmqvist * The above copyright and patent license is granted only if the following
380174267aSFredrik Holmqvist * conditions are met:
390174267aSFredrik Holmqvist *
400174267aSFredrik Holmqvist * 3. Conditions
410174267aSFredrik Holmqvist *
420174267aSFredrik Holmqvist * 3.1. Redistribution of Source with Rights to Further Distribute Source.
430174267aSFredrik Holmqvist * Redistribution of source code of any substantial portion of the Covered
440174267aSFredrik Holmqvist * Code or modification with rights to further distribute source must include
450174267aSFredrik Holmqvist * the above Copyright Notice, the above License, this list of Conditions,
460174267aSFredrik Holmqvist * and the following Disclaimer and Export Compliance provision. In addition,
470174267aSFredrik Holmqvist * Licensee must cause all Covered Code to which Licensee contributes to
480174267aSFredrik Holmqvist * contain a file documenting the changes Licensee made to create that Covered
490174267aSFredrik Holmqvist * Code and the date of any change. Licensee must include in that file the
500174267aSFredrik Holmqvist * documentation of any changes made by any predecessor Licensee. Licensee
510174267aSFredrik Holmqvist * must include a prominent statement that the modification is derived,
520174267aSFredrik Holmqvist * directly or indirectly, from Original Intel Code.
530174267aSFredrik Holmqvist *
540174267aSFredrik Holmqvist * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
550174267aSFredrik Holmqvist * Redistribution of source code of any substantial portion of the Covered
560174267aSFredrik Holmqvist * Code or modification without rights to further distribute source must
570174267aSFredrik Holmqvist * include the following Disclaimer and Export Compliance provision in the
580174267aSFredrik Holmqvist * documentation and/or other materials provided with distribution. In
590174267aSFredrik Holmqvist * addition, Licensee may not authorize further sublicense of source of any
600174267aSFredrik Holmqvist * portion of the Covered Code, and must include terms to the effect that the
610174267aSFredrik Holmqvist * license from Licensee to its licensee is limited to the intellectual
620174267aSFredrik Holmqvist * property embodied in the software Licensee provides to its licensee, and
630174267aSFredrik Holmqvist * not to intellectual property embodied in modifications its licensee may
640174267aSFredrik Holmqvist * make.
650174267aSFredrik Holmqvist *
660174267aSFredrik Holmqvist * 3.3. Redistribution of Executable. Redistribution in executable form of any
670174267aSFredrik Holmqvist * substantial portion of the Covered Code or modification must reproduce the
680174267aSFredrik Holmqvist * above Copyright Notice, and the following Disclaimer and Export Compliance
690174267aSFredrik Holmqvist * provision in the documentation and/or other materials provided with the
700174267aSFredrik Holmqvist * distribution.
710174267aSFredrik Holmqvist *
720174267aSFredrik Holmqvist * 3.4. Intel retains all right, title, and interest in and to the Original
730174267aSFredrik Holmqvist * Intel Code.
740174267aSFredrik Holmqvist *
750174267aSFredrik Holmqvist * 3.5. Neither the name Intel nor any other trademark owned or controlled by
760174267aSFredrik Holmqvist * Intel shall be used in advertising or otherwise to promote the sale, use or
770174267aSFredrik Holmqvist * other dealings in products derived from or relating to the Covered Code
780174267aSFredrik Holmqvist * without prior written authorization from Intel.
790174267aSFredrik Holmqvist *
800174267aSFredrik Holmqvist * 4. Disclaimer and Export Compliance
810174267aSFredrik Holmqvist *
820174267aSFredrik Holmqvist * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
830174267aSFredrik Holmqvist * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
840174267aSFredrik Holmqvist * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
850174267aSFredrik Holmqvist * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
860174267aSFredrik Holmqvist * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
870174267aSFredrik Holmqvist * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
880174267aSFredrik Holmqvist * PARTICULAR PURPOSE.
890174267aSFredrik Holmqvist *
900174267aSFredrik Holmqvist * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
910174267aSFredrik Holmqvist * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
920174267aSFredrik Holmqvist * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
930174267aSFredrik Holmqvist * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
940174267aSFredrik Holmqvist * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
950174267aSFredrik Holmqvist * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
960174267aSFredrik Holmqvist * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
970174267aSFredrik Holmqvist * LIMITED REMEDY.
980174267aSFredrik Holmqvist *
990174267aSFredrik Holmqvist * 4.3. Licensee shall not export, either directly or indirectly, any of this
1000174267aSFredrik Holmqvist * software or system incorporating such software without first obtaining any
1010174267aSFredrik Holmqvist * required license or other approval from the U. S. Department of Commerce or
1020174267aSFredrik Holmqvist * any other agency or department of the United States Government. In the
1030174267aSFredrik Holmqvist * event Licensee exports any such software from the United States or
1040174267aSFredrik Holmqvist * re-exports any such software from a foreign destination, Licensee shall
1050174267aSFredrik Holmqvist * ensure that the distribution and export/re-export of the software is in
1060174267aSFredrik Holmqvist * compliance with all laws, regulations, orders, or other restrictions of the
1070174267aSFredrik Holmqvist * U.S. Export Administration Regulations. Licensee agrees that neither it nor
1080174267aSFredrik Holmqvist * any of its subsidiaries will export/re-export any technical data, process,
1090174267aSFredrik Holmqvist * software, or service, directly or indirectly, to any country for which the
1100174267aSFredrik Holmqvist * United States government or any agency thereof requires an export license,
1110174267aSFredrik Holmqvist * other governmental approval, or letter of assurance, without first obtaining
1120174267aSFredrik Holmqvist * such license, approval or letter.
1130174267aSFredrik Holmqvist *
114ff2e2f81SFredrik Holmqvist *****************************************************************************
115ff2e2f81SFredrik Holmqvist *
116ff2e2f81SFredrik Holmqvist * Alternatively, you may choose to be licensed under the terms of the
117ff2e2f81SFredrik Holmqvist * following license:
118ff2e2f81SFredrik Holmqvist *
119ff2e2f81SFredrik Holmqvist * Redistribution and use in source and binary forms, with or without
120ff2e2f81SFredrik Holmqvist * modification, are permitted provided that the following conditions
121ff2e2f81SFredrik Holmqvist * are met:
122ff2e2f81SFredrik Holmqvist * 1. Redistributions of source code must retain the above copyright
123ff2e2f81SFredrik Holmqvist * notice, this list of conditions, and the following disclaimer,
124ff2e2f81SFredrik Holmqvist * without modification.
125ff2e2f81SFredrik Holmqvist * 2. Redistributions in binary form must reproduce at minimum a disclaimer
126ff2e2f81SFredrik Holmqvist * substantially similar to the "NO WARRANTY" disclaimer below
127ff2e2f81SFredrik Holmqvist * ("Disclaimer") and any redistribution must be conditioned upon
128ff2e2f81SFredrik Holmqvist * including a substantially similar Disclaimer requirement for further
129ff2e2f81SFredrik Holmqvist * binary redistribution.
130ff2e2f81SFredrik Holmqvist * 3. Neither the names of the above-listed copyright holders nor the names
131ff2e2f81SFredrik Holmqvist * of any contributors may be used to endorse or promote products derived
132ff2e2f81SFredrik Holmqvist * from this software without specific prior written permission.
133ff2e2f81SFredrik Holmqvist *
134ff2e2f81SFredrik Holmqvist * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
135ff2e2f81SFredrik Holmqvist * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
136ff2e2f81SFredrik Holmqvist * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
137ff2e2f81SFredrik Holmqvist * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
138ff2e2f81SFredrik Holmqvist * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
139ff2e2f81SFredrik Holmqvist * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
140ff2e2f81SFredrik Holmqvist * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
141ff2e2f81SFredrik Holmqvist * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
142ff2e2f81SFredrik Holmqvist * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
143ff2e2f81SFredrik Holmqvist * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
144ff2e2f81SFredrik Holmqvist * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
145ff2e2f81SFredrik Holmqvist *
146ff2e2f81SFredrik Holmqvist * Alternatively, you may choose to be licensed under the terms of the
147ff2e2f81SFredrik Holmqvist * GNU General Public License ("GPL") version 2 as published by the Free
148ff2e2f81SFredrik Holmqvist * Software Foundation.
149ff2e2f81SFredrik Holmqvist *
1500174267aSFredrik Holmqvist *****************************************************************************/
1510174267aSFredrik Holmqvist
152ad5bbfb8SFredrik Holmqvist #define EXPORT_ACPI_INTERFACES
1530174267aSFredrik Holmqvist
1540174267aSFredrik Holmqvist #include "acpi.h"
1550174267aSFredrik Holmqvist #include "accommon.h"
156e226d1d0SFredrik Holmqvist #include "acinterp.h"
1570174267aSFredrik Holmqvist
1580174267aSFredrik Holmqvist #define _COMPONENT ACPI_UTILITIES
1590174267aSFredrik Holmqvist ACPI_MODULE_NAME ("utdebug")
1600174267aSFredrik Holmqvist
1610174267aSFredrik Holmqvist
1620174267aSFredrik Holmqvist #ifdef ACPI_DEBUG_OUTPUT
1630174267aSFredrik Holmqvist
16474ffd18dSFredrik Holmqvist static ACPI_THREAD_ID AcpiGbl_PreviousThreadId = (ACPI_THREAD_ID) 0xFFFFFFFF;
16574ffd18dSFredrik Holmqvist static const char *AcpiGbl_FunctionEntryPrefix = "----Entry";
16674ffd18dSFredrik Holmqvist static const char *AcpiGbl_FunctionExitPrefix = "----Exit-";
1670174267aSFredrik Holmqvist
1680174267aSFredrik Holmqvist
1690174267aSFredrik Holmqvist /*******************************************************************************
1700174267aSFredrik Holmqvist *
1710174267aSFredrik Holmqvist * FUNCTION: AcpiUtInitStackPtrTrace
1720174267aSFredrik Holmqvist *
1730174267aSFredrik Holmqvist * PARAMETERS: None
1740174267aSFredrik Holmqvist *
1750174267aSFredrik Holmqvist * RETURN: None
1760174267aSFredrik Holmqvist *
1770174267aSFredrik Holmqvist * DESCRIPTION: Save the current CPU stack pointer at subsystem startup
1780174267aSFredrik Holmqvist *
1790174267aSFredrik Holmqvist ******************************************************************************/
1800174267aSFredrik Holmqvist
1810174267aSFredrik Holmqvist void
AcpiUtInitStackPtrTrace(void)1820174267aSFredrik Holmqvist AcpiUtInitStackPtrTrace (
1830174267aSFredrik Holmqvist void)
1840174267aSFredrik Holmqvist {
1850174267aSFredrik Holmqvist ACPI_SIZE CurrentSp;
1860174267aSFredrik Holmqvist
1870174267aSFredrik Holmqvist
18815338de9SPulkoMandy #pragma GCC diagnostic push
18915338de9SPulkoMandy #if defined(__GNUC__) && __GNUC__ >= 12
19015338de9SPulkoMandy #pragma GCC diagnostic ignored "-Wdangling-pointer="
19115338de9SPulkoMandy #endif
1920174267aSFredrik Holmqvist AcpiGbl_EntryStackPointer = &CurrentSp;
19315338de9SPulkoMandy #pragma GCC diagnostic pop
1940174267aSFredrik Holmqvist }
1950174267aSFredrik Holmqvist
1960174267aSFredrik Holmqvist
1970174267aSFredrik Holmqvist /*******************************************************************************
1980174267aSFredrik Holmqvist *
1990174267aSFredrik Holmqvist * FUNCTION: AcpiUtTrackStackPtr
2000174267aSFredrik Holmqvist *
2010174267aSFredrik Holmqvist * PARAMETERS: None
2020174267aSFredrik Holmqvist *
2030174267aSFredrik Holmqvist * RETURN: None
2040174267aSFredrik Holmqvist *
2050174267aSFredrik Holmqvist * DESCRIPTION: Save the current CPU stack pointer
2060174267aSFredrik Holmqvist *
2070174267aSFredrik Holmqvist ******************************************************************************/
2080174267aSFredrik Holmqvist
2090174267aSFredrik Holmqvist void
AcpiUtTrackStackPtr(void)2100174267aSFredrik Holmqvist AcpiUtTrackStackPtr (
2110174267aSFredrik Holmqvist void)
2120174267aSFredrik Holmqvist {
2130174267aSFredrik Holmqvist ACPI_SIZE CurrentSp;
2140174267aSFredrik Holmqvist
2150174267aSFredrik Holmqvist
2160174267aSFredrik Holmqvist if (&CurrentSp < AcpiGbl_LowestStackPointer)
2170174267aSFredrik Holmqvist {
218*6dde014fSPulkoMandy #pragma GCC diagnostic push
219*6dde014fSPulkoMandy #if defined(__GNUC__) && __GNUC__ >= 12
220*6dde014fSPulkoMandy #pragma GCC diagnostic ignored "-Wdangling-pointer="
221*6dde014fSPulkoMandy #endif
2220174267aSFredrik Holmqvist AcpiGbl_LowestStackPointer = &CurrentSp;
223*6dde014fSPulkoMandy #pragma GCC diagnostic pop
2240174267aSFredrik Holmqvist }
2250174267aSFredrik Holmqvist
2260174267aSFredrik Holmqvist if (AcpiGbl_NestingLevel > AcpiGbl_DeepestNesting)
2270174267aSFredrik Holmqvist {
2280174267aSFredrik Holmqvist AcpiGbl_DeepestNesting = AcpiGbl_NestingLevel;
2290174267aSFredrik Holmqvist }
2300174267aSFredrik Holmqvist }
2310174267aSFredrik Holmqvist
2320174267aSFredrik Holmqvist
2330174267aSFredrik Holmqvist /*******************************************************************************
2340174267aSFredrik Holmqvist *
2350174267aSFredrik Holmqvist * FUNCTION: AcpiUtTrimFunctionName
2360174267aSFredrik Holmqvist *
2370174267aSFredrik Holmqvist * PARAMETERS: FunctionName - Ascii string containing a procedure name
2380174267aSFredrik Holmqvist *
2390174267aSFredrik Holmqvist * RETURN: Updated pointer to the function name
2400174267aSFredrik Holmqvist *
2410174267aSFredrik Holmqvist * DESCRIPTION: Remove the "Acpi" prefix from the function name, if present.
2420174267aSFredrik Holmqvist * This allows compiler macros such as __FUNCTION__ to be used
2430174267aSFredrik Holmqvist * with no change to the debug output.
2440174267aSFredrik Holmqvist *
2450174267aSFredrik Holmqvist ******************************************************************************/
2460174267aSFredrik Holmqvist
2470174267aSFredrik Holmqvist static const char *
AcpiUtTrimFunctionName(const char * FunctionName)2480174267aSFredrik Holmqvist AcpiUtTrimFunctionName (
2490174267aSFredrik Holmqvist const char *FunctionName)
2500174267aSFredrik Holmqvist {
2510174267aSFredrik Holmqvist
2520174267aSFredrik Holmqvist /* All Function names are longer than 4 chars, check is safe */
2530174267aSFredrik Holmqvist
2540174267aSFredrik Holmqvist if (*(ACPI_CAST_PTR (UINT32, FunctionName)) == ACPI_PREFIX_MIXED)
2550174267aSFredrik Holmqvist {
2560174267aSFredrik Holmqvist /* This is the case where the original source has not been modified */
2570174267aSFredrik Holmqvist
2580174267aSFredrik Holmqvist return (FunctionName + 4);
2590174267aSFredrik Holmqvist }
2600174267aSFredrik Holmqvist
2610174267aSFredrik Holmqvist if (*(ACPI_CAST_PTR (UINT32, FunctionName)) == ACPI_PREFIX_LOWER)
2620174267aSFredrik Holmqvist {
2630174267aSFredrik Holmqvist /* This is the case where the source has been 'linuxized' */
2640174267aSFredrik Holmqvist
2650174267aSFredrik Holmqvist return (FunctionName + 5);
2660174267aSFredrik Holmqvist }
2670174267aSFredrik Holmqvist
2680174267aSFredrik Holmqvist return (FunctionName);
2690174267aSFredrik Holmqvist }
2700174267aSFredrik Holmqvist
2710174267aSFredrik Holmqvist
2720174267aSFredrik Holmqvist /*******************************************************************************
2730174267aSFredrik Holmqvist *
2740174267aSFredrik Holmqvist * FUNCTION: AcpiDebugPrint
2750174267aSFredrik Holmqvist *
2760174267aSFredrik Holmqvist * PARAMETERS: RequestedDebugLevel - Requested debug print level
2770174267aSFredrik Holmqvist * LineNumber - Caller's line number (for error output)
2780174267aSFredrik Holmqvist * FunctionName - Caller's procedure name
2790174267aSFredrik Holmqvist * ModuleName - Caller's module name
2800174267aSFredrik Holmqvist * ComponentId - Caller's component ID
2810174267aSFredrik Holmqvist * Format - Printf format field
2820174267aSFredrik Holmqvist * ... - Optional printf arguments
2830174267aSFredrik Holmqvist *
2840174267aSFredrik Holmqvist * RETURN: None
2850174267aSFredrik Holmqvist *
2860174267aSFredrik Holmqvist * DESCRIPTION: Print error message with prefix consisting of the module name,
2870174267aSFredrik Holmqvist * line number, and component ID.
2880174267aSFredrik Holmqvist *
2890174267aSFredrik Holmqvist ******************************************************************************/
2900174267aSFredrik Holmqvist
2910174267aSFredrik Holmqvist void ACPI_INTERNAL_VAR_XFACE
AcpiDebugPrint(UINT32 RequestedDebugLevel,UINT32 LineNumber,const char * FunctionName,const char * ModuleName,UINT32 ComponentId,const char * Format,...)2920174267aSFredrik Holmqvist AcpiDebugPrint (
2930174267aSFredrik Holmqvist UINT32 RequestedDebugLevel,
2940174267aSFredrik Holmqvist UINT32 LineNumber,
2950174267aSFredrik Holmqvist const char *FunctionName,
2960174267aSFredrik Holmqvist const char *ModuleName,
2970174267aSFredrik Holmqvist UINT32 ComponentId,
2980174267aSFredrik Holmqvist const char *Format,
2990174267aSFredrik Holmqvist ...)
3000174267aSFredrik Holmqvist {
3010174267aSFredrik Holmqvist ACPI_THREAD_ID ThreadId;
3020174267aSFredrik Holmqvist va_list args;
303ff2e2f81SFredrik Holmqvist #ifdef ACPI_APPLICATION
304ff2e2f81SFredrik Holmqvist int FillCount;
305ff2e2f81SFredrik Holmqvist #endif
3060174267aSFredrik Holmqvist
307c70258b7SJérôme Duval /* Check if debug output enabled */
308c70258b7SJérôme Duval
309c70258b7SJérôme Duval if (!ACPI_IS_DEBUG_ENABLED (RequestedDebugLevel, ComponentId))
3100174267aSFredrik Holmqvist {
3110174267aSFredrik Holmqvist return;
3120174267aSFredrik Holmqvist }
3130174267aSFredrik Holmqvist
3140174267aSFredrik Holmqvist /*
3150174267aSFredrik Holmqvist * Thread tracking and context switch notification
3160174267aSFredrik Holmqvist */
3170174267aSFredrik Holmqvist ThreadId = AcpiOsGetThreadId ();
31874ffd18dSFredrik Holmqvist if (ThreadId != AcpiGbl_PreviousThreadId)
3190174267aSFredrik Holmqvist {
3200174267aSFredrik Holmqvist if (ACPI_LV_THREADS & AcpiDbgLevel)
3210174267aSFredrik Holmqvist {
3220174267aSFredrik Holmqvist AcpiOsPrintf (
3230174267aSFredrik Holmqvist "\n**** Context Switch from TID %u to TID %u ****\n\n",
32474ffd18dSFredrik Holmqvist (UINT32) AcpiGbl_PreviousThreadId, (UINT32) ThreadId);
3250174267aSFredrik Holmqvist }
3260174267aSFredrik Holmqvist
32774ffd18dSFredrik Holmqvist AcpiGbl_PreviousThreadId = ThreadId;
328ad5bbfb8SFredrik Holmqvist AcpiGbl_NestingLevel = 0;
3290174267aSFredrik Holmqvist }
3300174267aSFredrik Holmqvist
3310174267aSFredrik Holmqvist /*
3320174267aSFredrik Holmqvist * Display the module name, current line number, thread ID (if requested),
3330174267aSFredrik Holmqvist * current procedure nesting level, and the current procedure name
3340174267aSFredrik Holmqvist */
3350ffed378SFredrik Holmqvist AcpiOsPrintf ("%9s-%04d ", ModuleName, LineNumber);
3360174267aSFredrik Holmqvist
337ad5bbfb8SFredrik Holmqvist #ifdef ACPI_APPLICATION
338ad5bbfb8SFredrik Holmqvist /*
339ad5bbfb8SFredrik Holmqvist * For AcpiExec/iASL only, emit the thread ID and nesting level.
340ad5bbfb8SFredrik Holmqvist * Note: nesting level is really only useful during a single-thread
341ad5bbfb8SFredrik Holmqvist * execution. Otherwise, multiple threads will keep resetting the
342ad5bbfb8SFredrik Holmqvist * level.
343ad5bbfb8SFredrik Holmqvist */
3440174267aSFredrik Holmqvist if (ACPI_LV_THREADS & AcpiDbgLevel)
3450174267aSFredrik Holmqvist {
3460174267aSFredrik Holmqvist AcpiOsPrintf ("[%u] ", (UINT32) ThreadId);
3470174267aSFredrik Holmqvist }
3480174267aSFredrik Holmqvist
349ff2e2f81SFredrik Holmqvist FillCount = 48 - AcpiGbl_NestingLevel -
350ff2e2f81SFredrik Holmqvist strlen (AcpiUtTrimFunctionName (FunctionName));
351ff2e2f81SFredrik Holmqvist if (FillCount < 0)
352ff2e2f81SFredrik Holmqvist {
353ff2e2f81SFredrik Holmqvist FillCount = 0;
354ff2e2f81SFredrik Holmqvist }
355ad5bbfb8SFredrik Holmqvist
3560ffed378SFredrik Holmqvist AcpiOsPrintf ("[%02d] %*s",
357ff2e2f81SFredrik Holmqvist AcpiGbl_NestingLevel, AcpiGbl_NestingLevel + 1, " ");
358ff2e2f81SFredrik Holmqvist AcpiOsPrintf ("%s%*s: ",
359ff2e2f81SFredrik Holmqvist AcpiUtTrimFunctionName (FunctionName), FillCount, " ");
360ff2e2f81SFredrik Holmqvist
361ff2e2f81SFredrik Holmqvist #else
362ad5bbfb8SFredrik Holmqvist AcpiOsPrintf ("%-22.22s: ", AcpiUtTrimFunctionName (FunctionName));
363ff2e2f81SFredrik Holmqvist #endif
3640174267aSFredrik Holmqvist
3650174267aSFredrik Holmqvist va_start (args, Format);
3660174267aSFredrik Holmqvist AcpiOsVprintf (Format, args);
3670174267aSFredrik Holmqvist va_end (args);
3680174267aSFredrik Holmqvist }
3690174267aSFredrik Holmqvist
ACPI_EXPORT_SYMBOL(AcpiDebugPrint)3700174267aSFredrik Holmqvist ACPI_EXPORT_SYMBOL (AcpiDebugPrint)
3710174267aSFredrik Holmqvist
3720174267aSFredrik Holmqvist
3730174267aSFredrik Holmqvist /*******************************************************************************
3740174267aSFredrik Holmqvist *
3750174267aSFredrik Holmqvist * FUNCTION: AcpiDebugPrintRaw
3760174267aSFredrik Holmqvist *
3770174267aSFredrik Holmqvist * PARAMETERS: RequestedDebugLevel - Requested debug print level
3780174267aSFredrik Holmqvist * LineNumber - Caller's line number
3790174267aSFredrik Holmqvist * FunctionName - Caller's procedure name
3800174267aSFredrik Holmqvist * ModuleName - Caller's module name
3810174267aSFredrik Holmqvist * ComponentId - Caller's component ID
3820174267aSFredrik Holmqvist * Format - Printf format field
3830174267aSFredrik Holmqvist * ... - Optional printf arguments
3840174267aSFredrik Holmqvist *
3850174267aSFredrik Holmqvist * RETURN: None
3860174267aSFredrik Holmqvist *
3870174267aSFredrik Holmqvist * DESCRIPTION: Print message with no headers. Has same interface as
3880174267aSFredrik Holmqvist * DebugPrint so that the same macros can be used.
3890174267aSFredrik Holmqvist *
3900174267aSFredrik Holmqvist ******************************************************************************/
3910174267aSFredrik Holmqvist
3920174267aSFredrik Holmqvist void ACPI_INTERNAL_VAR_XFACE
3930174267aSFredrik Holmqvist AcpiDebugPrintRaw (
3940174267aSFredrik Holmqvist UINT32 RequestedDebugLevel,
3950174267aSFredrik Holmqvist UINT32 LineNumber,
3960174267aSFredrik Holmqvist const char *FunctionName,
3970174267aSFredrik Holmqvist const char *ModuleName,
3980174267aSFredrik Holmqvist UINT32 ComponentId,
3990174267aSFredrik Holmqvist const char *Format,
4000174267aSFredrik Holmqvist ...)
4010174267aSFredrik Holmqvist {
4020174267aSFredrik Holmqvist va_list args;
4030174267aSFredrik Holmqvist
4040174267aSFredrik Holmqvist
405c70258b7SJérôme Duval /* Check if debug output enabled */
406c70258b7SJérôme Duval
407c70258b7SJérôme Duval if (!ACPI_IS_DEBUG_ENABLED (RequestedDebugLevel, ComponentId))
4080174267aSFredrik Holmqvist {
4090174267aSFredrik Holmqvist return;
4100174267aSFredrik Holmqvist }
4110174267aSFredrik Holmqvist
4120174267aSFredrik Holmqvist va_start (args, Format);
4130174267aSFredrik Holmqvist AcpiOsVprintf (Format, args);
4140174267aSFredrik Holmqvist va_end (args);
4150174267aSFredrik Holmqvist }
4160174267aSFredrik Holmqvist
ACPI_EXPORT_SYMBOL(AcpiDebugPrintRaw)4170174267aSFredrik Holmqvist ACPI_EXPORT_SYMBOL (AcpiDebugPrintRaw)
4180174267aSFredrik Holmqvist
4190174267aSFredrik Holmqvist
4200174267aSFredrik Holmqvist /*******************************************************************************
4210174267aSFredrik Holmqvist *
4220174267aSFredrik Holmqvist * FUNCTION: AcpiUtTrace
4230174267aSFredrik Holmqvist *
4240174267aSFredrik Holmqvist * PARAMETERS: LineNumber - Caller's line number
4250174267aSFredrik Holmqvist * FunctionName - Caller's procedure name
4260174267aSFredrik Holmqvist * ModuleName - Caller's module name
4270174267aSFredrik Holmqvist * ComponentId - Caller's component ID
4280174267aSFredrik Holmqvist *
4290174267aSFredrik Holmqvist * RETURN: None
4300174267aSFredrik Holmqvist *
4310174267aSFredrik Holmqvist * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is
4320174267aSFredrik Holmqvist * set in DebugLevel
4330174267aSFredrik Holmqvist *
4340174267aSFredrik Holmqvist ******************************************************************************/
4350174267aSFredrik Holmqvist
4360174267aSFredrik Holmqvist void
4370174267aSFredrik Holmqvist AcpiUtTrace (
4380174267aSFredrik Holmqvist UINT32 LineNumber,
4390174267aSFredrik Holmqvist const char *FunctionName,
4400174267aSFredrik Holmqvist const char *ModuleName,
4410174267aSFredrik Holmqvist UINT32 ComponentId)
4420174267aSFredrik Holmqvist {
4430174267aSFredrik Holmqvist
4440174267aSFredrik Holmqvist AcpiGbl_NestingLevel++;
4450174267aSFredrik Holmqvist AcpiUtTrackStackPtr ();
4460174267aSFredrik Holmqvist
447c70258b7SJérôme Duval /* Check if enabled up-front for performance */
448c70258b7SJérôme Duval
449c70258b7SJérôme Duval if (ACPI_IS_DEBUG_ENABLED (ACPI_LV_FUNCTIONS, ComponentId))
450c70258b7SJérôme Duval {
4510174267aSFredrik Holmqvist AcpiDebugPrint (ACPI_LV_FUNCTIONS,
4520174267aSFredrik Holmqvist LineNumber, FunctionName, ModuleName, ComponentId,
45374ffd18dSFredrik Holmqvist "%s\n", AcpiGbl_FunctionEntryPrefix);
4540174267aSFredrik Holmqvist }
455c70258b7SJérôme Duval }
4560174267aSFredrik Holmqvist
ACPI_EXPORT_SYMBOL(AcpiUtTrace)4570174267aSFredrik Holmqvist ACPI_EXPORT_SYMBOL (AcpiUtTrace)
4580174267aSFredrik Holmqvist
4590174267aSFredrik Holmqvist
4600174267aSFredrik Holmqvist /*******************************************************************************
4610174267aSFredrik Holmqvist *
4620174267aSFredrik Holmqvist * FUNCTION: AcpiUtTracePtr
4630174267aSFredrik Holmqvist *
4640174267aSFredrik Holmqvist * PARAMETERS: LineNumber - Caller's line number
4650174267aSFredrik Holmqvist * FunctionName - Caller's procedure name
4660174267aSFredrik Holmqvist * ModuleName - Caller's module name
4670174267aSFredrik Holmqvist * ComponentId - Caller's component ID
4680174267aSFredrik Holmqvist * Pointer - Pointer to display
4690174267aSFredrik Holmqvist *
4700174267aSFredrik Holmqvist * RETURN: None
4710174267aSFredrik Holmqvist *
4720174267aSFredrik Holmqvist * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is
4730174267aSFredrik Holmqvist * set in DebugLevel
4740174267aSFredrik Holmqvist *
4750174267aSFredrik Holmqvist ******************************************************************************/
4760174267aSFredrik Holmqvist
4770174267aSFredrik Holmqvist void
4780174267aSFredrik Holmqvist AcpiUtTracePtr (
4790174267aSFredrik Holmqvist UINT32 LineNumber,
4800174267aSFredrik Holmqvist const char *FunctionName,
4810174267aSFredrik Holmqvist const char *ModuleName,
4820174267aSFredrik Holmqvist UINT32 ComponentId,
48374ffd18dSFredrik Holmqvist const void *Pointer)
4840174267aSFredrik Holmqvist {
4859b0d045cSFredrik Holmqvist
4860174267aSFredrik Holmqvist AcpiGbl_NestingLevel++;
4870174267aSFredrik Holmqvist AcpiUtTrackStackPtr ();
4880174267aSFredrik Holmqvist
489c70258b7SJérôme Duval /* Check if enabled up-front for performance */
490c70258b7SJérôme Duval
491c70258b7SJérôme Duval if (ACPI_IS_DEBUG_ENABLED (ACPI_LV_FUNCTIONS, ComponentId))
492c70258b7SJérôme Duval {
4930174267aSFredrik Holmqvist AcpiDebugPrint (ACPI_LV_FUNCTIONS,
4940174267aSFredrik Holmqvist LineNumber, FunctionName, ModuleName, ComponentId,
49574ffd18dSFredrik Holmqvist "%s %p\n", AcpiGbl_FunctionEntryPrefix, Pointer);
4960174267aSFredrik Holmqvist }
497c70258b7SJérôme Duval }
4980174267aSFredrik Holmqvist
4990174267aSFredrik Holmqvist
5000174267aSFredrik Holmqvist /*******************************************************************************
5010174267aSFredrik Holmqvist *
5020174267aSFredrik Holmqvist * FUNCTION: AcpiUtTraceStr
5030174267aSFredrik Holmqvist *
5040174267aSFredrik Holmqvist * PARAMETERS: LineNumber - Caller's line number
5050174267aSFredrik Holmqvist * FunctionName - Caller's procedure name
5060174267aSFredrik Holmqvist * ModuleName - Caller's module name
5070174267aSFredrik Holmqvist * ComponentId - Caller's component ID
5080174267aSFredrik Holmqvist * String - Additional string to display
5090174267aSFredrik Holmqvist *
5100174267aSFredrik Holmqvist * RETURN: None
5110174267aSFredrik Holmqvist *
5120174267aSFredrik Holmqvist * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is
5130174267aSFredrik Holmqvist * set in DebugLevel
5140174267aSFredrik Holmqvist *
5150174267aSFredrik Holmqvist ******************************************************************************/
5160174267aSFredrik Holmqvist
5170174267aSFredrik Holmqvist void
AcpiUtTraceStr(UINT32 LineNumber,const char * FunctionName,const char * ModuleName,UINT32 ComponentId,const char * String)5180174267aSFredrik Holmqvist AcpiUtTraceStr (
5190174267aSFredrik Holmqvist UINT32 LineNumber,
5200174267aSFredrik Holmqvist const char *FunctionName,
5210174267aSFredrik Holmqvist const char *ModuleName,
5220174267aSFredrik Holmqvist UINT32 ComponentId,
52374ffd18dSFredrik Holmqvist const char *String)
5240174267aSFredrik Holmqvist {
5250174267aSFredrik Holmqvist
5260174267aSFredrik Holmqvist AcpiGbl_NestingLevel++;
5270174267aSFredrik Holmqvist AcpiUtTrackStackPtr ();
5280174267aSFredrik Holmqvist
529c70258b7SJérôme Duval /* Check if enabled up-front for performance */
530c70258b7SJérôme Duval
531c70258b7SJérôme Duval if (ACPI_IS_DEBUG_ENABLED (ACPI_LV_FUNCTIONS, ComponentId))
532c70258b7SJérôme Duval {
5330174267aSFredrik Holmqvist AcpiDebugPrint (ACPI_LV_FUNCTIONS,
5340174267aSFredrik Holmqvist LineNumber, FunctionName, ModuleName, ComponentId,
53574ffd18dSFredrik Holmqvist "%s %s\n", AcpiGbl_FunctionEntryPrefix, String);
5360174267aSFredrik Holmqvist }
537c70258b7SJérôme Duval }
5380174267aSFredrik Holmqvist
5390174267aSFredrik Holmqvist
5400174267aSFredrik Holmqvist /*******************************************************************************
5410174267aSFredrik Holmqvist *
5420174267aSFredrik Holmqvist * FUNCTION: AcpiUtTraceU32
5430174267aSFredrik Holmqvist *
5440174267aSFredrik Holmqvist * PARAMETERS: LineNumber - Caller's line number
5450174267aSFredrik Holmqvist * FunctionName - Caller's procedure name
5460174267aSFredrik Holmqvist * ModuleName - Caller's module name
5470174267aSFredrik Holmqvist * ComponentId - Caller's component ID
5480174267aSFredrik Holmqvist * Integer - Integer to display
5490174267aSFredrik Holmqvist *
5500174267aSFredrik Holmqvist * RETURN: None
5510174267aSFredrik Holmqvist *
5520174267aSFredrik Holmqvist * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is
5530174267aSFredrik Holmqvist * set in DebugLevel
5540174267aSFredrik Holmqvist *
5550174267aSFredrik Holmqvist ******************************************************************************/
5560174267aSFredrik Holmqvist
5570174267aSFredrik Holmqvist void
AcpiUtTraceU32(UINT32 LineNumber,const char * FunctionName,const char * ModuleName,UINT32 ComponentId,UINT32 Integer)5580174267aSFredrik Holmqvist AcpiUtTraceU32 (
5590174267aSFredrik Holmqvist UINT32 LineNumber,
5600174267aSFredrik Holmqvist const char *FunctionName,
5610174267aSFredrik Holmqvist const char *ModuleName,
5620174267aSFredrik Holmqvist UINT32 ComponentId,
5630174267aSFredrik Holmqvist UINT32 Integer)
5640174267aSFredrik Holmqvist {
5650174267aSFredrik Holmqvist
5660174267aSFredrik Holmqvist AcpiGbl_NestingLevel++;
5670174267aSFredrik Holmqvist AcpiUtTrackStackPtr ();
5680174267aSFredrik Holmqvist
569c70258b7SJérôme Duval /* Check if enabled up-front for performance */
570c70258b7SJérôme Duval
571c70258b7SJérôme Duval if (ACPI_IS_DEBUG_ENABLED (ACPI_LV_FUNCTIONS, ComponentId))
572c70258b7SJérôme Duval {
5730174267aSFredrik Holmqvist AcpiDebugPrint (ACPI_LV_FUNCTIONS,
5740174267aSFredrik Holmqvist LineNumber, FunctionName, ModuleName, ComponentId,
57574ffd18dSFredrik Holmqvist "%s %08X\n", AcpiGbl_FunctionEntryPrefix, Integer);
5760174267aSFredrik Holmqvist }
577c70258b7SJérôme Duval }
5780174267aSFredrik Holmqvist
5790174267aSFredrik Holmqvist
5800174267aSFredrik Holmqvist /*******************************************************************************
5810174267aSFredrik Holmqvist *
5820174267aSFredrik Holmqvist * FUNCTION: AcpiUtExit
5830174267aSFredrik Holmqvist *
5840174267aSFredrik Holmqvist * PARAMETERS: LineNumber - Caller's line number
5850174267aSFredrik Holmqvist * FunctionName - Caller's procedure name
5860174267aSFredrik Holmqvist * ModuleName - Caller's module name
5870174267aSFredrik Holmqvist * ComponentId - Caller's component ID
5880174267aSFredrik Holmqvist *
5890174267aSFredrik Holmqvist * RETURN: None
5900174267aSFredrik Holmqvist *
5910174267aSFredrik Holmqvist * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is
5920174267aSFredrik Holmqvist * set in DebugLevel
5930174267aSFredrik Holmqvist *
5940174267aSFredrik Holmqvist ******************************************************************************/
5950174267aSFredrik Holmqvist
5960174267aSFredrik Holmqvist void
AcpiUtExit(UINT32 LineNumber,const char * FunctionName,const char * ModuleName,UINT32 ComponentId)5970174267aSFredrik Holmqvist AcpiUtExit (
5980174267aSFredrik Holmqvist UINT32 LineNumber,
5990174267aSFredrik Holmqvist const char *FunctionName,
6000174267aSFredrik Holmqvist const char *ModuleName,
6010174267aSFredrik Holmqvist UINT32 ComponentId)
6020174267aSFredrik Holmqvist {
6030174267aSFredrik Holmqvist
604c70258b7SJérôme Duval /* Check if enabled up-front for performance */
605c70258b7SJérôme Duval
606c70258b7SJérôme Duval if (ACPI_IS_DEBUG_ENABLED (ACPI_LV_FUNCTIONS, ComponentId))
607c70258b7SJérôme Duval {
6080174267aSFredrik Holmqvist AcpiDebugPrint (ACPI_LV_FUNCTIONS,
6090174267aSFredrik Holmqvist LineNumber, FunctionName, ModuleName, ComponentId,
61074ffd18dSFredrik Holmqvist "%s\n", AcpiGbl_FunctionExitPrefix);
611c70258b7SJérôme Duval }
6120174267aSFredrik Holmqvist
613ad5bbfb8SFredrik Holmqvist if (AcpiGbl_NestingLevel)
614ad5bbfb8SFredrik Holmqvist {
6150174267aSFredrik Holmqvist AcpiGbl_NestingLevel--;
6160174267aSFredrik Holmqvist }
617ad5bbfb8SFredrik Holmqvist }
6180174267aSFredrik Holmqvist
ACPI_EXPORT_SYMBOL(AcpiUtExit)6190174267aSFredrik Holmqvist ACPI_EXPORT_SYMBOL (AcpiUtExit)
6200174267aSFredrik Holmqvist
6210174267aSFredrik Holmqvist
6220174267aSFredrik Holmqvist /*******************************************************************************
6230174267aSFredrik Holmqvist *
6240174267aSFredrik Holmqvist * FUNCTION: AcpiUtStatusExit
6250174267aSFredrik Holmqvist *
6260174267aSFredrik Holmqvist * PARAMETERS: LineNumber - Caller's line number
6270174267aSFredrik Holmqvist * FunctionName - Caller's procedure name
6280174267aSFredrik Holmqvist * ModuleName - Caller's module name
6290174267aSFredrik Holmqvist * ComponentId - Caller's component ID
6300174267aSFredrik Holmqvist * Status - Exit status code
6310174267aSFredrik Holmqvist *
6320174267aSFredrik Holmqvist * RETURN: None
6330174267aSFredrik Holmqvist *
6340174267aSFredrik Holmqvist * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is
6350174267aSFredrik Holmqvist * set in DebugLevel. Prints exit status also.
6360174267aSFredrik Holmqvist *
6370174267aSFredrik Holmqvist ******************************************************************************/
6380174267aSFredrik Holmqvist
6390174267aSFredrik Holmqvist void
6400174267aSFredrik Holmqvist AcpiUtStatusExit (
6410174267aSFredrik Holmqvist UINT32 LineNumber,
6420174267aSFredrik Holmqvist const char *FunctionName,
6430174267aSFredrik Holmqvist const char *ModuleName,
6440174267aSFredrik Holmqvist UINT32 ComponentId,
6450174267aSFredrik Holmqvist ACPI_STATUS Status)
6460174267aSFredrik Holmqvist {
6470174267aSFredrik Holmqvist
648c70258b7SJérôme Duval /* Check if enabled up-front for performance */
649c70258b7SJérôme Duval
650c70258b7SJérôme Duval if (ACPI_IS_DEBUG_ENABLED (ACPI_LV_FUNCTIONS, ComponentId))
651c70258b7SJérôme Duval {
6520174267aSFredrik Holmqvist if (ACPI_SUCCESS (Status))
6530174267aSFredrik Holmqvist {
6540174267aSFredrik Holmqvist AcpiDebugPrint (ACPI_LV_FUNCTIONS,
6550174267aSFredrik Holmqvist LineNumber, FunctionName, ModuleName, ComponentId,
65674ffd18dSFredrik Holmqvist "%s %s\n", AcpiGbl_FunctionExitPrefix,
6570174267aSFredrik Holmqvist AcpiFormatException (Status));
6580174267aSFredrik Holmqvist }
6590174267aSFredrik Holmqvist else
6600174267aSFredrik Holmqvist {
6610174267aSFredrik Holmqvist AcpiDebugPrint (ACPI_LV_FUNCTIONS,
6620174267aSFredrik Holmqvist LineNumber, FunctionName, ModuleName, ComponentId,
66374ffd18dSFredrik Holmqvist "%s ****Exception****: %s\n", AcpiGbl_FunctionExitPrefix,
6640174267aSFredrik Holmqvist AcpiFormatException (Status));
6650174267aSFredrik Holmqvist }
666c70258b7SJérôme Duval }
6670174267aSFredrik Holmqvist
668ad5bbfb8SFredrik Holmqvist if (AcpiGbl_NestingLevel)
669ad5bbfb8SFredrik Holmqvist {
6700174267aSFredrik Holmqvist AcpiGbl_NestingLevel--;
6710174267aSFredrik Holmqvist }
672ad5bbfb8SFredrik Holmqvist }
6730174267aSFredrik Holmqvist
ACPI_EXPORT_SYMBOL(AcpiUtStatusExit)6740174267aSFredrik Holmqvist ACPI_EXPORT_SYMBOL (AcpiUtStatusExit)
6750174267aSFredrik Holmqvist
6760174267aSFredrik Holmqvist
6770174267aSFredrik Holmqvist /*******************************************************************************
6780174267aSFredrik Holmqvist *
6790174267aSFredrik Holmqvist * FUNCTION: AcpiUtValueExit
6800174267aSFredrik Holmqvist *
6810174267aSFredrik Holmqvist * PARAMETERS: LineNumber - Caller's line number
6820174267aSFredrik Holmqvist * FunctionName - Caller's procedure name
6830174267aSFredrik Holmqvist * ModuleName - Caller's module name
6840174267aSFredrik Holmqvist * ComponentId - Caller's component ID
6850174267aSFredrik Holmqvist * Value - Value to be printed with exit msg
6860174267aSFredrik Holmqvist *
6870174267aSFredrik Holmqvist * RETURN: None
6880174267aSFredrik Holmqvist *
6890174267aSFredrik Holmqvist * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is
6900174267aSFredrik Holmqvist * set in DebugLevel. Prints exit value also.
6910174267aSFredrik Holmqvist *
6920174267aSFredrik Holmqvist ******************************************************************************/
6930174267aSFredrik Holmqvist
6940174267aSFredrik Holmqvist void
6950174267aSFredrik Holmqvist AcpiUtValueExit (
6960174267aSFredrik Holmqvist UINT32 LineNumber,
6970174267aSFredrik Holmqvist const char *FunctionName,
6980174267aSFredrik Holmqvist const char *ModuleName,
6990174267aSFredrik Holmqvist UINT32 ComponentId,
7000174267aSFredrik Holmqvist UINT64 Value)
7010174267aSFredrik Holmqvist {
7020174267aSFredrik Holmqvist
703c70258b7SJérôme Duval /* Check if enabled up-front for performance */
704c70258b7SJérôme Duval
705c70258b7SJérôme Duval if (ACPI_IS_DEBUG_ENABLED (ACPI_LV_FUNCTIONS, ComponentId))
706c70258b7SJérôme Duval {
7070174267aSFredrik Holmqvist AcpiDebugPrint (ACPI_LV_FUNCTIONS,
7080174267aSFredrik Holmqvist LineNumber, FunctionName, ModuleName, ComponentId,
70974ffd18dSFredrik Holmqvist "%s %8.8X%8.8X\n", AcpiGbl_FunctionExitPrefix,
7100174267aSFredrik Holmqvist ACPI_FORMAT_UINT64 (Value));
711c70258b7SJérôme Duval }
7120174267aSFredrik Holmqvist
713ad5bbfb8SFredrik Holmqvist if (AcpiGbl_NestingLevel)
714ad5bbfb8SFredrik Holmqvist {
7150174267aSFredrik Holmqvist AcpiGbl_NestingLevel--;
7160174267aSFredrik Holmqvist }
717ad5bbfb8SFredrik Holmqvist }
7180174267aSFredrik Holmqvist
ACPI_EXPORT_SYMBOL(AcpiUtValueExit)7190174267aSFredrik Holmqvist ACPI_EXPORT_SYMBOL (AcpiUtValueExit)
7200174267aSFredrik Holmqvist
7210174267aSFredrik Holmqvist
7220174267aSFredrik Holmqvist /*******************************************************************************
7230174267aSFredrik Holmqvist *
7240174267aSFredrik Holmqvist * FUNCTION: AcpiUtPtrExit
7250174267aSFredrik Holmqvist *
7260174267aSFredrik Holmqvist * PARAMETERS: LineNumber - Caller's line number
7270174267aSFredrik Holmqvist * FunctionName - Caller's procedure name
7280174267aSFredrik Holmqvist * ModuleName - Caller's module name
7290174267aSFredrik Holmqvist * ComponentId - Caller's component ID
7300174267aSFredrik Holmqvist * Ptr - Pointer to display
7310174267aSFredrik Holmqvist *
7320174267aSFredrik Holmqvist * RETURN: None
7330174267aSFredrik Holmqvist *
7340174267aSFredrik Holmqvist * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is
7350174267aSFredrik Holmqvist * set in DebugLevel. Prints exit value also.
7360174267aSFredrik Holmqvist *
7370174267aSFredrik Holmqvist ******************************************************************************/
7380174267aSFredrik Holmqvist
7390174267aSFredrik Holmqvist void
7400174267aSFredrik Holmqvist AcpiUtPtrExit (
7410174267aSFredrik Holmqvist UINT32 LineNumber,
7420174267aSFredrik Holmqvist const char *FunctionName,
7430174267aSFredrik Holmqvist const char *ModuleName,
7440174267aSFredrik Holmqvist UINT32 ComponentId,
7450174267aSFredrik Holmqvist UINT8 *Ptr)
7460174267aSFredrik Holmqvist {
7470174267aSFredrik Holmqvist
748c70258b7SJérôme Duval /* Check if enabled up-front for performance */
749c70258b7SJérôme Duval
750c70258b7SJérôme Duval if (ACPI_IS_DEBUG_ENABLED (ACPI_LV_FUNCTIONS, ComponentId))
751c70258b7SJérôme Duval {
7520174267aSFredrik Holmqvist AcpiDebugPrint (ACPI_LV_FUNCTIONS,
7530174267aSFredrik Holmqvist LineNumber, FunctionName, ModuleName, ComponentId,
75474ffd18dSFredrik Holmqvist "%s %p\n", AcpiGbl_FunctionExitPrefix, Ptr);
75574ffd18dSFredrik Holmqvist }
75674ffd18dSFredrik Holmqvist
75774ffd18dSFredrik Holmqvist if (AcpiGbl_NestingLevel)
75874ffd18dSFredrik Holmqvist {
75974ffd18dSFredrik Holmqvist AcpiGbl_NestingLevel--;
76074ffd18dSFredrik Holmqvist }
76174ffd18dSFredrik Holmqvist }
76274ffd18dSFredrik Holmqvist
76374ffd18dSFredrik Holmqvist
76474ffd18dSFredrik Holmqvist /*******************************************************************************
76574ffd18dSFredrik Holmqvist *
76674ffd18dSFredrik Holmqvist * FUNCTION: AcpiUtStrExit
76774ffd18dSFredrik Holmqvist *
76874ffd18dSFredrik Holmqvist * PARAMETERS: LineNumber - Caller's line number
76974ffd18dSFredrik Holmqvist * FunctionName - Caller's procedure name
77074ffd18dSFredrik Holmqvist * ModuleName - Caller's module name
77174ffd18dSFredrik Holmqvist * ComponentId - Caller's component ID
77274ffd18dSFredrik Holmqvist * String - String to display
77374ffd18dSFredrik Holmqvist *
77474ffd18dSFredrik Holmqvist * RETURN: None
77574ffd18dSFredrik Holmqvist *
77674ffd18dSFredrik Holmqvist * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is
77774ffd18dSFredrik Holmqvist * set in DebugLevel. Prints exit value also.
77874ffd18dSFredrik Holmqvist *
77974ffd18dSFredrik Holmqvist ******************************************************************************/
78074ffd18dSFredrik Holmqvist
78174ffd18dSFredrik Holmqvist void
AcpiUtStrExit(UINT32 LineNumber,const char * FunctionName,const char * ModuleName,UINT32 ComponentId,const char * String)78274ffd18dSFredrik Holmqvist AcpiUtStrExit (
78374ffd18dSFredrik Holmqvist UINT32 LineNumber,
78474ffd18dSFredrik Holmqvist const char *FunctionName,
78574ffd18dSFredrik Holmqvist const char *ModuleName,
78674ffd18dSFredrik Holmqvist UINT32 ComponentId,
78774ffd18dSFredrik Holmqvist const char *String)
78874ffd18dSFredrik Holmqvist {
78974ffd18dSFredrik Holmqvist
79074ffd18dSFredrik Holmqvist /* Check if enabled up-front for performance */
79174ffd18dSFredrik Holmqvist
79274ffd18dSFredrik Holmqvist if (ACPI_IS_DEBUG_ENABLED (ACPI_LV_FUNCTIONS, ComponentId))
79374ffd18dSFredrik Holmqvist {
79474ffd18dSFredrik Holmqvist AcpiDebugPrint (ACPI_LV_FUNCTIONS,
79574ffd18dSFredrik Holmqvist LineNumber, FunctionName, ModuleName, ComponentId,
79674ffd18dSFredrik Holmqvist "%s %s\n", AcpiGbl_FunctionExitPrefix, String);
797c70258b7SJérôme Duval }
7980174267aSFredrik Holmqvist
799ad5bbfb8SFredrik Holmqvist if (AcpiGbl_NestingLevel)
800ad5bbfb8SFredrik Holmqvist {
8010174267aSFredrik Holmqvist AcpiGbl_NestingLevel--;
8020174267aSFredrik Holmqvist }
803ad5bbfb8SFredrik Holmqvist }
8040174267aSFredrik Holmqvist
805e226d1d0SFredrik Holmqvist
806e226d1d0SFredrik Holmqvist /*******************************************************************************
807e226d1d0SFredrik Holmqvist *
808e226d1d0SFredrik Holmqvist * FUNCTION: AcpiTracePoint
809e226d1d0SFredrik Holmqvist *
810e226d1d0SFredrik Holmqvist * PARAMETERS: Type - Trace event type
811e226d1d0SFredrik Holmqvist * Begin - TRUE if before execution
812e226d1d0SFredrik Holmqvist * Aml - Executed AML address
813e226d1d0SFredrik Holmqvist * Pathname - Object path
814e226d1d0SFredrik Holmqvist * Pointer - Pointer to the related object
815e226d1d0SFredrik Holmqvist *
816e226d1d0SFredrik Holmqvist * RETURN: None
817e226d1d0SFredrik Holmqvist *
818e226d1d0SFredrik Holmqvist * DESCRIPTION: Interpreter execution trace.
819e226d1d0SFredrik Holmqvist *
820e226d1d0SFredrik Holmqvist ******************************************************************************/
821e226d1d0SFredrik Holmqvist
822e226d1d0SFredrik Holmqvist void
AcpiTracePoint(ACPI_TRACE_EVENT_TYPE Type,BOOLEAN Begin,UINT8 * Aml,char * Pathname)823e226d1d0SFredrik Holmqvist AcpiTracePoint (
824e226d1d0SFredrik Holmqvist ACPI_TRACE_EVENT_TYPE Type,
825e226d1d0SFredrik Holmqvist BOOLEAN Begin,
826e226d1d0SFredrik Holmqvist UINT8 *Aml,
827e226d1d0SFredrik Holmqvist char *Pathname)
828e226d1d0SFredrik Holmqvist {
829e226d1d0SFredrik Holmqvist
830e226d1d0SFredrik Holmqvist ACPI_FUNCTION_ENTRY ();
831e226d1d0SFredrik Holmqvist
832e226d1d0SFredrik Holmqvist AcpiExTracePoint (Type, Begin, Aml, Pathname);
833e226d1d0SFredrik Holmqvist
834e226d1d0SFredrik Holmqvist #ifdef ACPI_USE_SYSTEM_TRACER
835e226d1d0SFredrik Holmqvist AcpiOsTracePoint (Type, Begin, Aml, Pathname);
836e226d1d0SFredrik Holmqvist #endif
837e226d1d0SFredrik Holmqvist }
838e226d1d0SFredrik Holmqvist
839e226d1d0SFredrik Holmqvist ACPI_EXPORT_SYMBOL (AcpiTracePoint)
840e226d1d0SFredrik Holmqvist
841ff2e2f81SFredrik Holmqvist
8420174267aSFredrik Holmqvist #endif
843