utdebug.c 17.8 KB
Newer Older
L
Linus Torvalds 已提交
1 2
/******************************************************************************
 *
3
 * Module Name: utdebug - Debug print/trace routines
L
Linus Torvalds 已提交
4 5 6 7
 *
 *****************************************************************************/

/*
8
 * Copyright (C) 2000 - 2014, Intel Corp.
L
Linus Torvalds 已提交
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions, and the following disclaimer,
 *    without modification.
 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
 *    substantially similar to the "NO WARRANTY" disclaimer below
 *    ("Disclaimer") and any redistribution must be conditioned upon
 *    including a substantially similar Disclaimer requirement for further
 *    binary redistribution.
 * 3. Neither the names of the above-listed copyright holders nor the names
 *    of any contributors may be used to endorse or promote products derived
 *    from this software without specific prior written permission.
 *
 * Alternatively, this software may be distributed under the terms of the
 * GNU General Public License ("GPL") version 2 as published by the Free
 * Software Foundation.
 *
 * NO WARRANTY
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGES.
 */

44 45
#define EXPORT_ACPI_INTERFACES

L
Linus Torvalds 已提交
46
#include <acpi/acpi.h>
L
Len Brown 已提交
47
#include "accommon.h"
L
Linus Torvalds 已提交
48 49

#define _COMPONENT          ACPI_UTILITIES
L
Len Brown 已提交
50
ACPI_MODULE_NAME("utdebug")
51

L
Linus Torvalds 已提交
52
#ifdef ACPI_DEBUG_OUTPUT
53
static acpi_thread_id acpi_gbl_prev_thread_id = (acpi_thread_id) 0xFFFFFFFF;
L
Len Brown 已提交
54 55
static char *acpi_gbl_fn_entry_str = "----Entry";
static char *acpi_gbl_fn_exit_str = "----Exit-";
L
Linus Torvalds 已提交
56

57 58
/* Local prototypes */

L
Len Brown 已提交
59
static const char *acpi_ut_trim_function_name(const char *function_name);
L
Linus Torvalds 已提交
60

R
Robert Moore 已提交
61
/*******************************************************************************
L
Linus Torvalds 已提交
62 63 64 65 66 67 68
 *
 * FUNCTION:    acpi_ut_init_stack_ptr_trace
 *
 * PARAMETERS:  None
 *
 * RETURN:      None
 *
R
Robert Moore 已提交
69
 * DESCRIPTION: Save the current CPU stack pointer at subsystem startup
L
Linus Torvalds 已提交
70
 *
R
Robert Moore 已提交
71
 ******************************************************************************/
L
Linus Torvalds 已提交
72

L
Len Brown 已提交
73
void acpi_ut_init_stack_ptr_trace(void)
L
Linus Torvalds 已提交
74
{
75
	acpi_size current_sp;
L
Linus Torvalds 已提交
76

77
	acpi_gbl_entry_stack_pointer = &current_sp;
L
Linus Torvalds 已提交
78 79
}

R
Robert Moore 已提交
80
/*******************************************************************************
L
Linus Torvalds 已提交
81 82 83 84 85 86 87
 *
 * FUNCTION:    acpi_ut_track_stack_ptr
 *
 * PARAMETERS:  None
 *
 * RETURN:      None
 *
R
Robert Moore 已提交
88
 * DESCRIPTION: Save the current CPU stack pointer
L
Linus Torvalds 已提交
89
 *
R
Robert Moore 已提交
90
 ******************************************************************************/
L
Linus Torvalds 已提交
91

L
Len Brown 已提交
92
void acpi_ut_track_stack_ptr(void)
L
Linus Torvalds 已提交
93
{
L
Len Brown 已提交
94
	acpi_size current_sp;
L
Linus Torvalds 已提交
95

96 97
	if (&current_sp < acpi_gbl_lowest_stack_pointer) {
		acpi_gbl_lowest_stack_pointer = &current_sp;
L
Linus Torvalds 已提交
98 99 100 101 102 103 104
	}

	if (acpi_gbl_nesting_level > acpi_gbl_deepest_nesting) {
		acpi_gbl_deepest_nesting = acpi_gbl_nesting_level;
	}
}

