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