blob: 0c8cb0612414422ced38cae310fe49905d89e37b [file] [log] [blame]
Erik Schmauss95857632018-03-14 16:13:07 -07001// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0
Linus Torvalds1da177e2005-04-16 15:20:36 -07002/******************************************************************************
3 *
Bob Moore88ec2862013-06-08 00:57:47 +00004 * Module Name: utdebug - Debug print/trace routines
Linus Torvalds1da177e2005-04-16 15:20:36 -07005 *
Bob Moore800ba7c2020-01-10 11:31:49 -08006 * Copyright (C) 2000 - 2020, Intel Corp.
Linus Torvalds1da177e2005-04-16 15:20:36 -07007 *
Erik Schmauss95857632018-03-14 16:13:07 -07008 *****************************************************************************/
Linus Torvalds1da177e2005-04-16 15:20:36 -07009
Lv Zheng839e9282013-10-29 09:29:51 +080010#define EXPORT_ACPI_INTERFACES
11
Linus Torvalds1da177e2005-04-16 15:20:36 -070012#include <acpi/acpi.h>
Len Browne2f7a772009-01-09 00:30:03 -050013#include "accommon.h"
Lv Zhengbab04822015-07-23 12:53:07 +080014#include "acinterp.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070015
16#define _COMPONENT ACPI_UTILITIES
Len Brown4be44fc2005-08-05 00:44:28 -040017ACPI_MODULE_NAME("utdebug")
Lv Zheng6d33b6b2012-10-31 02:25:05 +000018
Linus Torvalds1da177e2005-04-16 15:20:36 -070019#ifdef ACPI_DEBUG_OUTPUT
Bob Moore0dfaaa32016-03-24 09:40:40 +080020static acpi_thread_id acpi_gbl_previous_thread_id = (acpi_thread_id) 0xFFFFFFFF;
21static const char *acpi_gbl_function_entry_prefix = "----Entry";
22static const char *acpi_gbl_function_exit_prefix = "----Exit-";
Linus Torvalds1da177e2005-04-16 15:20:36 -070023
Robert Moore44f6c012005-04-18 22:49:35 -040024/*******************************************************************************
Linus Torvalds1da177e2005-04-16 15:20:36 -070025 *
26 * FUNCTION: acpi_ut_init_stack_ptr_trace
27 *
28 * PARAMETERS: None
29 *
30 * RETURN: None
31 *
Robert Moore44f6c012005-04-18 22:49:35 -040032 * DESCRIPTION: Save the current CPU stack pointer at subsystem startup
Linus Torvalds1da177e2005-04-16 15:20:36 -070033 *
Robert Moore44f6c012005-04-18 22:49:35 -040034 ******************************************************************************/
Linus Torvalds1da177e2005-04-16 15:20:36 -070035
Len Brown4be44fc2005-08-05 00:44:28 -040036void acpi_ut_init_stack_ptr_trace(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -070037{
Bob Moore1d18c052008-04-10 19:06:40 +040038 acpi_size current_sp;
Linus Torvalds1da177e2005-04-16 15:20:36 -070039
Bob Moore1d18c052008-04-10 19:06:40 +040040 acpi_gbl_entry_stack_pointer = &current_sp;
Linus Torvalds1da177e2005-04-16 15:20:36 -070041}
42
Robert Moore44f6c012005-04-18 22:49:35 -040043/*******************************************************************************
Linus Torvalds1da177e2005-04-16 15:20:36 -070044 *
45 * FUNCTION: acpi_ut_track_stack_ptr
46 *
47 * PARAMETERS: None
48 *
49 * RETURN: None
50 *
Robert Moore44f6c012005-04-18 22:49:35 -040051 * DESCRIPTION: Save the current CPU stack pointer
Linus Torvalds1da177e2005-04-16 15:20:36 -070052 *
Robert Moore44f6c012005-04-18 22:49:35 -040053 ******************************************************************************/
Linus Torvalds1da177e2005-04-16 15:20:36 -070054
Len Brown4be44fc2005-08-05 00:44:28 -040055void acpi_ut_track_stack_ptr(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -070056{
Len Brown4be44fc2005-08-05 00:44:28 -040057 acpi_size current_sp;
Linus Torvalds1da177e2005-04-16 15:20:36 -070058
Bob Moore1d18c052008-04-10 19:06:40 +040059 if (&current_sp < acpi_gbl_lowest_stack_pointer) {
60 acpi_gbl_lowest_stack_pointer = &current_sp;
Linus Torvalds1da177e2005-04-16 15:20:36 -070061 }
62
63 if (acpi_gbl_nesting_level > acpi_gbl_deepest_nesting) {
64 acpi_gbl_deepest_nesting = acpi_gbl_nesting_level;
65 }
66}
67
Robert Moore44f6c012005-04-18 22:49:35 -040068/*******************************************************************************
Linus Torvalds1da177e2005-04-16 15:20:36 -070069 *
Robert Moore0c9938c2005-07-29 15:15:00 -070070 * FUNCTION: acpi_ut_trim_function_name
71 *
72 * PARAMETERS: function_name - Ascii string containing a procedure name
73 *
74 * RETURN: Updated pointer to the function name
75 *
76 * DESCRIPTION: Remove the "Acpi" prefix from the function name, if present.
Lv Zheng7011bf42015-06-19 11:38:22 +080077 * This allows compiler macros such as __func__ to be used
78 * with no change to the debug output.
Robert Moore0c9938c2005-07-29 15:15:00 -070079 *
80 ******************************************************************************/
81
Len Brown4be44fc2005-08-05 00:44:28 -040082static const char *acpi_ut_trim_function_name(const char *function_name)
Robert Moore0c9938c2005-07-29 15:15:00 -070083{
84
85 /* All Function names are longer than 4 chars, check is safe */
86
Bob Moorea18ecf42005-08-15 03:42:00 -080087 if (*(ACPI_CAST_PTR(u32, function_name)) == ACPI_PREFIX_MIXED) {
Bob Moore52fc0b02006-10-02 00:00:00 -040088
Robert Moore0c9938c2005-07-29 15:15:00 -070089 /* This is the case where the original source has not been modified */
90
91 return (function_name + 4);
92 }
93
Bob Moorea18ecf42005-08-15 03:42:00 -080094 if (*(ACPI_CAST_PTR(u32, function_name)) == ACPI_PREFIX_LOWER) {
Bob Moore52fc0b02006-10-02 00:00:00 -040095
Robert Moore0c9938c2005-07-29 15:15:00 -070096 /* This is the case where the source has been 'linuxized' */
97
98 return (function_name + 5);
99 }
100
101 return (function_name);
102}
103
Robert Moore0c9938c2005-07-29 15:15:00 -0700104/*******************************************************************************
105 *
Bob Moore50df4d82008-12-31 03:01:23 +0800106 * FUNCTION: acpi_debug_print
Linus Torvalds1da177e2005-04-16 15:20:36 -0700107 *
Robert Moore44f6c012005-04-18 22:49:35 -0400108 * PARAMETERS: requested_debug_level - Requested debug print level
Linus Torvalds1da177e2005-04-16 15:20:36 -0700109 * line_number - Caller's line number (for error output)
Robert Mooref9f46012005-07-08 00:00:00 -0400110 * function_name - Caller's procedure name
111 * module_name - Caller's module name
112 * component_id - Caller's component ID
Bob Mooreba494be2012-07-12 09:40:10 +0800113 * format - Printf format field
Linus Torvalds1da177e2005-04-16 15:20:36 -0700114 * ... - Optional printf arguments
115 *
116 * RETURN: None
117 *
118 * DESCRIPTION: Print error message with prefix consisting of the module name,
119 * line number, and component ID.
120 *
Robert Moore44f6c012005-04-18 22:49:35 -0400121 ******************************************************************************/
Linus Torvalds1da177e2005-04-16 15:20:36 -0700122
Len Brown4be44fc2005-08-05 00:44:28 -0400123void ACPI_INTERNAL_VAR_XFACE
Bob Moore50df4d82008-12-31 03:01:23 +0800124acpi_debug_print(u32 requested_debug_level,
125 u32 line_number,
126 const char *function_name,
127 const char *module_name,
128 u32 component_id, const char *format, ...)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700129{
Bob Moore83135242006-10-03 00:00:00 -0400130 acpi_thread_id thread_id;
Len Brown4be44fc2005-08-05 00:44:28 -0400131 va_list args;
Bob Moore2cb0ba72018-01-03 15:06:24 -0800132#ifdef ACPI_APPLICATION
Bob Moore6be2d722018-01-03 15:06:21 -0800133 int fill_count;
Bob Moore2cb0ba72018-01-03 15:06:24 -0800134#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700135
Bob Mooredb38bf52012-12-31 00:06:10 +0000136 /* Check if debug output enabled */
137
138 if (!ACPI_IS_DEBUG_ENABLED(requested_debug_level, component_id)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700139 return;
140 }
141
142 /*
143 * Thread tracking and context switch notification
144 */
Len Brown4be44fc2005-08-05 00:44:28 -0400145 thread_id = acpi_os_get_thread_id();
Bob Moore0dfaaa32016-03-24 09:40:40 +0800146 if (thread_id != acpi_gbl_previous_thread_id) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700147 if (ACPI_LV_THREADS & acpi_dbg_level) {
Len Brown4be44fc2005-08-05 00:44:28 -0400148 acpi_os_printf
Lin Ming28eb3fc2010-09-15 13:55:13 +0800149 ("\n**** Context Switch from TID %u to TID %u ****\n\n",
Bob Moore0dfaaa32016-03-24 09:40:40 +0800150 (u32)acpi_gbl_previous_thread_id, (u32)thread_id);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700151 }
152
Bob Moore0dfaaa32016-03-24 09:40:40 +0800153 acpi_gbl_previous_thread_id = thread_id;
Bob Moorebf9b4482013-11-21 12:17:20 +0800154 acpi_gbl_nesting_level = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700155 }
156
157 /*
158 * Display the module name, current line number, thread ID (if requested),
159 * current procedure nesting level, and the current procedure name
160 */
Bob Moore36056d02019-08-16 14:43:25 -0700161 acpi_os_printf("%9s-%04d ", module_name, line_number);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700162
Bob Moore5076f002014-01-08 13:43:12 +0800163#ifdef ACPI_APPLICATION
Bob Moorebf9b4482013-11-21 12:17:20 +0800164 /*
Bob Moore5076f002014-01-08 13:43:12 +0800165 * For acpi_exec/iASL only, emit the thread ID and nesting level.
Bob Moorebf9b4482013-11-21 12:17:20 +0800166 * Note: nesting level is really only useful during a single-thread
167 * execution. Otherwise, multiple threads will keep resetting the
168 * level.
169 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700170 if (ACPI_LV_THREADS & acpi_dbg_level) {
Lin Ming28eb3fc2010-09-15 13:55:13 +0800171 acpi_os_printf("[%u] ", (u32)thread_id);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700172 }
173
Bob Moore6be2d722018-01-03 15:06:21 -0800174 fill_count = 48 - acpi_gbl_nesting_level -
175 strlen(acpi_ut_trim_function_name(function_name));
176 if (fill_count < 0) {
177 fill_count = 0;
178 }
Bob Moorebf9b4482013-11-21 12:17:20 +0800179
Bob Moore36056d02019-08-16 14:43:25 -0700180 acpi_os_printf("[%02d] %*s",
Erik Schmauss6e875fa042018-01-03 15:06:23 -0800181 acpi_gbl_nesting_level, acpi_gbl_nesting_level + 1, " ");
Bob Moore6be2d722018-01-03 15:06:21 -0800182 acpi_os_printf("%s%*s: ",
183 acpi_ut_trim_function_name(function_name), fill_count,
184 " ");
185
186#else
Bob Moorebf9b4482013-11-21 12:17:20 +0800187 acpi_os_printf("%-22.22s: ", acpi_ut_trim_function_name(function_name));
Bob Moore6be2d722018-01-03 15:06:21 -0800188#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700189
Len Brown4be44fc2005-08-05 00:44:28 -0400190 va_start(args, format);
191 acpi_os_vprintf(format, args);
Bob Moore507f0462008-04-10 19:06:42 +0400192 va_end(args);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700193}
Robert Moore44f6c012005-04-18 22:49:35 -0400194
Bob Moore50df4d82008-12-31 03:01:23 +0800195ACPI_EXPORT_SYMBOL(acpi_debug_print)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700196
Robert Moore44f6c012005-04-18 22:49:35 -0400197/*******************************************************************************
Linus Torvalds1da177e2005-04-16 15:20:36 -0700198 *
Bob Moore50df4d82008-12-31 03:01:23 +0800199 * FUNCTION: acpi_debug_print_raw
Linus Torvalds1da177e2005-04-16 15:20:36 -0700200 *
201 * PARAMETERS: requested_debug_level - Requested debug print level
202 * line_number - Caller's line number
Robert Mooref9f46012005-07-08 00:00:00 -0400203 * function_name - Caller's procedure name
204 * module_name - Caller's module name
205 * component_id - Caller's component ID
Bob Mooreba494be2012-07-12 09:40:10 +0800206 * format - Printf format field
Linus Torvalds1da177e2005-04-16 15:20:36 -0700207 * ... - Optional printf arguments
208 *
209 * RETURN: None
210 *
Bob Moore73a30902012-10-31 02:26:55 +0000211 * DESCRIPTION: Print message with no headers. Has same interface as
Linus Torvalds1da177e2005-04-16 15:20:36 -0700212 * debug_print so that the same macros can be used.
213 *
Robert Moore44f6c012005-04-18 22:49:35 -0400214 ******************************************************************************/
Len Brown4be44fc2005-08-05 00:44:28 -0400215void ACPI_INTERNAL_VAR_XFACE
Bob Moore50df4d82008-12-31 03:01:23 +0800216acpi_debug_print_raw(u32 requested_debug_level,
217 u32 line_number,
218 const char *function_name,
219 const char *module_name,
220 u32 component_id, const char *format, ...)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700221{
Len Brown4be44fc2005-08-05 00:44:28 -0400222 va_list args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700223
Bob Mooredb38bf52012-12-31 00:06:10 +0000224 /* Check if debug output enabled */
225
226 if (!ACPI_IS_DEBUG_ENABLED(requested_debug_level, component_id)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700227 return;
228 }
229
Len Brown4be44fc2005-08-05 00:44:28 -0400230 va_start(args, format);
231 acpi_os_vprintf(format, args);
Bob Moore507f0462008-04-10 19:06:42 +0400232 va_end(args);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700233}
Linus Torvalds1da177e2005-04-16 15:20:36 -0700234
Bob Moore50df4d82008-12-31 03:01:23 +0800235ACPI_EXPORT_SYMBOL(acpi_debug_print_raw)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700236
Robert Moore44f6c012005-04-18 22:49:35 -0400237/*******************************************************************************
Linus Torvalds1da177e2005-04-16 15:20:36 -0700238 *
239 * FUNCTION: acpi_ut_trace
240 *
241 * PARAMETERS: line_number - Caller's line number
Robert Mooref9f46012005-07-08 00:00:00 -0400242 * function_name - Caller's procedure name
243 * module_name - Caller's module name
244 * component_id - Caller's component ID
Linus Torvalds1da177e2005-04-16 15:20:36 -0700245 *
246 * RETURN: None
247 *
Bob Moore73a30902012-10-31 02:26:55 +0000248 * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is
Linus Torvalds1da177e2005-04-16 15:20:36 -0700249 * set in debug_level
250 *
Robert Moore44f6c012005-04-18 22:49:35 -0400251 ******************************************************************************/
Linus Torvalds1da177e2005-04-16 15:20:36 -0700252void
Len Brown4be44fc2005-08-05 00:44:28 -0400253acpi_ut_trace(u32 line_number,
Bob Moore4b8ed632008-06-10 13:55:53 +0800254 const char *function_name,
255 const char *module_name, u32 component_id)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700256{
257
258 acpi_gbl_nesting_level++;
Len Brown4be44fc2005-08-05 00:44:28 -0400259 acpi_ut_track_stack_ptr();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700260
Bob Mooredb38bf52012-12-31 00:06:10 +0000261 /* Check if enabled up-front for performance */
262
263 if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) {
264 acpi_debug_print(ACPI_LV_FUNCTIONS,
265 line_number, function_name, module_name,
Bob Moore0dfaaa32016-03-24 09:40:40 +0800266 component_id, "%s\n",
267 acpi_gbl_function_entry_prefix);
Bob Mooredb38bf52012-12-31 00:06:10 +0000268 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700269}
Linus Torvalds1da177e2005-04-16 15:20:36 -0700270
Bob Moore83135242006-10-03 00:00:00 -0400271ACPI_EXPORT_SYMBOL(acpi_ut_trace)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700272
Robert Moore44f6c012005-04-18 22:49:35 -0400273/*******************************************************************************
Linus Torvalds1da177e2005-04-16 15:20:36 -0700274 *
275 * FUNCTION: acpi_ut_trace_ptr
276 *
277 * PARAMETERS: line_number - Caller's line number
Robert Mooref9f46012005-07-08 00:00:00 -0400278 * function_name - Caller's procedure name
279 * module_name - Caller's module name
280 * component_id - Caller's component ID
Bob Mooreba494be2012-07-12 09:40:10 +0800281 * pointer - Pointer to display
Linus Torvalds1da177e2005-04-16 15:20:36 -0700282 *
283 * RETURN: None
284 *
Bob Moore73a30902012-10-31 02:26:55 +0000285 * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is
Linus Torvalds1da177e2005-04-16 15:20:36 -0700286 * set in debug_level
287 *
Robert Moore44f6c012005-04-18 22:49:35 -0400288 ******************************************************************************/
Linus Torvalds1da177e2005-04-16 15:20:36 -0700289void
Len Brown4be44fc2005-08-05 00:44:28 -0400290acpi_ut_trace_ptr(u32 line_number,
291 const char *function_name,
Bob Moore0dfaaa32016-03-24 09:40:40 +0800292 const char *module_name,
293 u32 component_id, const void *pointer)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700294{
Bob Moore68aafc32012-10-31 02:26:01 +0000295
Linus Torvalds1da177e2005-04-16 15:20:36 -0700296 acpi_gbl_nesting_level++;
Len Brown4be44fc2005-08-05 00:44:28 -0400297 acpi_ut_track_stack_ptr();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700298
Bob Mooredb38bf52012-12-31 00:06:10 +0000299 /* Check if enabled up-front for performance */
300
301 if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) {
302 acpi_debug_print(ACPI_LV_FUNCTIONS,
303 line_number, function_name, module_name,
Bob Moore0dfaaa32016-03-24 09:40:40 +0800304 component_id, "%s %p\n",
305 acpi_gbl_function_entry_prefix, pointer);
Bob Mooredb38bf52012-12-31 00:06:10 +0000306 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700307}
308
Robert Moore44f6c012005-04-18 22:49:35 -0400309/*******************************************************************************
Linus Torvalds1da177e2005-04-16 15:20:36 -0700310 *
311 * FUNCTION: acpi_ut_trace_str
312 *
313 * PARAMETERS: line_number - Caller's line number
Robert Mooref9f46012005-07-08 00:00:00 -0400314 * function_name - Caller's procedure name
315 * module_name - Caller's module name
316 * component_id - Caller's component ID
Bob Mooreba494be2012-07-12 09:40:10 +0800317 * string - Additional string to display
Linus Torvalds1da177e2005-04-16 15:20:36 -0700318 *
319 * RETURN: None
320 *
Bob Moore73a30902012-10-31 02:26:55 +0000321 * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is
Linus Torvalds1da177e2005-04-16 15:20:36 -0700322 * set in debug_level
323 *
Robert Moore44f6c012005-04-18 22:49:35 -0400324 ******************************************************************************/
Linus Torvalds1da177e2005-04-16 15:20:36 -0700325
326void
Len Brown4be44fc2005-08-05 00:44:28 -0400327acpi_ut_trace_str(u32 line_number,
328 const char *function_name,
Bob Moore0dfaaa32016-03-24 09:40:40 +0800329 const char *module_name, u32 component_id, const char *string)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700330{
331
332 acpi_gbl_nesting_level++;
Len Brown4be44fc2005-08-05 00:44:28 -0400333 acpi_ut_track_stack_ptr();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700334
Bob Mooredb38bf52012-12-31 00:06:10 +0000335 /* Check if enabled up-front for performance */
336
337 if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) {
338 acpi_debug_print(ACPI_LV_FUNCTIONS,
339 line_number, function_name, module_name,
Bob Moore0dfaaa32016-03-24 09:40:40 +0800340 component_id, "%s %s\n",
341 acpi_gbl_function_entry_prefix, string);
Bob Mooredb38bf52012-12-31 00:06:10 +0000342 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700343}
344
Robert Moore44f6c012005-04-18 22:49:35 -0400345/*******************************************************************************
Linus Torvalds1da177e2005-04-16 15:20:36 -0700346 *
347 * FUNCTION: acpi_ut_trace_u32
348 *
349 * PARAMETERS: line_number - Caller's line number
Robert Mooref9f46012005-07-08 00:00:00 -0400350 * function_name - Caller's procedure name
351 * module_name - Caller's module name
352 * component_id - Caller's component ID
Bob Mooreba494be2012-07-12 09:40:10 +0800353 * integer - Integer to display
Linus Torvalds1da177e2005-04-16 15:20:36 -0700354 *
355 * RETURN: None
356 *
Bob Moore73a30902012-10-31 02:26:55 +0000357 * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is
Linus Torvalds1da177e2005-04-16 15:20:36 -0700358 * set in debug_level
359 *
Robert Moore44f6c012005-04-18 22:49:35 -0400360 ******************************************************************************/
Linus Torvalds1da177e2005-04-16 15:20:36 -0700361
362void
Len Brown4be44fc2005-08-05 00:44:28 -0400363acpi_ut_trace_u32(u32 line_number,
364 const char *function_name,
Bob Moore4b8ed632008-06-10 13:55:53 +0800365 const char *module_name, u32 component_id, u32 integer)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700366{
367
368 acpi_gbl_nesting_level++;
Len Brown4be44fc2005-08-05 00:44:28 -0400369 acpi_ut_track_stack_ptr();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700370
Bob Mooredb38bf52012-12-31 00:06:10 +0000371 /* Check if enabled up-front for performance */
372
373 if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) {
374 acpi_debug_print(ACPI_LV_FUNCTIONS,
375 line_number, function_name, module_name,
376 component_id, "%s %08X\n",
Bob Moore0dfaaa32016-03-24 09:40:40 +0800377 acpi_gbl_function_entry_prefix, integer);
Bob Mooredb38bf52012-12-31 00:06:10 +0000378 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700379}
380
Robert Moore44f6c012005-04-18 22:49:35 -0400381/*******************************************************************************
Linus Torvalds1da177e2005-04-16 15:20:36 -0700382 *
383 * FUNCTION: acpi_ut_exit
384 *
385 * PARAMETERS: line_number - Caller's line number
Robert Mooref9f46012005-07-08 00:00:00 -0400386 * function_name - Caller's procedure name
387 * module_name - Caller's module name
388 * component_id - Caller's component ID
Linus Torvalds1da177e2005-04-16 15:20:36 -0700389 *
390 * RETURN: None
391 *
Bob Moore73a30902012-10-31 02:26:55 +0000392 * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is
Linus Torvalds1da177e2005-04-16 15:20:36 -0700393 * set in debug_level
394 *
Robert Moore44f6c012005-04-18 22:49:35 -0400395 ******************************************************************************/
Linus Torvalds1da177e2005-04-16 15:20:36 -0700396
397void
Len Brown4be44fc2005-08-05 00:44:28 -0400398acpi_ut_exit(u32 line_number,
Bob Moore4b8ed632008-06-10 13:55:53 +0800399 const char *function_name,
400 const char *module_name, u32 component_id)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700401{
402
Bob Mooredb38bf52012-12-31 00:06:10 +0000403 /* Check if enabled up-front for performance */
404
405 if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) {
406 acpi_debug_print(ACPI_LV_FUNCTIONS,
407 line_number, function_name, module_name,
Bob Moore0dfaaa32016-03-24 09:40:40 +0800408 component_id, "%s\n",
409 acpi_gbl_function_exit_prefix);
Bob Mooredb38bf52012-12-31 00:06:10 +0000410 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700411
Bob Moorebf9b4482013-11-21 12:17:20 +0800412 if (acpi_gbl_nesting_level) {
413 acpi_gbl_nesting_level--;
414 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700415}
Linus Torvalds1da177e2005-04-16 15:20:36 -0700416
Bob Moore83135242006-10-03 00:00:00 -0400417ACPI_EXPORT_SYMBOL(acpi_ut_exit)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700418
Robert Moore44f6c012005-04-18 22:49:35 -0400419/*******************************************************************************
Linus Torvalds1da177e2005-04-16 15:20:36 -0700420 *
421 * FUNCTION: acpi_ut_status_exit
422 *
423 * PARAMETERS: line_number - Caller's line number
Robert Mooref9f46012005-07-08 00:00:00 -0400424 * function_name - Caller's procedure name
425 * module_name - Caller's module name
426 * component_id - Caller's component ID
Bob Mooreba494be2012-07-12 09:40:10 +0800427 * status - Exit status code
Linus Torvalds1da177e2005-04-16 15:20:36 -0700428 *
429 * RETURN: None
430 *
Bob Moore73a30902012-10-31 02:26:55 +0000431 * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is
Linus Torvalds1da177e2005-04-16 15:20:36 -0700432 * set in debug_level. Prints exit status also.
433 *
Robert Moore44f6c012005-04-18 22:49:35 -0400434 ******************************************************************************/
Linus Torvalds1da177e2005-04-16 15:20:36 -0700435void
Len Brown4be44fc2005-08-05 00:44:28 -0400436acpi_ut_status_exit(u32 line_number,
437 const char *function_name,
Bob Moore4b8ed632008-06-10 13:55:53 +0800438 const char *module_name,
439 u32 component_id, acpi_status status)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700440{
441
Bob Mooredb38bf52012-12-31 00:06:10 +0000442 /* Check if enabled up-front for performance */
443
444 if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) {
445 if (ACPI_SUCCESS(status)) {
446 acpi_debug_print(ACPI_LV_FUNCTIONS,
447 line_number, function_name,
448 module_name, component_id, "%s %s\n",
Bob Moore0dfaaa32016-03-24 09:40:40 +0800449 acpi_gbl_function_exit_prefix,
Bob Mooredb38bf52012-12-31 00:06:10 +0000450 acpi_format_exception(status));
451 } else {
452 acpi_debug_print(ACPI_LV_FUNCTIONS,
453 line_number, function_name,
454 module_name, component_id,
455 "%s ****Exception****: %s\n",
Bob Moore0dfaaa32016-03-24 09:40:40 +0800456 acpi_gbl_function_exit_prefix,
Bob Mooredb38bf52012-12-31 00:06:10 +0000457 acpi_format_exception(status));
458 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700459 }
460
Bob Moorebf9b4482013-11-21 12:17:20 +0800461 if (acpi_gbl_nesting_level) {
462 acpi_gbl_nesting_level--;
463 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700464}
Linus Torvalds1da177e2005-04-16 15:20:36 -0700465
Bob Moore83135242006-10-03 00:00:00 -0400466ACPI_EXPORT_SYMBOL(acpi_ut_status_exit)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700467
Robert Moore44f6c012005-04-18 22:49:35 -0400468/*******************************************************************************
Linus Torvalds1da177e2005-04-16 15:20:36 -0700469 *
470 * FUNCTION: acpi_ut_value_exit
471 *
472 * PARAMETERS: line_number - Caller's line number
Robert Mooref9f46012005-07-08 00:00:00 -0400473 * function_name - Caller's procedure name
474 * module_name - Caller's module name
475 * component_id - Caller's component ID
Bob Mooreba494be2012-07-12 09:40:10 +0800476 * value - Value to be printed with exit msg
Linus Torvalds1da177e2005-04-16 15:20:36 -0700477 *
478 * RETURN: None
479 *
Bob Moore73a30902012-10-31 02:26:55 +0000480 * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is
Linus Torvalds1da177e2005-04-16 15:20:36 -0700481 * set in debug_level. Prints exit value also.
482 *
Robert Moore44f6c012005-04-18 22:49:35 -0400483 ******************************************************************************/
Linus Torvalds1da177e2005-04-16 15:20:36 -0700484void
Len Brown4be44fc2005-08-05 00:44:28 -0400485acpi_ut_value_exit(u32 line_number,
486 const char *function_name,
Bob Moore5df7e6c2010-01-21 10:06:32 +0800487 const char *module_name, u32 component_id, u64 value)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700488{
489
Bob Mooredb38bf52012-12-31 00:06:10 +0000490 /* Check if enabled up-front for performance */
491
492 if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) {
493 acpi_debug_print(ACPI_LV_FUNCTIONS,
494 line_number, function_name, module_name,
495 component_id, "%s %8.8X%8.8X\n",
Bob Moore0dfaaa32016-03-24 09:40:40 +0800496 acpi_gbl_function_exit_prefix,
Bob Mooredb38bf52012-12-31 00:06:10 +0000497 ACPI_FORMAT_UINT64(value));
498 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700499
Bob Moorebf9b4482013-11-21 12:17:20 +0800500 if (acpi_gbl_nesting_level) {
501 acpi_gbl_nesting_level--;
502 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700503}
Linus Torvalds1da177e2005-04-16 15:20:36 -0700504
Bob Moore83135242006-10-03 00:00:00 -0400505ACPI_EXPORT_SYMBOL(acpi_ut_value_exit)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700506
Robert Moore44f6c012005-04-18 22:49:35 -0400507/*******************************************************************************
Linus Torvalds1da177e2005-04-16 15:20:36 -0700508 *
509 * FUNCTION: acpi_ut_ptr_exit
510 *
511 * PARAMETERS: line_number - Caller's line number
Robert Mooref9f46012005-07-08 00:00:00 -0400512 * function_name - Caller's procedure name
513 * module_name - Caller's module name
514 * component_id - Caller's component ID
Bob Mooreba494be2012-07-12 09:40:10 +0800515 * ptr - Pointer to display
Linus Torvalds1da177e2005-04-16 15:20:36 -0700516 *
517 * RETURN: None
518 *
Bob Moore73a30902012-10-31 02:26:55 +0000519 * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is
Linus Torvalds1da177e2005-04-16 15:20:36 -0700520 * set in debug_level. Prints exit value also.
521 *
Robert Moore44f6c012005-04-18 22:49:35 -0400522 ******************************************************************************/
Linus Torvalds1da177e2005-04-16 15:20:36 -0700523void
Len Brown4be44fc2005-08-05 00:44:28 -0400524acpi_ut_ptr_exit(u32 line_number,
525 const char *function_name,
Bob Moore4b8ed632008-06-10 13:55:53 +0800526 const char *module_name, u32 component_id, u8 *ptr)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700527{
528
Bob Mooredb38bf52012-12-31 00:06:10 +0000529 /* Check if enabled up-front for performance */
530
531 if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) {
532 acpi_debug_print(ACPI_LV_FUNCTIONS,
533 line_number, function_name, module_name,
Bob Moore0dfaaa32016-03-24 09:40:40 +0800534 component_id, "%s %p\n",
535 acpi_gbl_function_exit_prefix, ptr);
Bob Mooredb38bf52012-12-31 00:06:10 +0000536 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700537
Bob Moorebf9b4482013-11-21 12:17:20 +0800538 if (acpi_gbl_nesting_level) {
539 acpi_gbl_nesting_level--;
540 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700541}
542
Lv Zhengbab04822015-07-23 12:53:07 +0800543/*******************************************************************************
544 *
Jung-uk Kim4857a942016-08-04 16:42:19 +0800545 * FUNCTION: acpi_ut_str_exit
546 *
547 * PARAMETERS: line_number - Caller's line number
548 * function_name - Caller's procedure name
549 * module_name - Caller's module name
550 * component_id - Caller's component ID
551 * string - String to display
552 *
553 * RETURN: None
554 *
555 * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is
556 * set in debug_level. Prints exit value also.
557 *
558 ******************************************************************************/
559
560void
561acpi_ut_str_exit(u32 line_number,
562 const char *function_name,
563 const char *module_name, u32 component_id, const char *string)
564{
565
566 /* Check if enabled up-front for performance */
567
568 if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) {
569 acpi_debug_print(ACPI_LV_FUNCTIONS,
570 line_number, function_name, module_name,
571 component_id, "%s %s\n",
572 acpi_gbl_function_exit_prefix, string);
573 }
574
575 if (acpi_gbl_nesting_level) {
576 acpi_gbl_nesting_level--;
577 }
578}
579
580/*******************************************************************************
581 *
Lv Zhengbab04822015-07-23 12:53:07 +0800582 * FUNCTION: acpi_trace_point
583 *
584 * PARAMETERS: type - Trace event type
585 * begin - TRUE if before execution
586 * aml - Executed AML address
587 * pathname - Object path
588 * pointer - Pointer to the related object
589 *
590 * RETURN: None
591 *
592 * DESCRIPTION: Interpreter execution trace.
593 *
594 ******************************************************************************/
Lv Zheng2e70da42014-07-08 10:07:06 +0800595
Lv Zhengbab04822015-07-23 12:53:07 +0800596void
597acpi_trace_point(acpi_trace_event_type type, u8 begin, u8 *aml, char *pathname)
598{
599
600 ACPI_FUNCTION_ENTRY();
601
602 acpi_ex_trace_point(type, begin, aml, pathname);
603
604#ifdef ACPI_USE_SYSTEM_TRACER
605 acpi_os_trace_point(type, begin, aml, pathname);
606#endif
607}
608
609ACPI_EXPORT_SYMBOL(acpi_trace_point)
Bob Moore9cf7ade2017-04-28 08:53:22 +0800610
Lv Zhengbab04822015-07-23 12:53:07 +0800611#endif