105 106 107 108 109 110 111 112 113
/*******************************************************************************
 *
 * FUNCTION:    acpi_ut_trim_function_name
 *
 * PARAMETERS:  function_name       - Ascii string containing a procedure name
 *
 * RETURN:      Updated pointer to the function name
 *
 * DESCRIPTION: Remove the "Acpi" prefix from the function name, if present.
114
 *              This allows compiler macros such as __FUNCTION__ to be used
115 116 117 118
 *              with no change to the debug output.
 *
 ******************************************************************************/

L
Len Brown 已提交
119
static const char *acpi_ut_trim_function_name(const char *function_name)
120 121 122 123
{

	/* All Function names are longer than 4 chars, check is safe */

B
Bob Moore 已提交
124
	if (*(ACPI_CAST_PTR(u32, function_name)) == ACPI_PREFIX_MIXED) {
B
Bob Moore 已提交
125

126 127 128 129 130
		/* This is the case where the original source has not been modified */

		return (function_name + 4);
	}

B
Bob Moore 已提交
131
	if (*(ACPI_CAST_PTR(u32, function_name)) == ACPI_PREFIX_LOWER) {
B
Bob Moore 已提交
132

133 134 135 136 137 138 139 140
		/* This is the case where the source has been 'linuxized' */

		return (function_name + 5);
	}

	return (function_name);
}

R
Robert Moore 已提交
141
/*******************************************************************************
L
Linus Torvalds 已提交
142
 *
143
 * FUNCTION:    acpi_debug_print
L
Linus Torvalds 已提交
144
 *
R
Robert Moore 已提交
145
 * PARAMETERS:  requested_debug_level - Requested debug print level
L
Linus Torvalds 已提交
146
 *              line_number         - Caller's line number (for error output)
147 148 149
 *              function_name       - Caller's procedure name
 *              module_name         - Caller's module name
 *              component_id        - Caller's component ID
150
 *              format              - Printf format field
L
Linus Torvalds 已提交
151 152 153 154 155 156 157
 *              ...                 - Optional printf arguments
 *
 * RETURN:      None
 *
 * DESCRIPTION: Print error message with prefix consisting of the module name,
 *              line number, and component ID.
 *
R
Robert Moore 已提交
158
 ******************************************************************************/
L
Linus Torvalds 已提交
159

L
Len Brown 已提交
160
void ACPI_INTERNAL_VAR_XFACE
161 162 163 164 165
acpi_debug_print(u32 requested_debug_level,
		 u32 line_number,
		 const char *function_name,
		 const char *module_name,
		 u32 component_id, const char *format, ...)
L
Linus Torvalds 已提交
166
{
B
Bob Moore 已提交
167
	acpi_thread_id thread_id;
L
Len Brown 已提交
168
	va_list args;
L
Linus Torvalds 已提交
169

170 171 172
	/* Check if debug output enabled */

	if (!ACPI_IS_DEBUG_ENABLED(requested_debug_level, component_id)) {
L
Linus Torvalds 已提交
173 174 175 176 177 178
		return;
	}

	/*
	 * Thread tracking and context switch notification
	 */
L
Len Brown 已提交
179
	thread_id = acpi_os_get_thread_id();
L
Linus Torvalds 已提交
180 181
	if (thread_id != acpi_gbl_prev_thread_id) {
		if (ACPI_LV_THREADS & acpi_dbg_level) {
L
Len Brown 已提交
182
			acpi_os_printf
183 184
			    ("\n**** Context Switch from TID %u to TID %u ****\n\n",
			     (u32)acpi_gbl_prev_thread_id, (u32)thread_id);
L
Linus Torvalds 已提交
185 186 187
		}

		acpi_gbl_prev_thread_id = thread_id;
188
		acpi_gbl_nesting_level = 0;
L
Linus Torvalds 已提交
189 190 191 192 193 194
	}

	/*
	 * Display the module name, current line number, thread ID (if requested),
	 * current procedure nesting level, and the current procedure name
	 */
195
	acpi_os_printf("%9s-%04ld ", module_name, line_number);
L
Linus Torvalds 已提交
196

197
#ifdef ACPI_APPLICATION
198
	/*
199
	 * For acpi_exec/iASL only, emit the thread ID and nesting level.
200 201 202 203
	 * Note: nesting level is really only useful during a single-thread
	 * execution. Otherwise, multiple threads will keep resetting the
	 * level.
	 */
L
Linus Torvalds 已提交
204
	if (ACPI_LV_THREADS & acpi_dbg_level) {
205
		acpi_os_printf("[%u] ", (u32)thread_id);
L
Linus Torvalds 已提交
206 207
	}

208 209 210 211
	acpi_os_printf("[%02ld] ", acpi_gbl_nesting_level);
#endif

	acpi_os_printf("%-22.22s: ", acpi_ut_trim_function_name(function_name));
L
Linus Torvalds 已提交
212

L
Len Brown 已提交
213 214
	va_start(args, format);
	acpi_os_vprintf(format, args);
215
	va_end(args);
L
Linus Torvalds 已提交
216 217
}

