1 /******************************************************************************
2  *
3  * Module Name: utdebug - Debug print/trace routines
4  *
5  *****************************************************************************/
6 
7 /******************************************************************************
8  *
9  * 1. Copyright Notice
10  *
11  * Some or all of this work - Copyright (c) 1999 - 2017, Intel Corp.
12  * All rights reserved.
13  *
14  * 2. License
15  *
16  * 2.1. This is your license from Intel Corp. under its intellectual property
17  * rights. You may have additional license terms from the party that provided
18  * you this software, covering your right to use that party's intellectual
19  * property rights.
20  *
21  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
22  * copy of the source code appearing in this file ("Covered Code") an
23  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
24  * base code distributed originally by Intel ("Original Intel Code") to copy,
25  * make derivatives, distribute, use and display any portion of the Covered
26  * Code in any form, with the right to sublicense such rights; and
27  *
28  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
29  * license (with the right to sublicense), under only those claims of Intel
30  * patents that are infringed by the Original Intel Code, to make, use, sell,
31  * offer to sell, and import the Covered Code and derivative works thereof
32  * solely to the minimum extent necessary to exercise the above copyright
33  * license, and in no event shall the patent license extend to any additions
34  * to or modifications of the Original Intel Code. No other license or right
35  * is granted directly or by implication, estoppel or otherwise;
36  *
37  * The above copyright and patent license is granted only if the following
38  * conditions are met:
39  *
40  * 3. Conditions
41  *
42  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
43  * Redistribution of source code of any substantial portion of the Covered
44  * Code or modification with rights to further distribute source must include
45  * the above Copyright Notice, the above License, this list of Conditions,
46  * and the following Disclaimer and Export Compliance provision. In addition,
47  * Licensee must cause all Covered Code to which Licensee contributes to
48  * contain a file documenting the changes Licensee made to create that Covered
49  * Code and the date of any change. Licensee must include in that file the
50  * documentation of any changes made by any predecessor Licensee. Licensee
51  * must include a prominent statement that the modification is derived,
52  * directly or indirectly, from Original Intel Code.
53  *
54  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
55  * Redistribution of source code of any substantial portion of the Covered
56  * Code or modification without rights to further distribute source must
57  * include the following Disclaimer and Export Compliance provision in the
58  * documentation and/or other materials provided with distribution. In
59  * addition, Licensee may not authorize further sublicense of source of any
60  * portion of the Covered Code, and must include terms to the effect that the
61  * license from Licensee to its licensee is limited to the intellectual
62  * property embodied in the software Licensee provides to its licensee, and
63  * not to intellectual property embodied in modifications its licensee may
64  * make.
65  *
66  * 3.3. Redistribution of Executable. Redistribution in executable form of any
67  * substantial portion of the Covered Code or modification must reproduce the
68  * above Copyright Notice, and the following Disclaimer and Export Compliance
69  * provision in the documentation and/or other materials provided with the
70  * distribution.
71  *
72  * 3.4. Intel retains all right, title, and interest in and to the Original
73  * Intel Code.
74  *
75  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
76  * Intel shall be used in advertising or otherwise to promote the sale, use or
77  * other dealings in products derived from or relating to the Covered Code
78  * without prior written authorization from Intel.
79  *
80  * 4. Disclaimer and Export Compliance
81  *
82  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
83  * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
84  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
85  * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
86  * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
87  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
88  * PARTICULAR PURPOSE.
89  *
90  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
91  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
92  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
93  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
94  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
95  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
96  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
97  * LIMITED REMEDY.
98  *
99  * 4.3. Licensee shall not export, either directly or indirectly, any of this
100  * software or system incorporating such software without first obtaining any
101  * required license or other approval from the U. S. Department of Commerce or
102  * any other agency or department of the United States Government. In the
103  * event Licensee exports any such software from the United States or
104  * re-exports any such software from a foreign destination, Licensee shall
105  * ensure that the distribution and export/re-export of the software is in
106  * compliance with all laws, regulations, orders, or other restrictions of the
107  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
108  * any of its subsidiaries will export/re-export any technical data, process,
109  * software, or service, directly or indirectly, to any country for which the
110  * United States government or any agency thereof requires an export license,
111  * other governmental approval, or letter of assurance, without first obtaining
112  * such license, approval or letter.
113  *
114  *****************************************************************************
115  *
116  * Alternatively, you may choose to be licensed under the terms of the
117  * following license:
118  *
119  * Redistribution and use in source and binary forms, with or without
120  * modification, are permitted provided that the following conditions
121  * are met:
122  * 1. Redistributions of source code must retain the above copyright
123  *    notice, this list of conditions, and the following disclaimer,
124  *    without modification.
125  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
126  *    substantially similar to the "NO WARRANTY" disclaimer below
127  *    ("Disclaimer") and any redistribution must be conditioned upon
128  *    including a substantially similar Disclaimer requirement for further
129  *    binary redistribution.
130  * 3. Neither the names of the above-listed copyright holders nor the names
131  *    of any contributors may be used to endorse or promote products derived
132  *    from this software without specific prior written permission.
133  *
134  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
135  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
136  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
137  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
138  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
139  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
140  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
141  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
142  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
143  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
144  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
145  *
146  * Alternatively, you may choose to be licensed under the terms of the
147  * GNU General Public License ("GPL") version 2 as published by the Free
148  * Software Foundation.
149  *
150  *****************************************************************************/
151 
152 #define EXPORT_ACPI_INTERFACES
153 
154 #include "acpi.h"
155 #include "accommon.h"
156 #include "acinterp.h"
157 
158 #define _COMPONENT          ACPI_UTILITIES
159         ACPI_MODULE_NAME    ("utdebug")
160 
161 
162 #ifdef ACPI_DEBUG_OUTPUT
163 
164 static ACPI_THREAD_ID       AcpiGbl_PreviousThreadId = (ACPI_THREAD_ID) 0xFFFFFFFF;
165 static const char           *AcpiGbl_FunctionEntryPrefix = "----Entry";
166 static const char           *AcpiGbl_FunctionExitPrefix  = "----Exit-";
167 
168 
169 /*******************************************************************************
170  *
171  * FUNCTION:    AcpiUtInitStackPtrTrace
172  *
173  * PARAMETERS:  None
174  *
175  * RETURN:      None
176  *
177  * DESCRIPTION: Save the current CPU stack pointer at subsystem startup
178  *
179  ******************************************************************************/
180 
181 void
182 AcpiUtInitStackPtrTrace (
183     void)
184 {
185     ACPI_SIZE               CurrentSp;
186 
187 
188     AcpiGbl_EntryStackPointer = &CurrentSp;
189 }
190 
191 
192 /*******************************************************************************
193  *
194  * FUNCTION:    AcpiUtTrackStackPtr
195  *
196  * PARAMETERS:  None
197  *
198  * RETURN:      None
199  *
200  * DESCRIPTION: Save the current CPU stack pointer
201  *
202  ******************************************************************************/
203 
204 void
205 AcpiUtTrackStackPtr (
206     void)
207 {
208     ACPI_SIZE               CurrentSp;
209 
210 
211     if (&CurrentSp < AcpiGbl_LowestStackPointer)
212     {
213         AcpiGbl_LowestStackPointer = &CurrentSp;
214     }
215 
216     if (AcpiGbl_NestingLevel > AcpiGbl_DeepestNesting)
217     {
218         AcpiGbl_DeepestNesting = AcpiGbl_NestingLevel;
219     }
220 }
221 
222 
223 /*******************************************************************************
224  *
225  * FUNCTION:    AcpiUtTrimFunctionName
226  *
227  * PARAMETERS:  FunctionName        - Ascii string containing a procedure name
228  *
229  * RETURN:      Updated pointer to the function name
230  *
231  * DESCRIPTION: Remove the "Acpi" prefix from the function name, if present.
232  *              This allows compiler macros such as __FUNCTION__ to be used
233  *              with no change to the debug output.
234  *
235  ******************************************************************************/
236 
237 static const char *
238 AcpiUtTrimFunctionName (
239     const char              *FunctionName)
240 {
241 
242     /* All Function names are longer than 4 chars, check is safe */
243 
244     if (*(ACPI_CAST_PTR (UINT32, FunctionName)) == ACPI_PREFIX_MIXED)
245     {
246         /* This is the case where the original source has not been modified */
247 
248         return (FunctionName + 4);
249     }
250 
251     if (*(ACPI_CAST_PTR (UINT32, FunctionName)) == ACPI_PREFIX_LOWER)
252     {
253         /* This is the case where the source has been 'linuxized' */
254 
255         return (FunctionName + 5);
256     }
257 
258     return (FunctionName);
259 }
260 
261 
262 /*******************************************************************************
263  *
264  * FUNCTION:    AcpiDebugPrint
265  *
266  * PARAMETERS:  RequestedDebugLevel - Requested debug print level
267  *              LineNumber          - Caller's line number (for error output)
268  *              FunctionName        - Caller's procedure name
269  *              ModuleName          - Caller's module name
270  *              ComponentId         - Caller's component ID
271  *              Format              - Printf format field
272  *              ...                 - Optional printf arguments
273  *
274  * RETURN:      None
275  *
276  * DESCRIPTION: Print error message with prefix consisting of the module name,
277  *              line number, and component ID.
278  *
279  ******************************************************************************/
280 
281 void  ACPI_INTERNAL_VAR_XFACE
282 AcpiDebugPrint (
283     UINT32                  RequestedDebugLevel,
284     UINT32                  LineNumber,
285     const char              *FunctionName,
286     const char              *ModuleName,
287     UINT32                  ComponentId,
288     const char              *Format,
289     ...)
290 {
291     ACPI_THREAD_ID          ThreadId;
292     va_list                 args;
293 
294 
295     /* Check if debug output enabled */
296 
297     if (!ACPI_IS_DEBUG_ENABLED (RequestedDebugLevel, ComponentId))
298     {
299         return;
300     }
301 
302     /*
303      * Thread tracking and context switch notification
304      */
305     ThreadId = AcpiOsGetThreadId ();
306     if (ThreadId != AcpiGbl_PreviousThreadId)
307     {
308         if (ACPI_LV_THREADS & AcpiDbgLevel)
309         {
310             AcpiOsPrintf (
311                 "\n**** Context Switch from TID %u to TID %u ****\n\n",
312                 (UINT32) AcpiGbl_PreviousThreadId, (UINT32) ThreadId);
313         }
314 
315         AcpiGbl_PreviousThreadId = ThreadId;
316         AcpiGbl_NestingLevel = 0;
317     }
318 
319     /*
320      * Display the module name, current line number, thread ID (if requested),
321      * current procedure nesting level, and the current procedure name
322      */
323     AcpiOsPrintf ("%9s-%04ld ", ModuleName, LineNumber);
324 
325 #ifdef ACPI_APPLICATION
326     /*
327      * For AcpiExec/iASL only, emit the thread ID and nesting level.
328      * Note: nesting level is really only useful during a single-thread
329      * execution. Otherwise, multiple threads will keep resetting the
330      * level.
331      */
332     if (ACPI_LV_THREADS & AcpiDbgLevel)
333     {
334         AcpiOsPrintf ("[%u] ", (UINT32) ThreadId);
335     }
336 
337     AcpiOsPrintf ("[%02ld] ", AcpiGbl_NestingLevel);
338 #endif
339 
340     AcpiOsPrintf ("%-22.22s: ", AcpiUtTrimFunctionName (FunctionName));
341 
342     va_start (args, Format);
343     AcpiOsVprintf (Format, args);
344     va_end (args);
345 }
346 
347 ACPI_EXPORT_SYMBOL (AcpiDebugPrint)
348 
349 
350 /*******************************************************************************
351  *
352  * FUNCTION:    AcpiDebugPrintRaw
353  *
354  * PARAMETERS:  RequestedDebugLevel - Requested debug print level
355  *              LineNumber          - Caller's line number
356  *              FunctionName        - Caller's procedure name
357  *              ModuleName          - Caller's module name
358  *              ComponentId         - Caller's component ID
359  *              Format              - Printf format field
360  *              ...                 - Optional printf arguments
361  *
362  * RETURN:      None
363  *
364  * DESCRIPTION: Print message with no headers. Has same interface as
365  *              DebugPrint so that the same macros can be used.
366  *
367  ******************************************************************************/
368 
369 void  ACPI_INTERNAL_VAR_XFACE
370 AcpiDebugPrintRaw (
371     UINT32                  RequestedDebugLevel,
372     UINT32                  LineNumber,
373     const char              *FunctionName,
374     const char              *ModuleName,
375     UINT32                  ComponentId,
376     const char              *Format,
377     ...)
378 {
379     va_list                 args;
380 
381 
382     /* Check if debug output enabled */
383 
384     if (!ACPI_IS_DEBUG_ENABLED (RequestedDebugLevel, ComponentId))
385     {
386         return;
387     }
388 
389     va_start (args, Format);
390     AcpiOsVprintf (Format, args);
391     va_end (args);
392 }
393 
394 ACPI_EXPORT_SYMBOL (AcpiDebugPrintRaw)
395 
396 
397 /*******************************************************************************
398  *
399  * FUNCTION:    AcpiUtTrace
400  *
401  * PARAMETERS:  LineNumber          - Caller's line number
402  *              FunctionName        - Caller's procedure name
403  *              ModuleName          - Caller's module name
404  *              ComponentId         - Caller's component ID
405  *
406  * RETURN:      None
407  *
408  * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is
409  *              set in DebugLevel
410  *
411  ******************************************************************************/
412 
413 void
414 AcpiUtTrace (
415     UINT32                  LineNumber,
416     const char              *FunctionName,
417     const char              *ModuleName,
418     UINT32                  ComponentId)
419 {
420 
421     AcpiGbl_NestingLevel++;
422     AcpiUtTrackStackPtr ();
423 
424     /* Check if enabled up-front for performance */
425 
426     if (ACPI_IS_DEBUG_ENABLED (ACPI_LV_FUNCTIONS, ComponentId))
427     {
428         AcpiDebugPrint (ACPI_LV_FUNCTIONS,
429             LineNumber, FunctionName, ModuleName, ComponentId,
430             "%s\n", AcpiGbl_FunctionEntryPrefix);
431     }
432 }
433 
434 ACPI_EXPORT_SYMBOL (AcpiUtTrace)
435 
436 
437 /*******************************************************************************
438  *
439  * FUNCTION:    AcpiUtTracePtr
440  *
441  * PARAMETERS:  LineNumber          - Caller's line number
442  *              FunctionName        - Caller's procedure name
443  *              ModuleName          - Caller's module name
444  *              ComponentId         - Caller's component ID
445  *              Pointer             - Pointer to display
446  *
447  * RETURN:      None
448  *
449  * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is
450  *              set in DebugLevel
451  *
452  ******************************************************************************/
453 
454 void
455 AcpiUtTracePtr (
456     UINT32                  LineNumber,
457     const char              *FunctionName,
458     const char              *ModuleName,
459     UINT32                  ComponentId,
460     const void              *Pointer)
461 {
462 
463     AcpiGbl_NestingLevel++;
464     AcpiUtTrackStackPtr ();
465 
466     /* Check if enabled up-front for performance */
467 
468     if (ACPI_IS_DEBUG_ENABLED (ACPI_LV_FUNCTIONS, ComponentId))
469     {
470         AcpiDebugPrint (ACPI_LV_FUNCTIONS,
471             LineNumber, FunctionName, ModuleName, ComponentId,
472             "%s %p\n", AcpiGbl_FunctionEntryPrefix, Pointer);
473     }
474 }
475 
476 
477 /*******************************************************************************
478  *
479  * FUNCTION:    AcpiUtTraceStr
480  *
481  * PARAMETERS:  LineNumber          - Caller's line number
482  *              FunctionName        - Caller's procedure name
483  *              ModuleName          - Caller's module name
484  *              ComponentId         - Caller's component ID
485  *              String              - Additional string to display
486  *
487  * RETURN:      None
488  *
489  * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is
490  *              set in DebugLevel
491  *
492  ******************************************************************************/
493 
494 void
495 AcpiUtTraceStr (
496     UINT32                  LineNumber,
497     const char              *FunctionName,
498     const char              *ModuleName,
499     UINT32                  ComponentId,
500     const char              *String)
501 {
502 
503     AcpiGbl_NestingLevel++;
504     AcpiUtTrackStackPtr ();
505 
506     /* Check if enabled up-front for performance */
507 
508     if (ACPI_IS_DEBUG_ENABLED (ACPI_LV_FUNCTIONS, ComponentId))
509     {
510         AcpiDebugPrint (ACPI_LV_FUNCTIONS,
511             LineNumber, FunctionName, ModuleName, ComponentId,
512             "%s %s\n", AcpiGbl_FunctionEntryPrefix, String);
513     }
514 }
515 
516 
517 /*******************************************************************************
518  *
519  * FUNCTION:    AcpiUtTraceU32
520  *
521  * PARAMETERS:  LineNumber          - Caller's line number
522  *              FunctionName        - Caller's procedure name
523  *              ModuleName          - Caller's module name
524  *              ComponentId         - Caller's component ID
525  *              Integer             - Integer to display
526  *
527  * RETURN:      None
528  *
529  * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is
530  *              set in DebugLevel
531  *
532  ******************************************************************************/
533 
534 void
535 AcpiUtTraceU32 (
536     UINT32                  LineNumber,
537     const char              *FunctionName,
538     const char              *ModuleName,
539     UINT32                  ComponentId,
540     UINT32                  Integer)
541 {
542 
543     AcpiGbl_NestingLevel++;
544     AcpiUtTrackStackPtr ();
545 
546     /* Check if enabled up-front for performance */
547 
548     if (ACPI_IS_DEBUG_ENABLED (ACPI_LV_FUNCTIONS, ComponentId))
549     {
550         AcpiDebugPrint (ACPI_LV_FUNCTIONS,
551             LineNumber, FunctionName, ModuleName, ComponentId,
552             "%s %08X\n", AcpiGbl_FunctionEntryPrefix, Integer);
553     }
554 }
555 
556 
557 /*******************************************************************************
558  *
559  * FUNCTION:    AcpiUtExit
560  *
561  * PARAMETERS:  LineNumber          - Caller's line number
562  *              FunctionName        - Caller's procedure name
563  *              ModuleName          - Caller's module name
564  *              ComponentId         - Caller's component ID
565  *
566  * RETURN:      None
567  *
568  * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is
569  *              set in DebugLevel
570  *
571  ******************************************************************************/
572 
573 void
574 AcpiUtExit (
575     UINT32                  LineNumber,
576     const char              *FunctionName,
577     const char              *ModuleName,
578     UINT32                  ComponentId)
579 {
580 
581     /* Check if enabled up-front for performance */
582 
583     if (ACPI_IS_DEBUG_ENABLED (ACPI_LV_FUNCTIONS, ComponentId))
584     {
585         AcpiDebugPrint (ACPI_LV_FUNCTIONS,
586             LineNumber, FunctionName, ModuleName, ComponentId,
587             "%s\n", AcpiGbl_FunctionExitPrefix);
588     }
589 
590     if (AcpiGbl_NestingLevel)
591     {
592         AcpiGbl_NestingLevel--;
593     }
594 }
595 
596 ACPI_EXPORT_SYMBOL (AcpiUtExit)
597 
598 
599 /*******************************************************************************
600  *
601  * FUNCTION:    AcpiUtStatusExit
602  *
603  * PARAMETERS:  LineNumber          - Caller's line number
604  *              FunctionName        - Caller's procedure name
605  *              ModuleName          - Caller's module name
606  *              ComponentId         - Caller's component ID
607  *              Status              - Exit status code
608  *
609  * RETURN:      None
610  *
611  * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is
612  *              set in DebugLevel. Prints exit status also.
613  *
614  ******************************************************************************/
615 
616 void
617 AcpiUtStatusExit (
618     UINT32                  LineNumber,
619     const char              *FunctionName,
620     const char              *ModuleName,
621     UINT32                  ComponentId,
622     ACPI_STATUS             Status)
623 {
624 
625     /* Check if enabled up-front for performance */
626 
627     if (ACPI_IS_DEBUG_ENABLED (ACPI_LV_FUNCTIONS, ComponentId))
628     {
629         if (ACPI_SUCCESS (Status))
630         {
631             AcpiDebugPrint (ACPI_LV_FUNCTIONS,
632                 LineNumber, FunctionName, ModuleName, ComponentId,
633                 "%s %s\n", AcpiGbl_FunctionExitPrefix,
634                 AcpiFormatException (Status));
635         }
636         else
637         {
638             AcpiDebugPrint (ACPI_LV_FUNCTIONS,
639                 LineNumber, FunctionName, ModuleName, ComponentId,
640                 "%s ****Exception****: %s\n", AcpiGbl_FunctionExitPrefix,
641                 AcpiFormatException (Status));
642         }
643     }
644 
645     if (AcpiGbl_NestingLevel)
646     {
647         AcpiGbl_NestingLevel--;
648     }
649 }
650 
651 ACPI_EXPORT_SYMBOL (AcpiUtStatusExit)
652 
653 
654 /*******************************************************************************
655  *
656  * FUNCTION:    AcpiUtValueExit
657  *
658  * PARAMETERS:  LineNumber          - Caller's line number
659  *              FunctionName        - Caller's procedure name
660  *              ModuleName          - Caller's module name
661  *              ComponentId         - Caller's component ID
662  *              Value               - Value to be printed with exit msg
663  *
664  * RETURN:      None
665  *
666  * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is
667  *              set in DebugLevel. Prints exit value also.
668  *
669  ******************************************************************************/
670 
671 void
672 AcpiUtValueExit (
673     UINT32                  LineNumber,
674     const char              *FunctionName,
675     const char              *ModuleName,
676     UINT32                  ComponentId,
677     UINT64                  Value)
678 {
679 
680     /* Check if enabled up-front for performance */
681 
682     if (ACPI_IS_DEBUG_ENABLED (ACPI_LV_FUNCTIONS, ComponentId))
683     {
684         AcpiDebugPrint (ACPI_LV_FUNCTIONS,
685             LineNumber, FunctionName, ModuleName, ComponentId,
686             "%s %8.8X%8.8X\n", AcpiGbl_FunctionExitPrefix,
687             ACPI_FORMAT_UINT64 (Value));
688     }
689 
690     if (AcpiGbl_NestingLevel)
691     {
692         AcpiGbl_NestingLevel--;
693     }
694 }
695 
696 ACPI_EXPORT_SYMBOL (AcpiUtValueExit)
697 
698 
699 /*******************************************************************************
700  *
701  * FUNCTION:    AcpiUtPtrExit
702  *
703  * PARAMETERS:  LineNumber          - Caller's line number
704  *              FunctionName        - Caller's procedure name
705  *              ModuleName          - Caller's module name
706  *              ComponentId         - Caller's component ID
707  *              Ptr                 - Pointer to display
708  *
709  * RETURN:      None
710  *
711  * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is
712  *              set in DebugLevel. Prints exit value also.
713  *
714  ******************************************************************************/
715 
716 void
717 AcpiUtPtrExit (
718     UINT32                  LineNumber,
719     const char              *FunctionName,
720     const char              *ModuleName,
721     UINT32                  ComponentId,
722     UINT8                   *Ptr)
723 {
724 
725     /* Check if enabled up-front for performance */
726 
727     if (ACPI_IS_DEBUG_ENABLED (ACPI_LV_FUNCTIONS, ComponentId))
728     {
729         AcpiDebugPrint (ACPI_LV_FUNCTIONS,
730             LineNumber, FunctionName, ModuleName, ComponentId,
731             "%s %p\n", AcpiGbl_FunctionExitPrefix, Ptr);
732     }
733 
734     if (AcpiGbl_NestingLevel)
735     {
736         AcpiGbl_NestingLevel--;
737     }
738 }
739 
740 
741 /*******************************************************************************
742  *
743  * FUNCTION:    AcpiUtStrExit
744  *
745  * PARAMETERS:  LineNumber          - Caller's line number
746  *              FunctionName        - Caller's procedure name
747  *              ModuleName          - Caller's module name
748  *              ComponentId         - Caller's component ID
749  *              String              - String to display
750  *
751  * RETURN:      None
752  *
753  * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is
754  *              set in DebugLevel. Prints exit value also.
755  *
756  ******************************************************************************/
757 
758 void
759 AcpiUtStrExit (
760     UINT32                  LineNumber,
761     const char              *FunctionName,
762     const char              *ModuleName,
763     UINT32                  ComponentId,
764     const char              *String)
765 {
766 
767     /* Check if enabled up-front for performance */
768 
769     if (ACPI_IS_DEBUG_ENABLED (ACPI_LV_FUNCTIONS, ComponentId))
770     {
771         AcpiDebugPrint (ACPI_LV_FUNCTIONS,
772             LineNumber, FunctionName, ModuleName, ComponentId,
773             "%s %s\n", AcpiGbl_FunctionExitPrefix, String);
774     }
775 
776     if (AcpiGbl_NestingLevel)
777     {
778         AcpiGbl_NestingLevel--;
779     }
780 }
781 
782 
783 /*******************************************************************************
784  *
785  * FUNCTION:    AcpiTracePoint
786  *
787  * PARAMETERS:  Type                - Trace event type
788  *              Begin               - TRUE if before execution
789  *              Aml                 - Executed AML address
790  *              Pathname            - Object path
791  *              Pointer             - Pointer to the related object
792  *
793  * RETURN:      None
794  *
795  * DESCRIPTION: Interpreter execution trace.
796  *
797  ******************************************************************************/
798 
799 void
800 AcpiTracePoint (
801     ACPI_TRACE_EVENT_TYPE   Type,
802     BOOLEAN                 Begin,
803     UINT8                   *Aml,
804     char                    *Pathname)
805 {
806 
807     ACPI_FUNCTION_ENTRY ();
808 
809     AcpiExTracePoint (Type, Begin, Aml, Pathname);
810 
811 #ifdef ACPI_USE_SYSTEM_TRACER
812     AcpiOsTracePoint (Type, Begin, Aml, Pathname);
813 #endif
814 }
815 
816 ACPI_EXPORT_SYMBOL (AcpiTracePoint)
817 
818 
819 #endif
820