195857638SErik Schmauss // SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 295b482a8SLen Brown /****************************************************************************** 395b482a8SLen Brown * 488ec2860SBob Moore * Module Name: utdebug - Debug print/trace routines 595b482a8SLen Brown * 6840c02caSBob Moore * Copyright (C) 2000 - 2019, Intel Corp. 795b482a8SLen Brown * 895857638SErik Schmauss *****************************************************************************/ 995b482a8SLen Brown 10839e928fSLv Zheng #define EXPORT_ACPI_INTERFACES 11839e928fSLv Zheng 1295b482a8SLen Brown #include <acpi/acpi.h> 13e2f7a777SLen Brown #include "accommon.h" 14bab04824SLv Zheng #include "acinterp.h" 1595b482a8SLen Brown 1695b482a8SLen Brown #define _COMPONENT ACPI_UTILITIES 1795b482a8SLen Brown ACPI_MODULE_NAME("utdebug") 186d33b6beSLv Zheng 1995b482a8SLen Brown #ifdef ACPI_DEBUG_OUTPUT 200dfaaa3dSBob Moore static acpi_thread_id acpi_gbl_previous_thread_id = (acpi_thread_id) 0xFFFFFFFF; 210dfaaa3dSBob Moore static const char *acpi_gbl_function_entry_prefix = "----Entry"; 220dfaaa3dSBob Moore static const char *acpi_gbl_function_exit_prefix = "----Exit-"; 2395b482a8SLen Brown 2495b482a8SLen Brown /******************************************************************************* 2595b482a8SLen Brown * 2695b482a8SLen Brown * FUNCTION: acpi_ut_init_stack_ptr_trace 2795b482a8SLen Brown * 2895b482a8SLen Brown * PARAMETERS: None 2995b482a8SLen Brown * 3095b482a8SLen Brown * RETURN: None 3195b482a8SLen Brown * 3295b482a8SLen Brown * DESCRIPTION: Save the current CPU stack pointer at subsystem startup 3395b482a8SLen Brown * 3495b482a8SLen Brown ******************************************************************************/ 3595b482a8SLen Brown 3695b482a8SLen Brown void acpi_ut_init_stack_ptr_trace(void) 3795b482a8SLen Brown { 3895b482a8SLen Brown acpi_size current_sp; 3995b482a8SLen Brown 4095b482a8SLen Brown acpi_gbl_entry_stack_pointer = ¤t_sp; 4195b482a8SLen Brown } 4295b482a8SLen Brown 4395b482a8SLen Brown /******************************************************************************* 4495b482a8SLen Brown * 4595b482a8SLen Brown * FUNCTION: acpi_ut_track_stack_ptr 4695b482a8SLen Brown * 4795b482a8SLen Brown * PARAMETERS: None 4895b482a8SLen Brown * 4995b482a8SLen Brown * RETURN: None 5095b482a8SLen Brown * 5195b482a8SLen Brown * DESCRIPTION: Save the current CPU stack pointer 5295b482a8SLen Brown * 5395b482a8SLen Brown ******************************************************************************/ 5495b482a8SLen Brown 5595b482a8SLen Brown void acpi_ut_track_stack_ptr(void) 5695b482a8SLen Brown { 5795b482a8SLen Brown acpi_size current_sp; 5895b482a8SLen Brown 5995b482a8SLen Brown if (¤t_sp < acpi_gbl_lowest_stack_pointer) { 6095b482a8SLen Brown acpi_gbl_lowest_stack_pointer = ¤t_sp; 6195b482a8SLen Brown } 6295b482a8SLen Brown 6395b482a8SLen Brown if (acpi_gbl_nesting_level > acpi_gbl_deepest_nesting) { 6495b482a8SLen Brown acpi_gbl_deepest_nesting = acpi_gbl_nesting_level; 6595b482a8SLen Brown } 6695b482a8SLen Brown } 6795b482a8SLen Brown 6895b482a8SLen Brown /******************************************************************************* 6995b482a8SLen Brown * 7095b482a8SLen Brown * FUNCTION: acpi_ut_trim_function_name 7195b482a8SLen Brown * 7295b482a8SLen Brown * PARAMETERS: function_name - Ascii string containing a procedure name 7395b482a8SLen Brown * 7495b482a8SLen Brown * RETURN: Updated pointer to the function name 7595b482a8SLen Brown * 7695b482a8SLen Brown * DESCRIPTION: Remove the "Acpi" prefix from the function name, if present. 777011bf4eSLv Zheng * This allows compiler macros such as __func__ to be used 787011bf4eSLv Zheng * with no change to the debug output. 7995b482a8SLen Brown * 8095b482a8SLen Brown ******************************************************************************/ 8195b482a8SLen Brown 8295b482a8SLen Brown static const char *acpi_ut_trim_function_name(const char *function_name) 8395b482a8SLen Brown { 8495b482a8SLen Brown 8595b482a8SLen Brown /* All Function names are longer than 4 chars, check is safe */ 8695b482a8SLen Brown 8795b482a8SLen Brown if (*(ACPI_CAST_PTR(u32, function_name)) == ACPI_PREFIX_MIXED) { 8895b482a8SLen Brown 8995b482a8SLen Brown /* This is the case where the original source has not been modified */ 9095b482a8SLen Brown 9195b482a8SLen Brown return (function_name + 4); 9295b482a8SLen Brown } 9395b482a8SLen Brown 9495b482a8SLen Brown if (*(ACPI_CAST_PTR(u32, function_name)) == ACPI_PREFIX_LOWER) { 9595b482a8SLen Brown 9695b482a8SLen Brown /* This is the case where the source has been 'linuxized' */ 9795b482a8SLen Brown 9895b482a8SLen Brown return (function_name + 5); 9995b482a8SLen Brown } 10095b482a8SLen Brown 10195b482a8SLen Brown return (function_name); 10295b482a8SLen Brown } 10395b482a8SLen Brown 10495b482a8SLen Brown /******************************************************************************* 10595b482a8SLen Brown * 10695b482a8SLen Brown * FUNCTION: acpi_debug_print 10795b482a8SLen Brown * 10895b482a8SLen Brown * PARAMETERS: requested_debug_level - Requested debug print level 10995b482a8SLen Brown * line_number - Caller's line number (for error output) 11095b482a8SLen Brown * function_name - Caller's procedure name 11195b482a8SLen Brown * module_name - Caller's module name 11295b482a8SLen Brown * component_id - Caller's component ID 113ba494beeSBob Moore * format - Printf format field 11495b482a8SLen Brown * ... - Optional printf arguments 11595b482a8SLen Brown * 11695b482a8SLen Brown * RETURN: None 11795b482a8SLen Brown * 11895b482a8SLen Brown * DESCRIPTION: Print error message with prefix consisting of the module name, 11995b482a8SLen Brown * line number, and component ID. 12095b482a8SLen Brown * 12195b482a8SLen Brown ******************************************************************************/ 12295b482a8SLen Brown 12395b482a8SLen Brown void ACPI_INTERNAL_VAR_XFACE 12495b482a8SLen Brown acpi_debug_print(u32 requested_debug_level, 12595b482a8SLen Brown u32 line_number, 12695b482a8SLen Brown const char *function_name, 12795b482a8SLen Brown const char *module_name, 12895b482a8SLen Brown u32 component_id, const char *format, ...) 12995b482a8SLen Brown { 13095b482a8SLen Brown acpi_thread_id thread_id; 13195b482a8SLen Brown va_list args; 1322cb0ba70SBob Moore #ifdef ACPI_APPLICATION 1336be2d72bSBob Moore int fill_count; 1342cb0ba70SBob Moore #endif 13595b482a8SLen Brown 136db38bf5aSBob Moore /* Check if debug output enabled */ 137db38bf5aSBob Moore 138db38bf5aSBob Moore if (!ACPI_IS_DEBUG_ENABLED(requested_debug_level, component_id)) { 13995b482a8SLen Brown return; 14095b482a8SLen Brown } 14195b482a8SLen Brown 14295b482a8SLen Brown /* 14395b482a8SLen Brown * Thread tracking and context switch notification 14495b482a8SLen Brown */ 14595b482a8SLen Brown thread_id = acpi_os_get_thread_id(); 1460dfaaa3dSBob Moore if (thread_id != acpi_gbl_previous_thread_id) { 14795b482a8SLen Brown if (ACPI_LV_THREADS & acpi_dbg_level) { 14895b482a8SLen Brown acpi_os_printf 14928eb3fcfSLin Ming ("\n**** Context Switch from TID %u to TID %u ****\n\n", 1500dfaaa3dSBob Moore (u32)acpi_gbl_previous_thread_id, (u32)thread_id); 15195b482a8SLen Brown } 15295b482a8SLen Brown 1530dfaaa3dSBob Moore acpi_gbl_previous_thread_id = thread_id; 154bf9b448eSBob Moore acpi_gbl_nesting_level = 0; 15595b482a8SLen Brown } 15695b482a8SLen Brown 15795b482a8SLen Brown /* 15895b482a8SLen Brown * Display the module name, current line number, thread ID (if requested), 15995b482a8SLen Brown * current procedure nesting level, and the current procedure name 16095b482a8SLen Brown */ 161*36056d0cSBob Moore acpi_os_printf("%9s-%04d ", module_name, line_number); 16295b482a8SLen Brown 1635076f005SBob Moore #ifdef ACPI_APPLICATION 164bf9b448eSBob Moore /* 1655076f005SBob Moore * For acpi_exec/iASL only, emit the thread ID and nesting level. 166bf9b448eSBob Moore * Note: nesting level is really only useful during a single-thread 167bf9b448eSBob Moore * execution. Otherwise, multiple threads will keep resetting the 168bf9b448eSBob Moore * level. 169bf9b448eSBob Moore */ 17095b482a8SLen Brown if (ACPI_LV_THREADS & acpi_dbg_level) { 17128eb3fcfSLin Ming acpi_os_printf("[%u] ", (u32)thread_id); 17295b482a8SLen Brown } 17395b482a8SLen Brown 1746be2d72bSBob Moore fill_count = 48 - acpi_gbl_nesting_level - 1756be2d72bSBob Moore strlen(acpi_ut_trim_function_name(function_name)); 1766be2d72bSBob Moore if (fill_count < 0) { 1776be2d72bSBob Moore fill_count = 0; 1786be2d72bSBob Moore } 179bf9b448eSBob Moore 180*36056d0cSBob Moore acpi_os_printf("[%02d] %*s", 1816e875fa0SErik Schmauss acpi_gbl_nesting_level, acpi_gbl_nesting_level + 1, " "); 1826be2d72bSBob Moore acpi_os_printf("%s%*s: ", 1836be2d72bSBob Moore acpi_ut_trim_function_name(function_name), fill_count, 1846be2d72bSBob Moore " "); 1856be2d72bSBob Moore 1866be2d72bSBob Moore #else 187bf9b448eSBob Moore acpi_os_printf("%-22.22s: ", acpi_ut_trim_function_name(function_name)); 1886be2d72bSBob Moore #endif 18995b482a8SLen Brown 19095b482a8SLen Brown va_start(args, format); 19195b482a8SLen Brown acpi_os_vprintf(format, args); 19295b482a8SLen Brown va_end(args); 19395b482a8SLen Brown } 19495b482a8SLen Brown 19595b482a8SLen Brown ACPI_EXPORT_SYMBOL(acpi_debug_print) 19695b482a8SLen Brown 19795b482a8SLen Brown /******************************************************************************* 19895b482a8SLen Brown * 19995b482a8SLen Brown * FUNCTION: acpi_debug_print_raw 20095b482a8SLen Brown * 20195b482a8SLen Brown * PARAMETERS: requested_debug_level - Requested debug print level 20295b482a8SLen Brown * line_number - Caller's line number 20395b482a8SLen Brown * function_name - Caller's procedure name 20495b482a8SLen Brown * module_name - Caller's module name 20595b482a8SLen Brown * component_id - Caller's component ID 206ba494beeSBob Moore * format - Printf format field 20795b482a8SLen Brown * ... - Optional printf arguments 20895b482a8SLen Brown * 20995b482a8SLen Brown * RETURN: None 21095b482a8SLen Brown * 21195b482a8SLen Brown * DESCRIPTION: Print message with no headers. Has same interface as 21295b482a8SLen Brown * debug_print so that the same macros can be used. 21395b482a8SLen Brown * 21495b482a8SLen Brown ******************************************************************************/ 21595b482a8SLen Brown void ACPI_INTERNAL_VAR_XFACE 21695b482a8SLen Brown acpi_debug_print_raw(u32 requested_debug_level, 21795b482a8SLen Brown u32 line_number, 21895b482a8SLen Brown const char *function_name, 21995b482a8SLen Brown const char *module_name, 22095b482a8SLen Brown u32 component_id, const char *format, ...) 22195b482a8SLen Brown { 22295b482a8SLen Brown va_list args; 22395b482a8SLen Brown 224db38bf5aSBob Moore /* Check if debug output enabled */ 225db38bf5aSBob Moore 226db38bf5aSBob Moore if (!ACPI_IS_DEBUG_ENABLED(requested_debug_level, component_id)) { 22795b482a8SLen Brown return; 22895b482a8SLen Brown } 22995b482a8SLen Brown 23095b482a8SLen Brown va_start(args, format); 23195b482a8SLen Brown acpi_os_vprintf(format, args); 23295b482a8SLen Brown va_end(args); 23395b482a8SLen Brown } 23495b482a8SLen Brown 23595b482a8SLen Brown ACPI_EXPORT_SYMBOL(acpi_debug_print_raw) 23695b482a8SLen Brown 23795b482a8SLen Brown /******************************************************************************* 23895b482a8SLen Brown * 23995b482a8SLen Brown * FUNCTION: acpi_ut_trace 24095b482a8SLen Brown * 24195b482a8SLen Brown * PARAMETERS: line_number - Caller's line number 24295b482a8SLen Brown * function_name - Caller's procedure name 24395b482a8SLen Brown * module_name - Caller's module name 24495b482a8SLen Brown * component_id - Caller's component ID 24595b482a8SLen Brown * 24695b482a8SLen Brown * RETURN: None 24795b482a8SLen Brown * 24895b482a8SLen Brown * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is 24995b482a8SLen Brown * set in debug_level 25095b482a8SLen Brown * 25195b482a8SLen Brown ******************************************************************************/ 25295b482a8SLen Brown void 25395b482a8SLen Brown acpi_ut_trace(u32 line_number, 25495b482a8SLen Brown const char *function_name, 25595b482a8SLen Brown const char *module_name, u32 component_id) 25695b482a8SLen Brown { 25795b482a8SLen Brown 25895b482a8SLen Brown acpi_gbl_nesting_level++; 25995b482a8SLen Brown acpi_ut_track_stack_ptr(); 26095b482a8SLen Brown 261db38bf5aSBob Moore /* Check if enabled up-front for performance */ 262db38bf5aSBob Moore 263db38bf5aSBob Moore if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) { 26495b482a8SLen Brown acpi_debug_print(ACPI_LV_FUNCTIONS, 265db38bf5aSBob Moore line_number, function_name, module_name, 2660dfaaa3dSBob Moore component_id, "%s\n", 2670dfaaa3dSBob Moore acpi_gbl_function_entry_prefix); 268db38bf5aSBob Moore } 26995b482a8SLen Brown } 27095b482a8SLen Brown 27195b482a8SLen Brown ACPI_EXPORT_SYMBOL(acpi_ut_trace) 27295b482a8SLen Brown 27395b482a8SLen Brown /******************************************************************************* 27495b482a8SLen Brown * 27595b482a8SLen Brown * FUNCTION: acpi_ut_trace_ptr 27695b482a8SLen Brown * 27795b482a8SLen Brown * PARAMETERS: line_number - Caller's line number 27895b482a8SLen Brown * function_name - Caller's procedure name 27995b482a8SLen Brown * module_name - Caller's module name 28095b482a8SLen Brown * component_id - Caller's component ID 281ba494beeSBob Moore * pointer - Pointer to display 28295b482a8SLen Brown * 28395b482a8SLen Brown * RETURN: None 28495b482a8SLen Brown * 28595b482a8SLen Brown * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is 28695b482a8SLen Brown * set in debug_level 28795b482a8SLen Brown * 28895b482a8SLen Brown ******************************************************************************/ 28995b482a8SLen Brown void 29095b482a8SLen Brown acpi_ut_trace_ptr(u32 line_number, 29195b482a8SLen Brown const char *function_name, 2920dfaaa3dSBob Moore const char *module_name, 2930dfaaa3dSBob Moore u32 component_id, const void *pointer) 29495b482a8SLen Brown { 29568aafc35SBob Moore 29695b482a8SLen Brown acpi_gbl_nesting_level++; 29795b482a8SLen Brown acpi_ut_track_stack_ptr(); 29895b482a8SLen Brown 299db38bf5aSBob Moore /* Check if enabled up-front for performance */ 300db38bf5aSBob Moore 301db38bf5aSBob Moore if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) { 30295b482a8SLen Brown acpi_debug_print(ACPI_LV_FUNCTIONS, 303db38bf5aSBob Moore line_number, function_name, module_name, 3040dfaaa3dSBob Moore component_id, "%s %p\n", 3050dfaaa3dSBob Moore acpi_gbl_function_entry_prefix, pointer); 306db38bf5aSBob Moore } 30795b482a8SLen Brown } 30895b482a8SLen Brown 30995b482a8SLen Brown /******************************************************************************* 31095b482a8SLen Brown * 31195b482a8SLen Brown * FUNCTION: acpi_ut_trace_str 31295b482a8SLen Brown * 31395b482a8SLen Brown * PARAMETERS: line_number - Caller's line number 31495b482a8SLen Brown * function_name - Caller's procedure name 31595b482a8SLen Brown * module_name - Caller's module name 31695b482a8SLen Brown * component_id - Caller's component ID 317ba494beeSBob Moore * string - Additional string to display 31895b482a8SLen Brown * 31995b482a8SLen Brown * RETURN: None 32095b482a8SLen Brown * 32195b482a8SLen Brown * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is 32295b482a8SLen Brown * set in debug_level 32395b482a8SLen Brown * 32495b482a8SLen Brown ******************************************************************************/ 32595b482a8SLen Brown 32695b482a8SLen Brown void 32795b482a8SLen Brown acpi_ut_trace_str(u32 line_number, 32895b482a8SLen Brown const char *function_name, 3290dfaaa3dSBob Moore const char *module_name, u32 component_id, const char *string) 33095b482a8SLen Brown { 33195b482a8SLen Brown 33295b482a8SLen Brown acpi_gbl_nesting_level++; 33395b482a8SLen Brown acpi_ut_track_stack_ptr(); 33495b482a8SLen Brown 335db38bf5aSBob Moore /* Check if enabled up-front for performance */ 336db38bf5aSBob Moore 337db38bf5aSBob Moore if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) { 33895b482a8SLen Brown acpi_debug_print(ACPI_LV_FUNCTIONS, 339db38bf5aSBob Moore line_number, function_name, module_name, 3400dfaaa3dSBob Moore component_id, "%s %s\n", 3410dfaaa3dSBob Moore acpi_gbl_function_entry_prefix, string); 342db38bf5aSBob Moore } 34395b482a8SLen Brown } 34495b482a8SLen Brown 34595b482a8SLen Brown /******************************************************************************* 34695b482a8SLen Brown * 34795b482a8SLen Brown * FUNCTION: acpi_ut_trace_u32 34895b482a8SLen Brown * 34995b482a8SLen Brown * PARAMETERS: line_number - Caller's line number 35095b482a8SLen Brown * function_name - Caller's procedure name 35195b482a8SLen Brown * module_name - Caller's module name 35295b482a8SLen Brown * component_id - Caller's component ID 353ba494beeSBob Moore * integer - Integer to display 35495b482a8SLen Brown * 35595b482a8SLen Brown * RETURN: None 35695b482a8SLen Brown * 35795b482a8SLen Brown * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is 35895b482a8SLen Brown * set in debug_level 35995b482a8SLen Brown * 36095b482a8SLen Brown ******************************************************************************/ 36195b482a8SLen Brown 36295b482a8SLen Brown void 36395b482a8SLen Brown acpi_ut_trace_u32(u32 line_number, 36495b482a8SLen Brown const char *function_name, 36595b482a8SLen Brown const char *module_name, u32 component_id, u32 integer) 36695b482a8SLen Brown { 36795b482a8SLen Brown 36895b482a8SLen Brown acpi_gbl_nesting_level++; 36995b482a8SLen Brown acpi_ut_track_stack_ptr(); 37095b482a8SLen Brown 371db38bf5aSBob Moore /* Check if enabled up-front for performance */ 372db38bf5aSBob Moore 373db38bf5aSBob Moore if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) { 37495b482a8SLen Brown acpi_debug_print(ACPI_LV_FUNCTIONS, 375db38bf5aSBob Moore line_number, function_name, module_name, 376db38bf5aSBob Moore component_id, "%s %08X\n", 3770dfaaa3dSBob Moore acpi_gbl_function_entry_prefix, integer); 378db38bf5aSBob Moore } 37995b482a8SLen Brown } 38095b482a8SLen Brown 38195b482a8SLen Brown /******************************************************************************* 38295b482a8SLen Brown * 38395b482a8SLen Brown * FUNCTION: acpi_ut_exit 38495b482a8SLen Brown * 38595b482a8SLen Brown * PARAMETERS: line_number - Caller's line number 38695b482a8SLen Brown * function_name - Caller's procedure name 38795b482a8SLen Brown * module_name - Caller's module name 38895b482a8SLen Brown * component_id - Caller's component ID 38995b482a8SLen Brown * 39095b482a8SLen Brown * RETURN: None 39195b482a8SLen Brown * 39295b482a8SLen Brown * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is 39395b482a8SLen Brown * set in debug_level 39495b482a8SLen Brown * 39595b482a8SLen Brown ******************************************************************************/ 39695b482a8SLen Brown 39795b482a8SLen Brown void 39895b482a8SLen Brown acpi_ut_exit(u32 line_number, 39995b482a8SLen Brown const char *function_name, 40095b482a8SLen Brown const char *module_name, u32 component_id) 40195b482a8SLen Brown { 40295b482a8SLen Brown 403db38bf5aSBob Moore /* Check if enabled up-front for performance */ 404db38bf5aSBob Moore 405db38bf5aSBob Moore if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) { 40695b482a8SLen Brown acpi_debug_print(ACPI_LV_FUNCTIONS, 407db38bf5aSBob Moore line_number, function_name, module_name, 4080dfaaa3dSBob Moore component_id, "%s\n", 4090dfaaa3dSBob Moore acpi_gbl_function_exit_prefix); 410db38bf5aSBob Moore } 41195b482a8SLen Brown 412bf9b448eSBob Moore if (acpi_gbl_nesting_level) { 41395b482a8SLen Brown acpi_gbl_nesting_level--; 41495b482a8SLen Brown } 415bf9b448eSBob Moore } 41695b482a8SLen Brown 41795b482a8SLen Brown ACPI_EXPORT_SYMBOL(acpi_ut_exit) 41895b482a8SLen Brown 41995b482a8SLen Brown /******************************************************************************* 42095b482a8SLen Brown * 42195b482a8SLen Brown * FUNCTION: acpi_ut_status_exit 42295b482a8SLen Brown * 42395b482a8SLen Brown * PARAMETERS: line_number - Caller's line number 42495b482a8SLen Brown * function_name - Caller's procedure name 42595b482a8SLen Brown * module_name - Caller's module name 42695b482a8SLen Brown * component_id - Caller's component ID 427ba494beeSBob Moore * status - Exit status code 42895b482a8SLen Brown * 42995b482a8SLen Brown * RETURN: None 43095b482a8SLen Brown * 43195b482a8SLen Brown * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is 43295b482a8SLen Brown * set in debug_level. Prints exit status also. 43395b482a8SLen Brown * 43495b482a8SLen Brown ******************************************************************************/ 43595b482a8SLen Brown void 43695b482a8SLen Brown acpi_ut_status_exit(u32 line_number, 43795b482a8SLen Brown const char *function_name, 43895b482a8SLen Brown const char *module_name, 43995b482a8SLen Brown u32 component_id, acpi_status status) 44095b482a8SLen Brown { 44195b482a8SLen Brown 442db38bf5aSBob Moore /* Check if enabled up-front for performance */ 443db38bf5aSBob Moore 444db38bf5aSBob Moore if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) { 44595b482a8SLen Brown if (ACPI_SUCCESS(status)) { 44695b482a8SLen Brown acpi_debug_print(ACPI_LV_FUNCTIONS, 447db38bf5aSBob Moore line_number, function_name, 448db38bf5aSBob Moore module_name, component_id, "%s %s\n", 4490dfaaa3dSBob Moore acpi_gbl_function_exit_prefix, 45095b482a8SLen Brown acpi_format_exception(status)); 45195b482a8SLen Brown } else { 45295b482a8SLen Brown acpi_debug_print(ACPI_LV_FUNCTIONS, 453db38bf5aSBob Moore line_number, function_name, 454db38bf5aSBob Moore module_name, component_id, 455db38bf5aSBob Moore "%s ****Exception****: %s\n", 4560dfaaa3dSBob Moore acpi_gbl_function_exit_prefix, 45795b482a8SLen Brown acpi_format_exception(status)); 45895b482a8SLen Brown } 459db38bf5aSBob Moore } 46095b482a8SLen Brown 461bf9b448eSBob Moore if (acpi_gbl_nesting_level) { 46295b482a8SLen Brown acpi_gbl_nesting_level--; 46395b482a8SLen Brown } 464bf9b448eSBob Moore } 46595b482a8SLen Brown 46695b482a8SLen Brown ACPI_EXPORT_SYMBOL(acpi_ut_status_exit) 46795b482a8SLen Brown 46895b482a8SLen Brown /******************************************************************************* 46995b482a8SLen Brown * 47095b482a8SLen Brown * FUNCTION: acpi_ut_value_exit 47195b482a8SLen Brown * 47295b482a8SLen Brown * PARAMETERS: line_number - Caller's line number 47395b482a8SLen Brown * function_name - Caller's procedure name 47495b482a8SLen Brown * module_name - Caller's module name 47595b482a8SLen Brown * component_id - Caller's component ID 476ba494beeSBob Moore * value - Value to be printed with exit msg 47795b482a8SLen Brown * 47895b482a8SLen Brown * RETURN: None 47995b482a8SLen Brown * 48095b482a8SLen Brown * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is 48195b482a8SLen Brown * set in debug_level. Prints exit value also. 48295b482a8SLen Brown * 48395b482a8SLen Brown ******************************************************************************/ 48495b482a8SLen Brown void 48595b482a8SLen Brown acpi_ut_value_exit(u32 line_number, 48695b482a8SLen Brown const char *function_name, 4875df7e6cbSBob Moore const char *module_name, u32 component_id, u64 value) 48895b482a8SLen Brown { 48995b482a8SLen Brown 490db38bf5aSBob Moore /* Check if enabled up-front for performance */ 491db38bf5aSBob Moore 492db38bf5aSBob Moore if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) { 49395b482a8SLen Brown acpi_debug_print(ACPI_LV_FUNCTIONS, 494db38bf5aSBob Moore line_number, function_name, module_name, 495db38bf5aSBob Moore component_id, "%s %8.8X%8.8X\n", 4960dfaaa3dSBob Moore acpi_gbl_function_exit_prefix, 49795b482a8SLen Brown ACPI_FORMAT_UINT64(value)); 498db38bf5aSBob Moore } 49995b482a8SLen Brown 500bf9b448eSBob Moore if (acpi_gbl_nesting_level) { 50195b482a8SLen Brown acpi_gbl_nesting_level--; 50295b482a8SLen Brown } 503bf9b448eSBob Moore } 50495b482a8SLen Brown 50595b482a8SLen Brown ACPI_EXPORT_SYMBOL(acpi_ut_value_exit) 50695b482a8SLen Brown 50795b482a8SLen Brown /******************************************************************************* 50895b482a8SLen Brown * 50995b482a8SLen Brown * FUNCTION: acpi_ut_ptr_exit 51095b482a8SLen Brown * 51195b482a8SLen Brown * PARAMETERS: line_number - Caller's line number 51295b482a8SLen Brown * function_name - Caller's procedure name 51395b482a8SLen Brown * module_name - Caller's module name 51495b482a8SLen Brown * component_id - Caller's component ID 515ba494beeSBob Moore * ptr - Pointer to display 51695b482a8SLen Brown * 51795b482a8SLen Brown * RETURN: None 51895b482a8SLen Brown * 51995b482a8SLen Brown * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is 52095b482a8SLen Brown * set in debug_level. Prints exit value also. 52195b482a8SLen Brown * 52295b482a8SLen Brown ******************************************************************************/ 52395b482a8SLen Brown void 52495b482a8SLen Brown acpi_ut_ptr_exit(u32 line_number, 52595b482a8SLen Brown const char *function_name, 52695b482a8SLen Brown const char *module_name, u32 component_id, u8 *ptr) 52795b482a8SLen Brown { 52895b482a8SLen Brown 529db38bf5aSBob Moore /* Check if enabled up-front for performance */ 530db38bf5aSBob Moore 531db38bf5aSBob Moore if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) { 53295b482a8SLen Brown acpi_debug_print(ACPI_LV_FUNCTIONS, 533db38bf5aSBob Moore line_number, function_name, module_name, 5340dfaaa3dSBob Moore component_id, "%s %p\n", 5350dfaaa3dSBob Moore acpi_gbl_function_exit_prefix, ptr); 536db38bf5aSBob Moore } 53795b482a8SLen Brown 538bf9b448eSBob Moore if (acpi_gbl_nesting_level) { 53995b482a8SLen Brown acpi_gbl_nesting_level--; 54095b482a8SLen Brown } 541bf9b448eSBob Moore } 54295b482a8SLen Brown 543bab04824SLv Zheng /******************************************************************************* 544bab04824SLv Zheng * 5454857a94dSJung-uk Kim * FUNCTION: acpi_ut_str_exit 5464857a94dSJung-uk Kim * 5474857a94dSJung-uk Kim * PARAMETERS: line_number - Caller's line number 5484857a94dSJung-uk Kim * function_name - Caller's procedure name 5494857a94dSJung-uk Kim * module_name - Caller's module name 5504857a94dSJung-uk Kim * component_id - Caller's component ID 5514857a94dSJung-uk Kim * string - String to display 5524857a94dSJung-uk Kim * 5534857a94dSJung-uk Kim * RETURN: None 5544857a94dSJung-uk Kim * 5554857a94dSJung-uk Kim * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is 5564857a94dSJung-uk Kim * set in debug_level. Prints exit value also. 5574857a94dSJung-uk Kim * 5584857a94dSJung-uk Kim ******************************************************************************/ 5594857a94dSJung-uk Kim 5604857a94dSJung-uk Kim void 5614857a94dSJung-uk Kim acpi_ut_str_exit(u32 line_number, 5624857a94dSJung-uk Kim const char *function_name, 5634857a94dSJung-uk Kim const char *module_name, u32 component_id, const char *string) 5644857a94dSJung-uk Kim { 5654857a94dSJung-uk Kim 5664857a94dSJung-uk Kim /* Check if enabled up-front for performance */ 5674857a94dSJung-uk Kim 5684857a94dSJung-uk Kim if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) { 5694857a94dSJung-uk Kim acpi_debug_print(ACPI_LV_FUNCTIONS, 5704857a94dSJung-uk Kim line_number, function_name, module_name, 5714857a94dSJung-uk Kim component_id, "%s %s\n", 5724857a94dSJung-uk Kim acpi_gbl_function_exit_prefix, string); 5734857a94dSJung-uk Kim } 5744857a94dSJung-uk Kim 5754857a94dSJung-uk Kim if (acpi_gbl_nesting_level) { 5764857a94dSJung-uk Kim acpi_gbl_nesting_level--; 5774857a94dSJung-uk Kim } 5784857a94dSJung-uk Kim } 5794857a94dSJung-uk Kim 5804857a94dSJung-uk Kim /******************************************************************************* 5814857a94dSJung-uk Kim * 582bab04824SLv Zheng * FUNCTION: acpi_trace_point 583bab04824SLv Zheng * 584bab04824SLv Zheng * PARAMETERS: type - Trace event type 585bab04824SLv Zheng * begin - TRUE if before execution 586bab04824SLv Zheng * aml - Executed AML address 587bab04824SLv Zheng * pathname - Object path 588bab04824SLv Zheng * pointer - Pointer to the related object 589bab04824SLv Zheng * 590bab04824SLv Zheng * RETURN: None 591bab04824SLv Zheng * 592bab04824SLv Zheng * DESCRIPTION: Interpreter execution trace. 593bab04824SLv Zheng * 594bab04824SLv Zheng ******************************************************************************/ 5952e70da4cSLv Zheng 596bab04824SLv Zheng void 597bab04824SLv Zheng acpi_trace_point(acpi_trace_event_type type, u8 begin, u8 *aml, char *pathname) 598bab04824SLv Zheng { 599bab04824SLv Zheng 600bab04824SLv Zheng ACPI_FUNCTION_ENTRY(); 601bab04824SLv Zheng 602bab04824SLv Zheng acpi_ex_trace_point(type, begin, aml, pathname); 603bab04824SLv Zheng 604bab04824SLv Zheng #ifdef ACPI_USE_SYSTEM_TRACER 605bab04824SLv Zheng acpi_os_trace_point(type, begin, aml, pathname); 606bab04824SLv Zheng #endif 607bab04824SLv Zheng } 608bab04824SLv Zheng 609bab04824SLv Zheng ACPI_EXPORT_SYMBOL(acpi_trace_point) 6109cf7adecSBob Moore 611bab04824SLv Zheng #endif 612