218
ACPI_EXPORT_SYMBOL(acpi_debug_print)
L
Linus Torvalds 已提交
219

R
Robert Moore 已提交
220
/*******************************************************************************
L
Linus Torvalds 已提交
221
 *
222
 * FUNCTION:    acpi_debug_print_raw
L
Linus Torvalds 已提交
223 224 225
 *
 * PARAMETERS:  requested_debug_level - Requested debug print level
 *              line_number         - Caller's line number
226 227 228
 *              function_name       - Caller's procedure name
 *              module_name         - Caller's module name
 *              component_id        - Caller's component ID
229
 *              format              - Printf format field
L
Linus Torvalds 已提交
230 231 232 233
 *              ...                 - Optional printf arguments
 *
 * RETURN:      None
 *
234
 * DESCRIPTION: Print message with no headers. Has same interface as
L
Linus Torvalds 已提交
235 236
 *              debug_print so that the same macros can be used.
 *
R
Robert Moore 已提交
237
 ******************************************************************************/
L
Len Brown 已提交
238
void ACPI_INTERNAL_VAR_XFACE
239 240 241 242 243
acpi_debug_print_raw(u32 requested_debug_level,
		     u32 line_number,
		     const char *function_name,
		     const char *module_name,
		     u32 component_id, const char *format, ...)
L
Linus Torvalds 已提交
244
{
L
Len Brown 已提交
245
	va_list args;
L
Linus Torvalds 已提交
246

247 248 249
	/* Check if debug output enabled */

	if (!ACPI_IS_DEBUG_ENABLED(requested_debug_level, component_id)) {
L
Linus Torvalds 已提交
250 251 252
		return;
	}

L
Len Brown 已提交
253 254
	va_start(args, format);
	acpi_os_vprintf(format, args);
255
	va_end(args);
L
Linus Torvalds 已提交
256 257
}

258
ACPI_EXPORT_SYMBOL(acpi_debug_print_raw)
L
Linus Torvalds 已提交
259

R
Robert Moore 已提交
260
/*******************************************************************************
L
Linus Torvalds 已提交
261 262 263 264
 *
 * FUNCTION:    acpi_ut_trace
 *
 * PARAMETERS:  line_number         - Caller's line number
265 266 267
 *              function_name       - Caller's procedure name
 *              module_name         - Caller's module name
 *              component_id        - Caller's component ID
L
Linus Torvalds 已提交
268 269 270
 *
 * RETURN:      None
 *
271
 * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is
L
Linus Torvalds 已提交
272 273
 *              set in debug_level
 *
R
Robert Moore 已提交
274
 ******************************************************************************/
L
Linus Torvalds 已提交
275
void
L
Len Brown 已提交
276
acpi_ut_trace(u32 line_number,
277 278
	      const char *function_name,
	      const char *module_name, u32 component_id)
L
Linus Torvalds 已提交
279 280 281
{

	acpi_gbl_nesting_level++;
L
Len Brown 已提交
282
	acpi_ut_track_stack_ptr();
L
Linus Torvalds 已提交
283

284 285 286 287 288 289 290
	/* Check if enabled up-front for performance */

	if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) {
		acpi_debug_print(ACPI_LV_FUNCTIONS,
				 line_number, function_name, module_name,
				 component_id, "%s\n", acpi_gbl_fn_entry_str);
	}
