utdebug.c revision 1.1.1.19 1 1.1 jruoho /******************************************************************************
2 1.1 jruoho *
3 1.1.1.3 christos * Module Name: utdebug - Debug print/trace routines
4 1.1 jruoho *
5 1.1 jruoho *****************************************************************************/
6 1.1 jruoho
7 1.1.1.2 jruoho /*
8 1.1.1.19 christos * Copyright (C) 2000 - 2023, Intel Corp.
9 1.1 jruoho * All rights reserved.
10 1.1 jruoho *
11 1.1.1.2 jruoho * Redistribution and use in source and binary forms, with or without
12 1.1.1.2 jruoho * modification, are permitted provided that the following conditions
13 1.1.1.2 jruoho * are met:
14 1.1.1.2 jruoho * 1. Redistributions of source code must retain the above copyright
15 1.1.1.2 jruoho * notice, this list of conditions, and the following disclaimer,
16 1.1.1.2 jruoho * without modification.
17 1.1.1.2 jruoho * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 1.1.1.2 jruoho * substantially similar to the "NO WARRANTY" disclaimer below
19 1.1.1.2 jruoho * ("Disclaimer") and any redistribution must be conditioned upon
20 1.1.1.2 jruoho * including a substantially similar Disclaimer requirement for further
21 1.1.1.2 jruoho * binary redistribution.
22 1.1.1.2 jruoho * 3. Neither the names of the above-listed copyright holders nor the names
23 1.1.1.2 jruoho * of any contributors may be used to endorse or promote products derived
24 1.1.1.2 jruoho * from this software without specific prior written permission.
25 1.1.1.2 jruoho *
26 1.1.1.2 jruoho * Alternatively, this software may be distributed under the terms of the
27 1.1.1.2 jruoho * GNU General Public License ("GPL") version 2 as published by the Free
28 1.1.1.2 jruoho * Software Foundation.
29 1.1.1.2 jruoho *
30 1.1.1.2 jruoho * NO WARRANTY
31 1.1.1.2 jruoho * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 1.1.1.2 jruoho * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 1.1.1.17 christos * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
34 1.1.1.2 jruoho * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 1.1.1.2 jruoho * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 1.1.1.2 jruoho * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 1.1.1.2 jruoho * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 1.1.1.2 jruoho * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 1.1.1.2 jruoho * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 1.1.1.2 jruoho * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 1.1.1.2 jruoho * POSSIBILITY OF SUCH DAMAGES.
42 1.1.1.2 jruoho */
43 1.1 jruoho
44 1.1.1.3 christos #define EXPORT_ACPI_INTERFACES
45 1.1 jruoho
46 1.1 jruoho #include "acpi.h"
47 1.1 jruoho #include "accommon.h"
48 1.1.1.6 christos #include "acinterp.h"
49 1.1 jruoho
50 1.1 jruoho #define _COMPONENT ACPI_UTILITIES
51 1.1 jruoho ACPI_MODULE_NAME ("utdebug")
52 1.1 jruoho
53 1.1 jruoho
54 1.1 jruoho #ifdef ACPI_DEBUG_OUTPUT
55 1.1 jruoho
56 1.1.1.8 christos static ACPI_THREAD_ID AcpiGbl_PreviousThreadId = (ACPI_THREAD_ID) 0xFFFFFFFF;
57 1.1.1.8 christos static const char *AcpiGbl_FunctionEntryPrefix = "----Entry";
58 1.1.1.8 christos static const char *AcpiGbl_FunctionExitPrefix = "----Exit-";
59 1.1 jruoho
60 1.1 jruoho
61 1.1 jruoho /*******************************************************************************
62 1.1 jruoho *
63 1.1 jruoho * FUNCTION: AcpiUtInitStackPtrTrace
64 1.1 jruoho *
65 1.1 jruoho * PARAMETERS: None
66 1.1 jruoho *
67 1.1 jruoho * RETURN: None
68 1.1 jruoho *
69 1.1 jruoho * DESCRIPTION: Save the current CPU stack pointer at subsystem startup
70 1.1 jruoho *
71 1.1 jruoho ******************************************************************************/
72 1.1 jruoho
73 1.1 jruoho void
74 1.1 jruoho AcpiUtInitStackPtrTrace (
75 1.1 jruoho void)
76 1.1 jruoho {
77 1.1 jruoho ACPI_SIZE CurrentSp;
78 1.1 jruoho
79 1.1 jruoho
80 1.1.1.19 christos #pragma GCC diagnostic push
81 1.1.1.19 christos #if defined(__GNUC__) && __GNUC__ >= 12
82 1.1.1.19 christos #pragma GCC diagnostic ignored "-Wdangling-pointer="
83 1.1.1.19 christos #endif
84 1.1 jruoho AcpiGbl_EntryStackPointer = &CurrentSp;
85 1.1.1.19 christos #pragma GCC diagnostic pop
86 1.1 jruoho }
87 1.1 jruoho
88 1.1 jruoho
89 1.1 jruoho /*******************************************************************************
90 1.1 jruoho *
91 1.1 jruoho * FUNCTION: AcpiUtTrackStackPtr
92 1.1 jruoho *
93 1.1 jruoho * PARAMETERS: None
94 1.1 jruoho *
95 1.1 jruoho * RETURN: None
96 1.1 jruoho *
97 1.1 jruoho * DESCRIPTION: Save the current CPU stack pointer
98 1.1 jruoho *
99 1.1 jruoho ******************************************************************************/
100 1.1 jruoho
101 1.1 jruoho void
102 1.1 jruoho AcpiUtTrackStackPtr (
103 1.1 jruoho void)
104 1.1 jruoho {
105 1.1 jruoho ACPI_SIZE CurrentSp;
106 1.1 jruoho
107 1.1 jruoho
108 1.1 jruoho if (&CurrentSp < AcpiGbl_LowestStackPointer)
109 1.1 jruoho {
110 1.1 jruoho AcpiGbl_LowestStackPointer = &CurrentSp;
111 1.1 jruoho }
112 1.1 jruoho
113 1.1 jruoho if (AcpiGbl_NestingLevel > AcpiGbl_DeepestNesting)
114 1.1 jruoho {
115 1.1 jruoho AcpiGbl_DeepestNesting = AcpiGbl_NestingLevel;
116 1.1 jruoho }
117 1.1 jruoho }
118 1.1 jruoho
119 1.1 jruoho
120 1.1 jruoho /*******************************************************************************
121 1.1 jruoho *
122 1.1 jruoho * FUNCTION: AcpiUtTrimFunctionName
123 1.1 jruoho *
124 1.1 jruoho * PARAMETERS: FunctionName - Ascii string containing a procedure name
125 1.1 jruoho *
126 1.1 jruoho * RETURN: Updated pointer to the function name
127 1.1 jruoho *
128 1.1 jruoho * DESCRIPTION: Remove the "Acpi" prefix from the function name, if present.
129 1.1 jruoho * This allows compiler macros such as __FUNCTION__ to be used
130 1.1 jruoho * with no change to the debug output.
131 1.1 jruoho *
132 1.1 jruoho ******************************************************************************/
133 1.1 jruoho
134 1.1 jruoho static const char *
135 1.1 jruoho AcpiUtTrimFunctionName (
136 1.1 jruoho const char *FunctionName)
137 1.1 jruoho {
138 1.1 jruoho
139 1.1 jruoho /* All Function names are longer than 4 chars, check is safe */
140 1.1 jruoho
141 1.1 jruoho if (*(ACPI_CAST_PTR (UINT32, FunctionName)) == ACPI_PREFIX_MIXED)
142 1.1 jruoho {
143 1.1 jruoho /* This is the case where the original source has not been modified */
144 1.1 jruoho
145 1.1 jruoho return (FunctionName + 4);
146 1.1 jruoho }
147 1.1 jruoho
148 1.1 jruoho if (*(ACPI_CAST_PTR (UINT32, FunctionName)) == ACPI_PREFIX_LOWER)
149 1.1 jruoho {
150 1.1 jruoho /* This is the case where the source has been 'linuxized' */
151 1.1 jruoho
152 1.1 jruoho return (FunctionName + 5);
153 1.1 jruoho }
154 1.1 jruoho
155 1.1 jruoho return (FunctionName);
156 1.1 jruoho }
157 1.1 jruoho
158 1.1 jruoho
159 1.1 jruoho /*******************************************************************************
160 1.1 jruoho *
161 1.1 jruoho * FUNCTION: AcpiDebugPrint
162 1.1 jruoho *
163 1.1 jruoho * PARAMETERS: RequestedDebugLevel - Requested debug print level
164 1.1 jruoho * LineNumber - Caller's line number (for error output)
165 1.1 jruoho * FunctionName - Caller's procedure name
166 1.1 jruoho * ModuleName - Caller's module name
167 1.1 jruoho * ComponentId - Caller's component ID
168 1.1 jruoho * Format - Printf format field
169 1.1 jruoho * ... - Optional printf arguments
170 1.1 jruoho *
171 1.1 jruoho * RETURN: None
172 1.1 jruoho *
173 1.1 jruoho * DESCRIPTION: Print error message with prefix consisting of the module name,
174 1.1 jruoho * line number, and component ID.
175 1.1 jruoho *
176 1.1 jruoho ******************************************************************************/
177 1.1 jruoho
178 1.1 jruoho void ACPI_INTERNAL_VAR_XFACE
179 1.1 jruoho AcpiDebugPrint (
180 1.1 jruoho UINT32 RequestedDebugLevel,
181 1.1 jruoho UINT32 LineNumber,
182 1.1 jruoho const char *FunctionName,
183 1.1 jruoho const char *ModuleName,
184 1.1 jruoho UINT32 ComponentId,
185 1.1 jruoho const char *Format,
186 1.1 jruoho ...)
187 1.1 jruoho {
188 1.1 jruoho ACPI_THREAD_ID ThreadId;
189 1.1 jruoho va_list args;
190 1.1.1.13 christos #ifdef ACPI_APPLICATION
191 1.1.1.13 christos int FillCount;
192 1.1.1.13 christos #endif
193 1.1 jruoho
194 1.1.1.3 christos /* Check if debug output enabled */
195 1.1.1.3 christos
196 1.1.1.3 christos if (!ACPI_IS_DEBUG_ENABLED (RequestedDebugLevel, ComponentId))
197 1.1 jruoho {
198 1.1 jruoho return;
199 1.1 jruoho }
200 1.1 jruoho
201 1.1 jruoho /*
202 1.1 jruoho * Thread tracking and context switch notification
203 1.1 jruoho */
204 1.1 jruoho ThreadId = AcpiOsGetThreadId ();
205 1.1.1.8 christos if (ThreadId != AcpiGbl_PreviousThreadId)
206 1.1 jruoho {
207 1.1 jruoho if (ACPI_LV_THREADS & AcpiDbgLevel)
208 1.1 jruoho {
209 1.1 jruoho AcpiOsPrintf (
210 1.1.1.2 jruoho "\n**** Context Switch from TID %u to TID %u ****\n\n",
211 1.1.1.8 christos (UINT32) AcpiGbl_PreviousThreadId, (UINT32) ThreadId);
212 1.1 jruoho }
213 1.1 jruoho
214 1.1.1.8 christos AcpiGbl_PreviousThreadId = ThreadId;
215 1.1.1.3 christos AcpiGbl_NestingLevel = 0;
216 1.1 jruoho }
217 1.1 jruoho
218 1.1 jruoho /*
219 1.1 jruoho * Display the module name, current line number, thread ID (if requested),
220 1.1 jruoho * current procedure nesting level, and the current procedure name
221 1.1 jruoho */
222 1.1.1.15 christos AcpiOsPrintf ("%9s-%04d ", ModuleName, LineNumber);
223 1.1 jruoho
224 1.1.1.3 christos #ifdef ACPI_APPLICATION
225 1.1.1.3 christos /*
226 1.1.1.3 christos * For AcpiExec/iASL only, emit the thread ID and nesting level.
227 1.1.1.3 christos * Note: nesting level is really only useful during a single-thread
228 1.1.1.3 christos * execution. Otherwise, multiple threads will keep resetting the
229 1.1.1.3 christos * level.
230 1.1.1.3 christos */
231 1.1 jruoho if (ACPI_LV_THREADS & AcpiDbgLevel)
232 1.1 jruoho {
233 1.1.1.2 jruoho AcpiOsPrintf ("[%u] ", (UINT32) ThreadId);
234 1.1 jruoho }
235 1.1 jruoho
236 1.1.1.13 christos FillCount = 48 - AcpiGbl_NestingLevel -
237 1.1.1.13 christos strlen (AcpiUtTrimFunctionName (FunctionName));
238 1.1.1.13 christos if (FillCount < 0)
239 1.1.1.13 christos {
240 1.1.1.13 christos FillCount = 0;
241 1.1.1.13 christos }
242 1.1.1.3 christos
243 1.1.1.15 christos AcpiOsPrintf ("[%02d] %*s",
244 1.1.1.13 christos AcpiGbl_NestingLevel, AcpiGbl_NestingLevel + 1, " ");
245 1.1.1.13 christos AcpiOsPrintf ("%s%*s: ",
246 1.1.1.13 christos AcpiUtTrimFunctionName (FunctionName), FillCount, " ");
247 1.1.1.13 christos
248 1.1.1.13 christos #else
249 1.1.1.3 christos AcpiOsPrintf ("%-22.22s: ", AcpiUtTrimFunctionName (FunctionName));
250 1.1.1.13 christos #endif
251 1.1 jruoho
252 1.1 jruoho va_start (args, Format);
253 1.1 jruoho AcpiOsVprintf (Format, args);
254 1.1 jruoho va_end (args);
255 1.1 jruoho }
256 1.1 jruoho
257 1.1 jruoho ACPI_EXPORT_SYMBOL (AcpiDebugPrint)
258 1.1 jruoho
259 1.1 jruoho
260 1.1 jruoho /*******************************************************************************
261 1.1 jruoho *
262 1.1 jruoho * FUNCTION: AcpiDebugPrintRaw
263 1.1 jruoho *
264 1.1 jruoho * PARAMETERS: RequestedDebugLevel - Requested debug print level
265 1.1 jruoho * LineNumber - Caller's line number
266 1.1 jruoho * FunctionName - Caller's procedure name
267 1.1 jruoho * ModuleName - Caller's module name
268 1.1 jruoho * ComponentId - Caller's component ID
269 1.1 jruoho * Format - Printf format field
270 1.1 jruoho * ... - Optional printf arguments
271 1.1 jruoho *
272 1.1 jruoho * RETURN: None
273 1.1 jruoho *
274 1.1.1.3 christos * DESCRIPTION: Print message with no headers. Has same interface as
275 1.1 jruoho * DebugPrint so that the same macros can be used.
276 1.1 jruoho *
277 1.1 jruoho ******************************************************************************/
278 1.1 jruoho
279 1.1 jruoho void ACPI_INTERNAL_VAR_XFACE
280 1.1 jruoho AcpiDebugPrintRaw (
281 1.1 jruoho UINT32 RequestedDebugLevel,
282 1.1 jruoho UINT32 LineNumber,
283 1.1 jruoho const char *FunctionName,
284 1.1 jruoho const char *ModuleName,
285 1.1 jruoho UINT32 ComponentId,
286 1.1 jruoho const char *Format,
287 1.1 jruoho ...)
288 1.1 jruoho {
289 1.1 jruoho va_list args;
290 1.1 jruoho
291 1.1 jruoho
292 1.1.1.3 christos /* Check if debug output enabled */
293 1.1.1.3 christos
294 1.1.1.3 christos if (!ACPI_IS_DEBUG_ENABLED (RequestedDebugLevel, ComponentId))
295 1.1 jruoho {
296 1.1 jruoho return;
297 1.1 jruoho }
298 1.1 jruoho
299 1.1 jruoho va_start (args, Format);
300 1.1 jruoho AcpiOsVprintf (Format, args);
301 1.1 jruoho va_end (args);
302 1.1 jruoho }
303 1.1 jruoho
304 1.1 jruoho ACPI_EXPORT_SYMBOL (AcpiDebugPrintRaw)
305 1.1 jruoho
306 1.1 jruoho
307 1.1 jruoho /*******************************************************************************
308 1.1 jruoho *
309 1.1 jruoho * FUNCTION: AcpiUtTrace
310 1.1 jruoho *
311 1.1 jruoho * PARAMETERS: LineNumber - Caller's line number
312 1.1 jruoho * FunctionName - Caller's procedure name
313 1.1 jruoho * ModuleName - Caller's module name
314 1.1 jruoho * ComponentId - Caller's component ID
315 1.1 jruoho *
316 1.1 jruoho * RETURN: None
317 1.1 jruoho *
318 1.1.1.3 christos * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is
319 1.1 jruoho * set in DebugLevel
320 1.1 jruoho *
321 1.1 jruoho ******************************************************************************/
322 1.1 jruoho
323 1.1 jruoho void
324 1.1 jruoho AcpiUtTrace (
325 1.1 jruoho UINT32 LineNumber,
326 1.1 jruoho const char *FunctionName,
327 1.1 jruoho const char *ModuleName,
328 1.1 jruoho UINT32 ComponentId)
329 1.1 jruoho {
330 1.1 jruoho
331 1.1 jruoho AcpiGbl_NestingLevel++;
332 1.1 jruoho AcpiUtTrackStackPtr ();
333 1.1 jruoho
334 1.1.1.3 christos /* Check if enabled up-front for performance */
335 1.1.1.3 christos
336 1.1.1.3 christos if (ACPI_IS_DEBUG_ENABLED (ACPI_LV_FUNCTIONS, ComponentId))
337 1.1.1.3 christos {
338 1.1.1.3 christos AcpiDebugPrint (ACPI_LV_FUNCTIONS,
339 1.1.1.3 christos LineNumber, FunctionName, ModuleName, ComponentId,
340 1.1.1.8 christos "%s\n", AcpiGbl_FunctionEntryPrefix);
341 1.1.1.3 christos }
342 1.1 jruoho }
343 1.1 jruoho
344 1.1 jruoho ACPI_EXPORT_SYMBOL (AcpiUtTrace)
345 1.1 jruoho
346 1.1 jruoho
347 1.1 jruoho /*******************************************************************************
348 1.1 jruoho *
349 1.1 jruoho * FUNCTION: AcpiUtTracePtr
350 1.1 jruoho *
351 1.1 jruoho * PARAMETERS: LineNumber - Caller's line number
352 1.1 jruoho * FunctionName - Caller's procedure name
353 1.1 jruoho * ModuleName - Caller's module name
354 1.1 jruoho * ComponentId - Caller's component ID
355 1.1 jruoho * Pointer - Pointer to display
356 1.1 jruoho *
357 1.1 jruoho * RETURN: None
358 1.1 jruoho *
359 1.1.1.3 christos * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is
360 1.1 jruoho * set in DebugLevel
361 1.1 jruoho *
362 1.1 jruoho ******************************************************************************/
363 1.1 jruoho
364 1.1 jruoho void
365 1.1 jruoho AcpiUtTracePtr (
366 1.1 jruoho UINT32 LineNumber,
367 1.1 jruoho const char *FunctionName,
368 1.1 jruoho const char *ModuleName,
369 1.1 jruoho UINT32 ComponentId,
370 1.1.1.8 christos const void *Pointer)
371 1.1 jruoho {
372 1.1.1.3 christos
373 1.1 jruoho AcpiGbl_NestingLevel++;
374 1.1 jruoho AcpiUtTrackStackPtr ();
375 1.1 jruoho
376 1.1.1.3 christos /* Check if enabled up-front for performance */
377 1.1.1.3 christos
378 1.1.1.3 christos if (ACPI_IS_DEBUG_ENABLED (ACPI_LV_FUNCTIONS, ComponentId))
379 1.1.1.3 christos {
380 1.1.1.3 christos AcpiDebugPrint (ACPI_LV_FUNCTIONS,
381 1.1.1.3 christos LineNumber, FunctionName, ModuleName, ComponentId,
382 1.1.1.8 christos "%s %p\n", AcpiGbl_FunctionEntryPrefix, Pointer);
383 1.1.1.3 christos }
384 1.1 jruoho }
385 1.1 jruoho
386 1.1 jruoho
387 1.1 jruoho /*******************************************************************************
388 1.1 jruoho *
389 1.1 jruoho * FUNCTION: AcpiUtTraceStr
390 1.1 jruoho *
391 1.1 jruoho * PARAMETERS: LineNumber - Caller's line number
392 1.1 jruoho * FunctionName - Caller's procedure name
393 1.1 jruoho * ModuleName - Caller's module name
394 1.1 jruoho * ComponentId - Caller's component ID
395 1.1 jruoho * String - Additional string to display
396 1.1 jruoho *
397 1.1 jruoho * RETURN: None
398 1.1 jruoho *
399 1.1.1.3 christos * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is
400 1.1 jruoho * set in DebugLevel
401 1.1 jruoho *
402 1.1 jruoho ******************************************************************************/
403 1.1 jruoho
404 1.1 jruoho void
405 1.1 jruoho AcpiUtTraceStr (
406 1.1 jruoho UINT32 LineNumber,
407 1.1 jruoho const char *FunctionName,
408 1.1 jruoho const char *ModuleName,
409 1.1 jruoho UINT32 ComponentId,
410 1.1.1.8 christos const char *String)
411 1.1 jruoho {
412 1.1 jruoho
413 1.1 jruoho AcpiGbl_NestingLevel++;
414 1.1 jruoho AcpiUtTrackStackPtr ();
415 1.1 jruoho
416 1.1.1.3 christos /* Check if enabled up-front for performance */
417 1.1.1.3 christos
418 1.1.1.3 christos if (ACPI_IS_DEBUG_ENABLED (ACPI_LV_FUNCTIONS, ComponentId))
419 1.1.1.3 christos {
420 1.1.1.3 christos AcpiDebugPrint (ACPI_LV_FUNCTIONS,
421 1.1.1.3 christos LineNumber, FunctionName, ModuleName, ComponentId,
422 1.1.1.8 christos "%s %s\n", AcpiGbl_FunctionEntryPrefix, String);
423 1.1.1.3 christos }
424 1.1 jruoho }
425 1.1 jruoho
426 1.1 jruoho
427 1.1 jruoho /*******************************************************************************
428 1.1 jruoho *
429 1.1 jruoho * FUNCTION: AcpiUtTraceU32
430 1.1 jruoho *
431 1.1 jruoho * PARAMETERS: LineNumber - Caller's line number
432 1.1 jruoho * FunctionName - Caller's procedure name
433 1.1 jruoho * ModuleName - Caller's module name
434 1.1 jruoho * ComponentId - Caller's component ID
435 1.1 jruoho * Integer - Integer to display
436 1.1 jruoho *
437 1.1 jruoho * RETURN: None
438 1.1 jruoho *
439 1.1.1.3 christos * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is
440 1.1 jruoho * set in DebugLevel
441 1.1 jruoho *
442 1.1 jruoho ******************************************************************************/
443 1.1 jruoho
444 1.1 jruoho void
445 1.1 jruoho AcpiUtTraceU32 (
446 1.1 jruoho UINT32 LineNumber,
447 1.1 jruoho const char *FunctionName,
448 1.1 jruoho const char *ModuleName,
449 1.1 jruoho UINT32 ComponentId,
450 1.1 jruoho UINT32 Integer)
451 1.1 jruoho {
452 1.1 jruoho
453 1.1 jruoho AcpiGbl_NestingLevel++;
454 1.1 jruoho AcpiUtTrackStackPtr ();
455 1.1 jruoho
456 1.1.1.3 christos /* Check if enabled up-front for performance */
457 1.1.1.3 christos
458 1.1.1.3 christos if (ACPI_IS_DEBUG_ENABLED (ACPI_LV_FUNCTIONS, ComponentId))
459 1.1.1.3 christos {
460 1.1.1.3 christos AcpiDebugPrint (ACPI_LV_FUNCTIONS,
461 1.1.1.3 christos LineNumber, FunctionName, ModuleName, ComponentId,
462 1.1.1.8 christos "%s %08X\n", AcpiGbl_FunctionEntryPrefix, Integer);
463 1.1.1.3 christos }
464 1.1 jruoho }
465 1.1 jruoho
466 1.1 jruoho
467 1.1 jruoho /*******************************************************************************
468 1.1 jruoho *
469 1.1 jruoho * FUNCTION: AcpiUtExit
470 1.1 jruoho *
471 1.1 jruoho * PARAMETERS: LineNumber - Caller's line number
472 1.1 jruoho * FunctionName - Caller's procedure name
473 1.1 jruoho * ModuleName - Caller's module name
474 1.1 jruoho * ComponentId - Caller's component ID
475 1.1 jruoho *
476 1.1 jruoho * RETURN: None
477 1.1 jruoho *
478 1.1.1.3 christos * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is
479 1.1 jruoho * set in DebugLevel
480 1.1 jruoho *
481 1.1 jruoho ******************************************************************************/
482 1.1 jruoho
483 1.1 jruoho void
484 1.1 jruoho AcpiUtExit (
485 1.1 jruoho UINT32 LineNumber,
486 1.1 jruoho const char *FunctionName,
487 1.1 jruoho const char *ModuleName,
488 1.1 jruoho UINT32 ComponentId)
489 1.1 jruoho {
490 1.1 jruoho
491 1.1.1.3 christos /* Check if enabled up-front for performance */
492 1.1.1.3 christos
493 1.1.1.3 christos if (ACPI_IS_DEBUG_ENABLED (ACPI_LV_FUNCTIONS, ComponentId))
494 1.1.1.3 christos {
495 1.1.1.3 christos AcpiDebugPrint (ACPI_LV_FUNCTIONS,
496 1.1.1.3 christos LineNumber, FunctionName, ModuleName, ComponentId,
497 1.1.1.8 christos "%s\n", AcpiGbl_FunctionExitPrefix);
498 1.1.1.3 christos }
499 1.1 jruoho
500 1.1.1.3 christos if (AcpiGbl_NestingLevel)
501 1.1.1.3 christos {
502 1.1.1.3 christos AcpiGbl_NestingLevel--;
503 1.1.1.3 christos }
504 1.1 jruoho }
505 1.1 jruoho
506 1.1 jruoho ACPI_EXPORT_SYMBOL (AcpiUtExit)
507 1.1 jruoho
508 1.1 jruoho
509 1.1 jruoho /*******************************************************************************
510 1.1 jruoho *
511 1.1 jruoho * FUNCTION: AcpiUtStatusExit
512 1.1 jruoho *
513 1.1 jruoho * PARAMETERS: LineNumber - Caller's line number
514 1.1 jruoho * FunctionName - Caller's procedure name
515 1.1 jruoho * ModuleName - Caller's module name
516 1.1 jruoho * ComponentId - Caller's component ID
517 1.1 jruoho * Status - Exit status code
518 1.1 jruoho *
519 1.1 jruoho * RETURN: None
520 1.1 jruoho *
521 1.1.1.3 christos * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is
522 1.1.1.3 christos * set in DebugLevel. Prints exit status also.
523 1.1 jruoho *
524 1.1 jruoho ******************************************************************************/
525 1.1 jruoho
526 1.1 jruoho void
527 1.1 jruoho AcpiUtStatusExit (
528 1.1 jruoho UINT32 LineNumber,
529 1.1 jruoho const char *FunctionName,
530 1.1 jruoho const char *ModuleName,
531 1.1 jruoho UINT32 ComponentId,
532 1.1 jruoho ACPI_STATUS Status)
533 1.1 jruoho {
534 1.1 jruoho
535 1.1.1.3 christos /* Check if enabled up-front for performance */
536 1.1.1.3 christos
537 1.1.1.3 christos if (ACPI_IS_DEBUG_ENABLED (ACPI_LV_FUNCTIONS, ComponentId))
538 1.1 jruoho {
539 1.1.1.3 christos if (ACPI_SUCCESS (Status))
540 1.1.1.3 christos {
541 1.1.1.3 christos AcpiDebugPrint (ACPI_LV_FUNCTIONS,
542 1.1.1.3 christos LineNumber, FunctionName, ModuleName, ComponentId,
543 1.1.1.8 christos "%s %s\n", AcpiGbl_FunctionExitPrefix,
544 1.1.1.3 christos AcpiFormatException (Status));
545 1.1.1.3 christos }
546 1.1.1.3 christos else
547 1.1.1.3 christos {
548 1.1.1.3 christos AcpiDebugPrint (ACPI_LV_FUNCTIONS,
549 1.1.1.3 christos LineNumber, FunctionName, ModuleName, ComponentId,
550 1.1.1.8 christos "%s ****Exception****: %s\n", AcpiGbl_FunctionExitPrefix,
551 1.1.1.3 christos AcpiFormatException (Status));
552 1.1.1.3 christos }
553 1.1 jruoho }
554 1.1.1.3 christos
555 1.1.1.3 christos if (AcpiGbl_NestingLevel)
556 1.1 jruoho {
557 1.1.1.3 christos AcpiGbl_NestingLevel--;
558 1.1 jruoho }
559 1.1 jruoho }
560 1.1 jruoho
561 1.1 jruoho ACPI_EXPORT_SYMBOL (AcpiUtStatusExit)
562 1.1 jruoho
563 1.1 jruoho
564 1.1 jruoho /*******************************************************************************
565 1.1 jruoho *
566 1.1 jruoho * FUNCTION: AcpiUtValueExit
567 1.1 jruoho *
568 1.1 jruoho * PARAMETERS: LineNumber - Caller's line number
569 1.1 jruoho * FunctionName - Caller's procedure name
570 1.1 jruoho * ModuleName - Caller's module name
571 1.1 jruoho * ComponentId - Caller's component ID
572 1.1 jruoho * Value - Value to be printed with exit msg
573 1.1 jruoho *
574 1.1 jruoho * RETURN: None
575 1.1 jruoho *
576 1.1.1.3 christos * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is
577 1.1.1.3 christos * set in DebugLevel. Prints exit value also.
578 1.1 jruoho *
579 1.1 jruoho ******************************************************************************/
580 1.1 jruoho
581 1.1 jruoho void
582 1.1 jruoho AcpiUtValueExit (
583 1.1 jruoho UINT32 LineNumber,
584 1.1 jruoho const char *FunctionName,
585 1.1 jruoho const char *ModuleName,
586 1.1 jruoho UINT32 ComponentId,
587 1.1 jruoho UINT64 Value)
588 1.1 jruoho {
589 1.1 jruoho
590 1.1.1.3 christos /* Check if enabled up-front for performance */
591 1.1.1.3 christos
592 1.1.1.3 christos if (ACPI_IS_DEBUG_ENABLED (ACPI_LV_FUNCTIONS, ComponentId))
593 1.1.1.3 christos {
594 1.1.1.3 christos AcpiDebugPrint (ACPI_LV_FUNCTIONS,
595 1.1.1.3 christos LineNumber, FunctionName, ModuleName, ComponentId,
596 1.1.1.8 christos "%s %8.8X%8.8X\n", AcpiGbl_FunctionExitPrefix,
597 1.1.1.3 christos ACPI_FORMAT_UINT64 (Value));
598 1.1.1.3 christos }
599 1.1 jruoho
600 1.1.1.3 christos if (AcpiGbl_NestingLevel)
601 1.1.1.3 christos {
602 1.1.1.3 christos AcpiGbl_NestingLevel--;
603 1.1.1.3 christos }
604 1.1 jruoho }
605 1.1 jruoho
606 1.1 jruoho ACPI_EXPORT_SYMBOL (AcpiUtValueExit)
607 1.1 jruoho
608 1.1 jruoho
609 1.1 jruoho /*******************************************************************************
610 1.1 jruoho *
611 1.1 jruoho * FUNCTION: AcpiUtPtrExit
612 1.1 jruoho *
613 1.1 jruoho * PARAMETERS: LineNumber - Caller's line number
614 1.1 jruoho * FunctionName - Caller's procedure name
615 1.1 jruoho * ModuleName - Caller's module name
616 1.1 jruoho * ComponentId - Caller's component ID
617 1.1 jruoho * Ptr - Pointer to display
618 1.1 jruoho *
619 1.1 jruoho * RETURN: None
620 1.1 jruoho *
621 1.1.1.3 christos * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is
622 1.1.1.3 christos * set in DebugLevel. Prints exit value also.
623 1.1 jruoho *
624 1.1 jruoho ******************************************************************************/
625 1.1 jruoho
626 1.1 jruoho void
627 1.1 jruoho AcpiUtPtrExit (
628 1.1 jruoho UINT32 LineNumber,
629 1.1 jruoho const char *FunctionName,
630 1.1 jruoho const char *ModuleName,
631 1.1 jruoho UINT32 ComponentId,
632 1.1 jruoho UINT8 *Ptr)
633 1.1 jruoho {
634 1.1 jruoho
635 1.1.1.3 christos /* Check if enabled up-front for performance */
636 1.1 jruoho
637 1.1.1.3 christos if (ACPI_IS_DEBUG_ENABLED (ACPI_LV_FUNCTIONS, ComponentId))
638 1.1 jruoho {
639 1.1.1.3 christos AcpiDebugPrint (ACPI_LV_FUNCTIONS,
640 1.1.1.3 christos LineNumber, FunctionName, ModuleName, ComponentId,
641 1.1.1.8 christos "%s %p\n", AcpiGbl_FunctionExitPrefix, Ptr);
642 1.1 jruoho }
643 1.1 jruoho
644 1.1.1.3 christos if (AcpiGbl_NestingLevel)
645 1.1 jruoho {
646 1.1.1.3 christos AcpiGbl_NestingLevel--;
647 1.1 jruoho }
648 1.1 jruoho }
649 1.1 jruoho
650 1.1.1.6 christos
651 1.1.1.6 christos /*******************************************************************************
652 1.1.1.6 christos *
653 1.1.1.9 christos * FUNCTION: AcpiUtStrExit
654 1.1.1.9 christos *
655 1.1.1.9 christos * PARAMETERS: LineNumber - Caller's line number
656 1.1.1.9 christos * FunctionName - Caller's procedure name
657 1.1.1.9 christos * ModuleName - Caller's module name
658 1.1.1.9 christos * ComponentId - Caller's component ID
659 1.1.1.9 christos * String - String to display
660 1.1.1.9 christos *
661 1.1.1.9 christos * RETURN: None
662 1.1.1.9 christos *
663 1.1.1.9 christos * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is
664 1.1.1.9 christos * set in DebugLevel. Prints exit value also.
665 1.1.1.9 christos *
666 1.1.1.9 christos ******************************************************************************/
667 1.1.1.9 christos
668 1.1.1.9 christos void
669 1.1.1.9 christos AcpiUtStrExit (
670 1.1.1.9 christos UINT32 LineNumber,
671 1.1.1.9 christos const char *FunctionName,
672 1.1.1.9 christos const char *ModuleName,
673 1.1.1.9 christos UINT32 ComponentId,
674 1.1.1.9 christos const char *String)
675 1.1.1.9 christos {
676 1.1.1.9 christos
677 1.1.1.9 christos /* Check if enabled up-front for performance */
678 1.1.1.9 christos
679 1.1.1.9 christos if (ACPI_IS_DEBUG_ENABLED (ACPI_LV_FUNCTIONS, ComponentId))
680 1.1.1.9 christos {
681 1.1.1.9 christos AcpiDebugPrint (ACPI_LV_FUNCTIONS,
682 1.1.1.9 christos LineNumber, FunctionName, ModuleName, ComponentId,
683 1.1.1.9 christos "%s %s\n", AcpiGbl_FunctionExitPrefix, String);
684 1.1.1.9 christos }
685 1.1.1.9 christos
686 1.1.1.9 christos if (AcpiGbl_NestingLevel)
687 1.1.1.9 christos {
688 1.1.1.9 christos AcpiGbl_NestingLevel--;
689 1.1.1.9 christos }
690 1.1.1.9 christos }
691 1.1.1.9 christos
692 1.1.1.9 christos
693 1.1.1.9 christos /*******************************************************************************
694 1.1.1.9 christos *
695 1.1.1.6 christos * FUNCTION: AcpiTracePoint
696 1.1.1.6 christos *
697 1.1.1.6 christos * PARAMETERS: Type - Trace event type
698 1.1.1.6 christos * Begin - TRUE if before execution
699 1.1.1.6 christos * Aml - Executed AML address
700 1.1.1.6 christos * Pathname - Object path
701 1.1.1.6 christos * Pointer - Pointer to the related object
702 1.1.1.6 christos *
703 1.1.1.6 christos * RETURN: None
704 1.1.1.6 christos *
705 1.1.1.6 christos * DESCRIPTION: Interpreter execution trace.
706 1.1.1.6 christos *
707 1.1.1.6 christos ******************************************************************************/
708 1.1.1.6 christos
709 1.1.1.6 christos void
710 1.1.1.6 christos AcpiTracePoint (
711 1.1.1.6 christos ACPI_TRACE_EVENT_TYPE Type,
712 1.1.1.6 christos BOOLEAN Begin,
713 1.1.1.6 christos UINT8 *Aml,
714 1.1.1.6 christos char *Pathname)
715 1.1.1.6 christos {
716 1.1.1.6 christos
717 1.1.1.6 christos ACPI_FUNCTION_ENTRY ();
718 1.1.1.6 christos
719 1.1.1.6 christos AcpiExTracePoint (Type, Begin, Aml, Pathname);
720 1.1.1.6 christos
721 1.1.1.6 christos #ifdef ACPI_USE_SYSTEM_TRACER
722 1.1.1.6 christos AcpiOsTracePoint (Type, Begin, Aml, Pathname);
723 1.1.1.6 christos #endif
724 1.1.1.6 christos }
725 1.1.1.6 christos
726 1.1.1.6 christos ACPI_EXPORT_SYMBOL (AcpiTracePoint)
727 1.1.1.6 christos
728 1.1.1.12 christos
729 1.1.1.3 christos #endif
730