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