L
Linus Torvalds 已提交
291 292
}

B
Bob Moore 已提交
293
ACPI_EXPORT_SYMBOL(acpi_ut_trace)
L
Linus Torvalds 已提交
294

R
Robert Moore 已提交
295
/*******************************************************************************
L
Linus Torvalds 已提交
296 297 298 299
 *
 * FUNCTION:    acpi_ut_trace_ptr
 *
 * PARAMETERS:  line_number         - Caller's line number
300 301 302
 *              function_name       - Caller's procedure name
 *              module_name         - Caller's module name
 *              component_id        - Caller's component ID
303
 *              pointer             - Pointer to display
L
Linus Torvalds 已提交
304 305 306
 *
 * RETURN:      None
 *
307
 * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is
L
Linus Torvalds 已提交
308 309
 *              set in debug_level
 *
R
Robert Moore 已提交
310
 ******************************************************************************/
L
Linus Torvalds 已提交
311
void
L
Len Brown 已提交
312 313
acpi_ut_trace_ptr(u32 line_number,
		  const char *function_name,
314
		  const char *module_name, u32 component_id, void *pointer)
L
Linus Torvalds 已提交
315
{
316

L
Linus Torvalds 已提交
317
	acpi_gbl_nesting_level++;
L
Len Brown 已提交
318
	acpi_ut_track_stack_ptr();
L
Linus Torvalds 已提交
319

320 321 322 323 324 325 326 327
	/* Check if enabled up-front for performance */

	if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) {
		acpi_debug_print(ACPI_LV_FUNCTIONS,
				 line_number, function_name, module_name,
				 component_id, "%s %p\n", acpi_gbl_fn_entry_str,
				 pointer);
	}
L
Linus Torvalds 已提交
328 329
}

R
Robert Moore 已提交
330
/*******************************************************************************
L
Linus Torvalds 已提交
331 332 333 334
 *
 * FUNCTION:    acpi_ut_trace_str
 *
 * PARAMETERS:  line_number         - Caller's line number
335 336 337
 *              function_name       - Caller's procedure name
 *              module_name         - Caller's module name
 *              component_id        - Caller's component ID
338
 *              string              - Additional string to display
L
Linus Torvalds 已提交
339 340 341
 *
 * RETURN:      None
 *
342
 * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is
L
Linus Torvalds 已提交
343 344
 *              set in debug_level
 *
R
Robert Moore 已提交
345
 ******************************************************************************/
L
Linus Torvalds 已提交
346 347

void
L
Len Brown 已提交
348 349
acpi_ut_trace_str(u32 line_number,
		  const char *function_name,
350
		  const char *module_name, u32 component_id, char *string)
L
Linus Torvalds 已提交
351 352 353
{

	acpi_gbl_nesting_level++;
L
Len Brown 已提交
354
	acpi_ut_track_stack_ptr();
L
Linus Torvalds 已提交
355

356 357 358 359 360 361 362 363
	/* Check if enabled up-front for performance */

	if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) {
		acpi_debug_print(ACPI_LV_FUNCTIONS,
				 line_number, function_name, module_name,
				 component_id, "%s %s\n", acpi_gbl_fn_entry_str,
				 string);
	}
L
Linus Torvalds 已提交
364 365
}

R
Robert Moore 已提交
366
/*******************************************************************************
L
Linus Torvalds 已提交
367 368 369 370
 *
 * FUNCTION:    acpi_ut_trace_u32
 *
 * PARAMETERS:  line_number         - Caller's line number
371 372 373
 *              function_name       - Caller's procedure name
 *              module_name         - Caller's module name
 *              component_id        - Caller's component ID
374
 *              integer             - Integer to display
L
Linus Torvalds 已提交
375 376 377
 *
 * RETURN:      None
 *
378
 * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is
L
Linus Torvalds 已提交
379 380
 *              set in debug_level
 *
R
Robert Moore 已提交
381
 ******************************************************************************/
L
Linus Torvalds 已提交
382 383

