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 - 2024, 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
AcpiUtInitStackPtrTrace(void)182 AcpiUtInitStackPtrTrace (
183 void)
184 {
185 ACPI_SIZE CurrentSp;
186
187
188 #pragma GCC diagnostic push
189 #if defined(__GNUC__) && __GNUC__ >= 12
190 #pragma GCC diagnostic ignored "-Wdangling-pointer="
191 #endif
192 AcpiGbl_EntryStackPointer = &CurrentSp;
193 #pragma GCC diagnostic pop
194 }
195
196
197 /*******************************************************************************
198 *
199 * FUNCTION: AcpiUtTrackStackPtr
200 *
201 * PARAMETERS: None
202 *
203 * RETURN: None
204 *
205 * DESCRIPTION: Save the current CPU stack pointer
206 *
207 ******************************************************************************/
208
209 void
AcpiUtTrackStackPtr(void)210 AcpiUtTrackStackPtr (
211 void)
212 {
213 ACPI_SIZE CurrentSp;
214
215
216 if (&CurrentSp < AcpiGbl_LowestStackPointer)
217 {
218 #pragma GCC diagnostic push
219 #if defined(__GNUC__) && __GNUC__ >= 12
220 #pragma GCC diagnostic ignored "-Wdangling-pointer="
221 #endif
222 AcpiGbl_LowestStackPointer = &CurrentSp;
223 #pragma GCC diagnostic pop
224 }
225
226 if (AcpiGbl_NestingLevel > AcpiGbl_DeepestNesting)
227 {
228 AcpiGbl_DeepestNesting = AcpiGbl_NestingLevel;
229 }
230 }
231
232
233 /*******************************************************************************
234 *
235 * FUNCTION: AcpiUtTrimFunctionName
236 *
237 * PARAMETERS: FunctionName - Ascii string containing a procedure name
238 *
239 * RETURN: Updated pointer to the function name
240 *
241 * DESCRIPTION: Remove the "Acpi" prefix from the function name, if present.
242 * This allows compiler macros such as __FUNCTION__ to be used
243 * with no change to the debug output.
244 *
245 ******************************************************************************/
246
247 static const char *
AcpiUtTrimFunctionName(const char * FunctionName)248 AcpiUtTrimFunctionName (
249 const char *FunctionName)
250 {
251
252 /* All Function names are longer than 4 chars, check is safe */
253
254 if (*(ACPI_CAST_PTR (UINT32, FunctionName)) == ACPI_PREFIX_MIXED)
255 {
256 /* This is the case where the original source has not been modified */
257
258 return (FunctionName + 4);
259 }
260
261 if (*(ACPI_CAST_PTR (UINT32, FunctionName)) == ACPI_PREFIX_LOWER)
262 {
263 /* This is the case where the source has been 'linuxized' */
264
265 return (FunctionName + 5);
266 }
267
268 return (FunctionName);
269 }
270
271
272 /*******************************************************************************
273 *
274 * FUNCTION: AcpiDebugPrint
275 *
276 * PARAMETERS: RequestedDebugLevel - Requested debug print level
277 * LineNumber - Caller's line number (for error output)
278 * FunctionName - Caller's procedure name
279 * ModuleName - Caller's module name
280 * ComponentId - Caller's component ID
281 * Format - Printf format field
282 * ... - Optional printf arguments
283 *
284 * RETURN: None
285 *
286 * DESCRIPTION: Print error message with prefix consisting of the module name,
287 * line number, and component ID.
288 *
289 ******************************************************************************/
290
291 void ACPI_INTERNAL_VAR_XFACE
AcpiDebugPrint(UINT32 RequestedDebugLevel,UINT32 LineNumber,const char * FunctionName,const char * ModuleName,UINT32 ComponentId,const char * Format,...)292 AcpiDebugPrint (
293 UINT32 RequestedDebugLevel,
294 UINT32 LineNumber,
295 const char *FunctionName,
296 const char *ModuleName,
297 UINT32 ComponentId,
298 const char *Format,
299 ...)
300 {
301 ACPI_THREAD_ID ThreadId;
302 va_list args;
303 #ifdef ACPI_APPLICATION
304 int FillCount;
305 #endif
306
307 /* Check if debug output enabled */
308
309 if (!ACPI_IS_DEBUG_ENABLED (RequestedDebugLevel, ComponentId))
310 {
311 return;
312 }
313
314 /*
315 * Thread tracking and context switch notification
316 */
317 ThreadId = AcpiOsGetThreadId ();
318 if (ThreadId != AcpiGbl_PreviousThreadId)
319 {
320 if (ACPI_LV_THREADS & AcpiDbgLevel)
321 {
322 AcpiOsPrintf (
323 "\n**** Context Switch from TID %u to TID %u ****\n\n",
324 (UINT32) AcpiGbl_PreviousThreadId, (UINT32) ThreadId);
325 }
326
327 AcpiGbl_PreviousThreadId = ThreadId;
328 AcpiGbl_NestingLevel = 0;
329 }
330
331 /*
332 * Display the module name, current line number, thread ID (if requested),
333 * current procedure nesting level, and the current procedure name
334 */
335 AcpiOsPrintf ("%9s-%04d ", ModuleName, LineNumber);
336
337 #ifdef ACPI_APPLICATION
338 /*
339 * For AcpiExec/iASL only, emit the thread ID and nesting level.
340 * Note: nesting level is really only useful during a single-thread
341 * execution. Otherwise, multiple threads will keep resetting the
342 * level.
343 */
344 if (ACPI_LV_THREADS & AcpiDbgLevel)
345 {
346 AcpiOsPrintf ("[%u] ", (UINT32) ThreadId);
347 }
348
349 FillCount = 48 - AcpiGbl_NestingLevel -
350 strlen (AcpiUtTrimFunctionName (FunctionName));
351 if (FillCount < 0)
352 {
353 FillCount = 0;
354 }
355
356 AcpiOsPrintf ("[%02d] %*s",
357 AcpiGbl_NestingLevel, AcpiGbl_NestingLevel + 1, " ");
358 AcpiOsPrintf ("%s%*s: ",
359 AcpiUtTrimFunctionName (FunctionName), FillCount, " ");
360
361 #else
362 AcpiOsPrintf ("%-22.22s: ", AcpiUtTrimFunctionName (FunctionName));
363 #endif
364
365 va_start (args, Format);
366 AcpiOsVprintf (Format, args);
367 va_end (args);
368 }
369
ACPI_EXPORT_SYMBOL(AcpiDebugPrint)370 ACPI_EXPORT_SYMBOL (AcpiDebugPrint)
371
372
373 /*******************************************************************************
374 *
375 * FUNCTION: AcpiDebugPrintRaw
376 *
377 * PARAMETERS: RequestedDebugLevel - Requested debug print level
378 * LineNumber - Caller's line number
379 * FunctionName - Caller's procedure name
380 * ModuleName - Caller's module name
381 * ComponentId - Caller's component ID
382 * Format - Printf format field
383 * ... - Optional printf arguments
384 *
385 * RETURN: None
386 *
387 * DESCRIPTION: Print message with no headers. Has same interface as
388 * DebugPrint so that the same macros can be used.
389 *
390 ******************************************************************************/
391
392 void ACPI_INTERNAL_VAR_XFACE
393 AcpiDebugPrintRaw (
394 UINT32 RequestedDebugLevel,
395 UINT32 LineNumber,
396 const char *FunctionName,
397 const char *ModuleName,
398 UINT32 ComponentId,
399 const char *Format,
400 ...)
401 {
402 va_list args;
403
404
405 /* Check if debug output enabled */
406
407 if (!ACPI_IS_DEBUG_ENABLED (RequestedDebugLevel, ComponentId))
408 {
409 return;
410 }
411
412 va_start (args, Format);
413 AcpiOsVprintf (Format, args);
414 va_end (args);
415 }
416
ACPI_EXPORT_SYMBOL(AcpiDebugPrintRaw)417 ACPI_EXPORT_SYMBOL (AcpiDebugPrintRaw)
418
419
420 /*******************************************************************************
421 *
422 * FUNCTION: AcpiUtTrace
423 *
424 * PARAMETERS: LineNumber - Caller's line number
425 * FunctionName - Caller's procedure name
426 * ModuleName - Caller's module name
427 * ComponentId - Caller's component ID
428 *
429 * RETURN: None
430 *
431 * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is
432 * set in DebugLevel
433 *
434 ******************************************************************************/
435
436 void
437 AcpiUtTrace (
438 UINT32 LineNumber,
439 const char *FunctionName,
440 const char *ModuleName,
441 UINT32 ComponentId)
442 {
443
444 AcpiGbl_NestingLevel++;
445 AcpiUtTrackStackPtr ();
446
447 /* Check if enabled up-front for performance */
448
449 if (ACPI_IS_DEBUG_ENABLED (ACPI_LV_FUNCTIONS, ComponentId))
450 {
451 AcpiDebugPrint (ACPI_LV_FUNCTIONS,
452 LineNumber, FunctionName, ModuleName, ComponentId,
453 "%s\n", AcpiGbl_FunctionEntryPrefix);
454 }
455 }
456
ACPI_EXPORT_SYMBOL(AcpiUtTrace)457 ACPI_EXPORT_SYMBOL (AcpiUtTrace)
458
459
460 /*******************************************************************************
461 *
462 * FUNCTION: AcpiUtTracePtr
463 *
464 * PARAMETERS: LineNumber - Caller's line number
465 * FunctionName - Caller's procedure name
466 * ModuleName - Caller's module name
467 * ComponentId - Caller's component ID
468 * Pointer - Pointer to display
469 *
470 * RETURN: None
471 *
472 * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is
473 * set in DebugLevel
474 *
475 ******************************************************************************/
476
477 void
478 AcpiUtTracePtr (
479 UINT32 LineNumber,
480 const char *FunctionName,
481 const char *ModuleName,
482 UINT32 ComponentId,
483 const void *Pointer)
484 {
485
486 AcpiGbl_NestingLevel++;
487 AcpiUtTrackStackPtr ();
488
489 /* Check if enabled up-front for performance */
490
491 if (ACPI_IS_DEBUG_ENABLED (ACPI_LV_FUNCTIONS, ComponentId))
492 {
493 AcpiDebugPrint (ACPI_LV_FUNCTIONS,
494 LineNumber, FunctionName, ModuleName, ComponentId,
495 "%s %p\n", AcpiGbl_FunctionEntryPrefix, Pointer);
496 }
497 }
498
499
500 /*******************************************************************************
501 *
502 * FUNCTION: AcpiUtTraceStr
503 *
504 * PARAMETERS: LineNumber - Caller's line number
505 * FunctionName - Caller's procedure name
506 * ModuleName - Caller's module name
507 * ComponentId - Caller's component ID
508 * String - Additional string to display
509 *
510 * RETURN: None
511 *
512 * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is
513 * set in DebugLevel
514 *
515 ******************************************************************************/
516
517 void
AcpiUtTraceStr(UINT32 LineNumber,const char * FunctionName,const char * ModuleName,UINT32 ComponentId,const char * String)518 AcpiUtTraceStr (
519 UINT32 LineNumber,
520 const char *FunctionName,
521 const char *ModuleName,
522 UINT32 ComponentId,
523 const char *String)
524 {
525
526 AcpiGbl_NestingLevel++;
527 AcpiUtTrackStackPtr ();
528
529 /* Check if enabled up-front for performance */
530
531 if (ACPI_IS_DEBUG_ENABLED (ACPI_LV_FUNCTIONS, ComponentId))
532 {
533 AcpiDebugPrint (ACPI_LV_FUNCTIONS,
534 LineNumber, FunctionName, ModuleName, ComponentId,
535 "%s %s\n", AcpiGbl_FunctionEntryPrefix, String);
536 }
537 }
538
539
540 /*******************************************************************************
541 *
542 * FUNCTION: AcpiUtTraceU32
543 *
544 * PARAMETERS: LineNumber - Caller's line number
545 * FunctionName - Caller's procedure name
546 * ModuleName - Caller's module name
547 * ComponentId - Caller's component ID
548 * Integer - Integer to display
549 *
550 * RETURN: None
551 *
552 * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is
553 * set in DebugLevel
554 *
555 ******************************************************************************/
556
557 void
AcpiUtTraceU32(UINT32 LineNumber,const char * FunctionName,const char * ModuleName,UINT32 ComponentId,UINT32 Integer)558 AcpiUtTraceU32 (
559 UINT32 LineNumber,
560 const char *FunctionName,
561 const char *ModuleName,
562 UINT32 ComponentId,
563 UINT32 Integer)
564 {
565
566 AcpiGbl_NestingLevel++;
567 AcpiUtTrackStackPtr ();
568
569 /* Check if enabled up-front for performance */
570
571 if (ACPI_IS_DEBUG_ENABLED (ACPI_LV_FUNCTIONS, ComponentId))
572 {
573 AcpiDebugPrint (ACPI_LV_FUNCTIONS,
574 LineNumber, FunctionName, ModuleName, ComponentId,
575 "%s %08X\n", AcpiGbl_FunctionEntryPrefix, Integer);
576 }
577 }
578
579
580 /*******************************************************************************
581 *
582 * FUNCTION: AcpiUtExit
583 *
584 * PARAMETERS: LineNumber - Caller's line number
585 * FunctionName - Caller's procedure name
586 * ModuleName - Caller's module name
587 * ComponentId - Caller's component ID
588 *
589 * RETURN: None
590 *
591 * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is
592 * set in DebugLevel
593 *
594 ******************************************************************************/
595
596 void
AcpiUtExit(UINT32 LineNumber,const char * FunctionName,const char * ModuleName,UINT32 ComponentId)597 AcpiUtExit (
598 UINT32 LineNumber,
599 const char *FunctionName,
600 const char *ModuleName,
601 UINT32 ComponentId)
602 {
603
604 /* Check if enabled up-front for performance */
605
606 if (ACPI_IS_DEBUG_ENABLED (ACPI_LV_FUNCTIONS, ComponentId))
607 {
608 AcpiDebugPrint (ACPI_LV_FUNCTIONS,
609 LineNumber, FunctionName, ModuleName, ComponentId,
610 "%s\n", AcpiGbl_FunctionExitPrefix);
611 }
612
613 if (AcpiGbl_NestingLevel)
614 {
615 AcpiGbl_NestingLevel--;
616 }
617 }
618
ACPI_EXPORT_SYMBOL(AcpiUtExit)619 ACPI_EXPORT_SYMBOL (AcpiUtExit)
620
621
622 /*******************************************************************************
623 *
624 * FUNCTION: AcpiUtStatusExit
625 *
626 * PARAMETERS: LineNumber - Caller's line number
627 * FunctionName - Caller's procedure name
628 * ModuleName - Caller's module name
629 * ComponentId - Caller's component ID
630 * Status - Exit status code
631 *
632 * RETURN: None
633 *
634 * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is
635 * set in DebugLevel. Prints exit status also.
636 *
637 ******************************************************************************/
638
639 void
640 AcpiUtStatusExit (
641 UINT32 LineNumber,
642 const char *FunctionName,
643 const char *ModuleName,
644 UINT32 ComponentId,
645 ACPI_STATUS Status)
646 {
647
648 /* Check if enabled up-front for performance */
649
650 if (ACPI_IS_DEBUG_ENABLED (ACPI_LV_FUNCTIONS, ComponentId))
651 {
652 if (ACPI_SUCCESS (Status))
653 {
654 AcpiDebugPrint (ACPI_LV_FUNCTIONS,
655 LineNumber, FunctionName, ModuleName, ComponentId,
656 "%s %s\n", AcpiGbl_FunctionExitPrefix,
657 AcpiFormatException (Status));
658 }
659 else
660 {
661 AcpiDebugPrint (ACPI_LV_FUNCTIONS,
662 LineNumber, FunctionName, ModuleName, ComponentId,
663 "%s ****Exception****: %s\n", AcpiGbl_FunctionExitPrefix,
664 AcpiFormatException (Status));
665 }
666 }
667
668 if (AcpiGbl_NestingLevel)
669 {
670 AcpiGbl_NestingLevel--;
671 }
672 }
673
ACPI_EXPORT_SYMBOL(AcpiUtStatusExit)674 ACPI_EXPORT_SYMBOL (AcpiUtStatusExit)
675
676
677 /*******************************************************************************
678 *
679 * FUNCTION: AcpiUtValueExit
680 *
681 * PARAMETERS: LineNumber - Caller's line number
682 * FunctionName - Caller's procedure name
683 * ModuleName - Caller's module name
684 * ComponentId - Caller's component ID
685 * Value - Value to be printed with exit msg
686 *
687 * RETURN: None
688 *
689 * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is
690 * set in DebugLevel. Prints exit value also.
691 *
692 ******************************************************************************/
693
694 void
695 AcpiUtValueExit (
696 UINT32 LineNumber,
697 const char *FunctionName,
698 const char *ModuleName,
699 UINT32 ComponentId,
700 UINT64 Value)
701 {
702
703 /* Check if enabled up-front for performance */
704
705 if (ACPI_IS_DEBUG_ENABLED (ACPI_LV_FUNCTIONS, ComponentId))
706 {
707 AcpiDebugPrint (ACPI_LV_FUNCTIONS,
708 LineNumber, FunctionName, ModuleName, ComponentId,
709 "%s %8.8X%8.8X\n", AcpiGbl_FunctionExitPrefix,
710 ACPI_FORMAT_UINT64 (Value));
711 }
712
713 if (AcpiGbl_NestingLevel)
714 {
715 AcpiGbl_NestingLevel--;
716 }
717 }
718
ACPI_EXPORT_SYMBOL(AcpiUtValueExit)719 ACPI_EXPORT_SYMBOL (AcpiUtValueExit)
720
721
722 /*******************************************************************************
723 *
724 * FUNCTION: AcpiUtPtrExit
725 *
726 * PARAMETERS: LineNumber - Caller's line number
727 * FunctionName - Caller's procedure name
728 * ModuleName - Caller's module name
729 * ComponentId - Caller's component ID
730 * Ptr - Pointer to display
731 *
732 * RETURN: None
733 *
734 * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is
735 * set in DebugLevel. Prints exit value also.
736 *
737 ******************************************************************************/
738
739 void
740 AcpiUtPtrExit (
741 UINT32 LineNumber,
742 const char *FunctionName,
743 const char *ModuleName,
744 UINT32 ComponentId,
745 UINT8 *Ptr)
746 {
747
748 /* Check if enabled up-front for performance */
749
750 if (ACPI_IS_DEBUG_ENABLED (ACPI_LV_FUNCTIONS, ComponentId))
751 {
752 AcpiDebugPrint (ACPI_LV_FUNCTIONS,
753 LineNumber, FunctionName, ModuleName, ComponentId,
754 "%s %p\n", AcpiGbl_FunctionExitPrefix, Ptr);
755 }
756
757 if (AcpiGbl_NestingLevel)
758 {
759 AcpiGbl_NestingLevel--;
760 }
761 }
762
763
764 /*******************************************************************************
765 *
766 * FUNCTION: AcpiUtStrExit
767 *
768 * PARAMETERS: LineNumber - Caller's line number
769 * FunctionName - Caller's procedure name
770 * ModuleName - Caller's module name
771 * ComponentId - Caller's component ID
772 * String - String to display
773 *
774 * RETURN: None
775 *
776 * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is
777 * set in DebugLevel. Prints exit value also.
778 *
779 ******************************************************************************/
780
781 void
AcpiUtStrExit(UINT32 LineNumber,const char * FunctionName,const char * ModuleName,UINT32 ComponentId,const char * String)782 AcpiUtStrExit (
783 UINT32 LineNumber,
784 const char *FunctionName,
785 const char *ModuleName,
786 UINT32 ComponentId,
787 const char *String)
788 {
789
790 /* Check if enabled up-front for performance */
791
792 if (ACPI_IS_DEBUG_ENABLED (ACPI_LV_FUNCTIONS, ComponentId))
793 {
794 AcpiDebugPrint (ACPI_LV_FUNCTIONS,
795 LineNumber, FunctionName, ModuleName, ComponentId,
796 "%s %s\n", AcpiGbl_FunctionExitPrefix, String);
797 }
798
799 if (AcpiGbl_NestingLevel)
800 {
801 AcpiGbl_NestingLevel--;
802 }
803 }
804
805
806 /*******************************************************************************
807 *
808 * FUNCTION: AcpiTracePoint
809 *
810 * PARAMETERS: Type - Trace event type
811 * Begin - TRUE if before execution
812 * Aml - Executed AML address
813 * Pathname - Object path
814 * Pointer - Pointer to the related object
815 *
816 * RETURN: None
817 *
818 * DESCRIPTION: Interpreter execution trace.
819 *
820 ******************************************************************************/
821
822 void
AcpiTracePoint(ACPI_TRACE_EVENT_TYPE Type,BOOLEAN Begin,UINT8 * Aml,char * Pathname)823 AcpiTracePoint (
824 ACPI_TRACE_EVENT_TYPE Type,
825 BOOLEAN Begin,
826 UINT8 *Aml,
827 char *Pathname)
828 {
829
830 ACPI_FUNCTION_ENTRY ();
831
832 AcpiExTracePoint (Type, Begin, Aml, Pathname);
833
834 #ifdef ACPI_USE_SYSTEM_TRACER
835 AcpiOsTracePoint (Type, Begin, Aml, Pathname);
836 #endif
837 }
838
839 ACPI_EXPORT_SYMBOL (AcpiTracePoint)
840
841
842 #endif
843