void
L
Len Brown 已提交
384 385
acpi_ut_trace_u32(u32 line_number,
		  const char *function_name,
386
		  const char *module_name, u32 component_id, u32 integer)
L
Linus Torvalds 已提交
387 388 389
{

	acpi_gbl_nesting_level++;
L
Len Brown 已提交
390
	acpi_ut_track_stack_ptr();
L
Linus Torvalds 已提交
391

392 393 394 395 396 397 398 399
	/* Check if enabled up-front for performance */

	if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) {
		acpi_debug_print(ACPI_LV_FUNCTIONS,
				 line_number, function_name, module_name,
				 component_id, "%s %08X\n",
				 acpi_gbl_fn_entry_str, integer);
	}
L
Linus Torvalds 已提交
400 401
}

R
Robert Moore 已提交
402
/*******************************************************************************
L
Linus Torvalds 已提交
403 404 405 406
 *
 * FUNCTION:    acpi_ut_exit
 *
 * PARAMETERS:  line_number         - Caller's line number
407 408 409
 *              function_name       - Caller's procedure name
 *              module_name         - Caller's module name
 *              component_id        - Caller's component ID
L
Linus Torvalds 已提交
410 411 412
 *
 * RETURN:      None
 *
413
 * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is
L
Linus Torvalds 已提交
414 415
 *              set in debug_level
 *
R
Robert Moore 已提交
416
 ******************************************************************************/
L
Linus Torvalds 已提交
417 418

void
L
Len Brown 已提交
419
acpi_ut_exit(u32 line_number,
420 421
	     const char *function_name,
	     const char *module_name, u32 component_id)
L
Linus Torvalds 已提交
422 423
{

424 425 426 427 428 429 430
	/* Check if enabled up-front for performance */

	if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) {
		acpi_debug_print(ACPI_LV_FUNCTIONS,
				 line_number, function_name, module_name,
				 component_id, "%s\n", acpi_gbl_fn_exit_str);
	}
L
Linus Torvalds 已提交
431

432 433 434
	if (acpi_gbl_nesting_level) {
		acpi_gbl_nesting_level--;
	}
L
Linus Torvalds 已提交
435 436
}

B
Bob Moore 已提交
437
ACPI_EXPORT_SYMBOL(acpi_ut_exit)
L
Linus Torvalds 已提交
438

R
Robert Moore 已提交
439
/*******************************************************************************
L
Linus Torvalds 已提交
440 441 442 443
 *
 * FUNCTION:    acpi_ut_status_exit
 *
 * PARAMETERS:  line_number         - Caller's line number
444 445 446
 *              function_name       - Caller's procedure name
 *              module_name         - Caller's module name
 *              component_id        - Caller's component ID
447
 *              status              - Exit status code
L
Linus Torvalds 已提交
448 449 450
 *
 * RETURN:      None
 *
451
 * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is
L
Linus Torvalds 已提交
452 453
 *              set in debug_level. Prints exit status also.
 *
R
Robert Moore 已提交
454
 ******************************************************************************/
L
Linus Torvalds 已提交
455
void
L
Len Brown 已提交
456 457
acpi_ut_status_exit(u32 line_number,
		    const char *function_name,
458 459
		    const char *module_name,
		    u32 component_id, acpi_status status)
L
Linus Torvalds 已提交
460 461
{

462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478
	/* Check if enabled up-front for performance */

	if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) {
		if (ACPI_SUCCESS(status)) {
			acpi_debug_print(ACPI_LV_FUNCTIONS,
					 line_number, function_name,
					 module_name, component_id, "%s %s\n",
					 acpi_gbl_fn_exit_str,
					 acpi_format_exception(status));
		} else {
			acpi_debug_print(ACPI_LV_FUNCTIONS,
					 line_number, function_name,
					 module_name, component_id,
					 "%s ****Exception****: %s\n",
					 acpi_gbl_fn_exit_str,
					 acpi_format_exception(status));
		}
L
Linus Torvalds 已提交
479 480
	}

481 482 483
	if (acpi_gbl_nesting_level) {
		acpi_gbl_nesting_level--;
	}
L
Linus Torvalds 已提交
484 485
}

B
Bob Moore 已提交
486
ACPI_EXPORT_SYMBOL(acpi_ut_status_exit)
L
Linus Torvalds 已提交
487

R
Robert Moore 已提交
488
/*******************************************************************************
L
Linus Torvalds 已提交
489 490 491 492
 *
 * FUNCTION:    acpi_ut_value_exit
 *
 * PARAMETERS:  line_number         - Caller's line number
493 494 495
 *              function_name       - Caller's procedure name
 *              module_name         - Caller's module name
 *              component_id        - Caller's component ID
496
 *              value               - Value to be printed with exit msg
L
Linus Torvalds 已提交
497 498 499
 *
 * RETURN:      None
 *
500
 * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is
L
Linus Torvalds 已提交
501 502
 *              set in debug_level. Prints exit value also.
 *
R
Robert Moore 已提交
503
 ******************************************************************************/
L
Linus Torvalds 已提交
504
void
L
Len Brown 已提交
505 506
acpi_ut_value_exit(u32 line_number,
		   const char *function_name,
507
		   const char *module_name, u32 component_id, u64 value)
L
Linus Torvalds 已提交
508 509
{

510 511 512 513 514 515 516 517 518
	/* Check if enabled up-front for performance */

	if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) {
		acpi_debug_print(ACPI_LV_FUNCTIONS,
				 line_number, function_name, module_name,
				 component_id, "%s %8.8X%8.8X\n",
				 acpi_gbl_fn_exit_str,
				 ACPI_FORMAT_UINT64(value));
	}
L
Linus Torvalds 已提交
519

520 521 522
	if (acpi_gbl_nesting_level) {
		acpi_gbl_nesting_level--;
	}
L
Linus Torvalds 已提交
523 524
}

B
Bob Moore 已提交
525
ACPI_EXPORT_SYMBOL(acpi_ut_value_exit)
L
Linus Torvalds 已提交
526

R
Robert Moore 已提交
527
/*******************************************************************************
L
Linus Torvalds 已提交
528 529 530 531
 *
 * FUNCTION:    acpi_ut_ptr_exit
 *
 * PARAMETERS:  line_number         - Caller's line number
532 533 534
 *              function_name       - Caller's procedure name
 *              module_name         - Caller's module name
 *              component_id        - Caller's component ID
535
 *              ptr                 - Pointer to display
L
Linus Torvalds 已提交
536 537 538
 *
 * RETURN:      None
 *
539
 * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is
L
Linus Torvalds 已提交
540 541
 *              set in debug_level. Prints exit value also.
 *
R
Robert Moore 已提交
542
 ******************************************************************************/
L
Linus Torvalds 已提交
543
void
L
Len Brown 已提交
544 545
acpi_ut_ptr_exit(u32 line_number,
		 const char *function_name,
546
		 const char *module_name, u32 component_id, u8 *ptr)
L
Linus Torvalds 已提交
547 548
{

549 550 551 552 553 554 555 556
	/* Check if enabled up-front for performance */

	if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) {
		acpi_debug_print(ACPI_LV_FUNCTIONS,
				 line_number, function_name, module_name,
				 component_id, "%s %p\n", acpi_gbl_fn_exit_str,
				 ptr);
	}
L
Linus Torvalds 已提交
557

558 559 560
	if (acpi_gbl_nesting_level) {
		acpi_gbl_nesting_level--;
	}
L
Linus Torvalds 已提交
561 562 563
}

#endif
564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589

#ifdef ACPI_APPLICATION
/*******************************************************************************
 *
 * FUNCTION:    acpi_log_error
 *
 * PARAMETERS:  format              - Printf format field
 *              ...                 - Optional printf arguments
 *
 * RETURN:      None
 *
 * DESCRIPTION: Print error message to the console, used by applications.
 *
 ******************************************************************************/

void ACPI_INTERNAL_VAR_XFACE acpi_log_error(const char *format, ...)
{
	va_list args;

	va_start(args, format);
	(void)acpi_ut_file_vprintf(ACPI_FILE_ERR, format, args);
	va_end(args);
}

ACPI_EXPORT_SYMBOL(acpi_log_error)
#endif