195b482a8SLen Brown /****************************************************************************** 295b482a8SLen Brown * 388ec2860SBob Moore * Module Name: utdebug - Debug print/trace routines 495b482a8SLen Brown * 595b482a8SLen Brown *****************************************************************************/ 695b482a8SLen Brown 795b482a8SLen Brown /* 87735ca0eSBob Moore * Copyright (C) 2000 - 2017, Intel Corp. 995b482a8SLen Brown * All rights reserved. 1095b482a8SLen Brown * 1195b482a8SLen Brown * Redistribution and use in source and binary forms, with or without 1295b482a8SLen Brown * modification, are permitted provided that the following conditions 1395b482a8SLen Brown * are met: 1495b482a8SLen Brown * 1. Redistributions of source code must retain the above copyright 1595b482a8SLen Brown * notice, this list of conditions, and the following disclaimer, 1695b482a8SLen Brown * without modification. 1795b482a8SLen Brown * 2. Redistributions in binary form must reproduce at minimum a disclaimer 1895b482a8SLen Brown * substantially similar to the "NO WARRANTY" disclaimer below 1995b482a8SLen Brown * ("Disclaimer") and any redistribution must be conditioned upon 2095b482a8SLen Brown * including a substantially similar Disclaimer requirement for further 2195b482a8SLen Brown * binary redistribution. 2295b482a8SLen Brown * 3. Neither the names of the above-listed copyright holders nor the names 2395b482a8SLen Brown * of any contributors may be used to endorse or promote products derived 2495b482a8SLen Brown * from this software without specific prior written permission. 2595b482a8SLen Brown * 2695b482a8SLen Brown * Alternatively, this software may be distributed under the terms of the 2795b482a8SLen Brown * GNU General Public License ("GPL") version 2 as published by the Free 2895b482a8SLen Brown * Software Foundation. 2995b482a8SLen Brown * 3095b482a8SLen Brown * NO WARRANTY 3195b482a8SLen Brown * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 3295b482a8SLen Brown * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 3395b482a8SLen Brown * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR 3495b482a8SLen Brown * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 3595b482a8SLen Brown * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 3695b482a8SLen Brown * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 3795b482a8SLen Brown * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 3895b482a8SLen Brown * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 3995b482a8SLen Brown * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 4095b482a8SLen Brown * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 4195b482a8SLen Brown * POSSIBILITY OF SUCH DAMAGES. 4295b482a8SLen Brown */ 4395b482a8SLen Brown 44839e928fSLv Zheng #define EXPORT_ACPI_INTERFACES 45839e928fSLv Zheng 4695b482a8SLen Brown #include <acpi/acpi.h> 47e2f7a777SLen Brown #include "accommon.h" 48bab04824SLv Zheng #include "acinterp.h" 4995b482a8SLen Brown 5095b482a8SLen Brown #define _COMPONENT ACPI_UTILITIES 5195b482a8SLen Brown ACPI_MODULE_NAME("utdebug") 526d33b6beSLv Zheng 5395b482a8SLen Brown #ifdef ACPI_DEBUG_OUTPUT 540dfaaa3dSBob Moore static acpi_thread_id acpi_gbl_previous_thread_id = (acpi_thread_id) 0xFFFFFFFF; 550dfaaa3dSBob Moore static const char *acpi_gbl_function_entry_prefix = "----Entry"; 560dfaaa3dSBob Moore static const char *acpi_gbl_function_exit_prefix = "----Exit-"; 5795b482a8SLen Brown 5895b482a8SLen Brown /******************************************************************************* 5995b482a8SLen Brown * 6095b482a8SLen Brown * FUNCTION: acpi_ut_init_stack_ptr_trace 6195b482a8SLen Brown * 6295b482a8SLen Brown * PARAMETERS: None 6395b482a8SLen Brown * 6495b482a8SLen Brown * RETURN: None 6595b482a8SLen Brown * 6695b482a8SLen Brown * DESCRIPTION: Save the current CPU stack pointer at subsystem startup 6795b482a8SLen Brown * 6895b482a8SLen Brown ******************************************************************************/ 6995b482a8SLen Brown 7095b482a8SLen Brown void acpi_ut_init_stack_ptr_trace(void) 7195b482a8SLen Brown { 7295b482a8SLen Brown acpi_size current_sp; 7395b482a8SLen Brown 7495b482a8SLen Brown acpi_gbl_entry_stack_pointer = ¤t_sp; 7595b482a8SLen Brown } 7695b482a8SLen Brown 7795b482a8SLen Brown /******************************************************************************* 7895b482a8SLen Brown * 7995b482a8SLen Brown * FUNCTION: acpi_ut_track_stack_ptr 8095b482a8SLen Brown * 8195b482a8SLen Brown * PARAMETERS: None 8295b482a8SLen Brown * 8395b482a8SLen Brown * RETURN: None 8495b482a8SLen Brown * 8595b482a8SLen Brown * DESCRIPTION: Save the current CPU stack pointer 8695b482a8SLen Brown * 8795b482a8SLen Brown ******************************************************************************/ 8895b482a8SLen Brown 8995b482a8SLen Brown void acpi_ut_track_stack_ptr(void) 9095b482a8SLen Brown { 9195b482a8SLen Brown acpi_size current_sp; 9295b482a8SLen Brown 9395b482a8SLen Brown if (¤t_sp < acpi_gbl_lowest_stack_pointer) { 9495b482a8SLen Brown acpi_gbl_lowest_stack_pointer = ¤t_sp; 9595b482a8SLen Brown } 9695b482a8SLen Brown 9795b482a8SLen Brown if (acpi_gbl_nesting_level > acpi_gbl_deepest_nesting) { 9895b482a8SLen Brown acpi_gbl_deepest_nesting = acpi_gbl_nesting_level; 9995b482a8SLen Brown } 10095b482a8SLen Brown } 10195b482a8SLen Brown 10295b482a8SLen Brown /******************************************************************************* 10395b482a8SLen Brown * 10495b482a8SLen Brown * FUNCTION: acpi_ut_trim_function_name 10595b482a8SLen Brown * 10695b482a8SLen Brown * PARAMETERS: function_name - Ascii string containing a procedure name 10795b482a8SLen Brown * 10895b482a8SLen Brown * RETURN: Updated pointer to the function name 10995b482a8SLen Brown * 11095b482a8SLen Brown * DESCRIPTION: Remove the "Acpi" prefix from the function name, if present. 1117011bf4eSLv Zheng * This allows compiler macros such as __func__ to be used 1127011bf4eSLv Zheng * with no change to the debug output. 11395b482a8SLen Brown * 11495b482a8SLen Brown ******************************************************************************/ 11595b482a8SLen Brown 11695b482a8SLen Brown static const char *acpi_ut_trim_function_name(const char *function_name) 11795b482a8SLen Brown { 11895b482a8SLen Brown 11995b482a8SLen Brown /* All Function names are longer than 4 chars, check is safe */ 12095b482a8SLen Brown 12195b482a8SLen Brown if (*(ACPI_CAST_PTR(u32, function_name)) == ACPI_PREFIX_MIXED) { 12295b482a8SLen Brown 12395b482a8SLen Brown /* This is the case where the original source has not been modified */ 12495b482a8SLen Brown 12595b482a8SLen Brown return (function_name + 4); 12695b482a8SLen Brown } 12795b482a8SLen Brown 12895b482a8SLen Brown if (*(ACPI_CAST_PTR(u32, function_name)) == ACPI_PREFIX_LOWER) { 12995b482a8SLen Brown 13095b482a8SLen Brown /* This is the case where the source has been 'linuxized' */ 13195b482a8SLen Brown 13295b482a8SLen Brown return (function_name + 5); 13395b482a8SLen Brown } 13495b482a8SLen Brown 13595b482a8SLen Brown return (function_name); 13695b482a8SLen Brown } 13795b482a8SLen Brown 13895b482a8SLen Brown /******************************************************************************* 13995b482a8SLen Brown * 14095b482a8SLen Brown * FUNCTION: acpi_debug_print 14195b482a8SLen Brown * 14295b482a8SLen Brown * PARAMETERS: requested_debug_level - Requested debug print level 14395b482a8SLen Brown * line_number - Caller's line number (for error output) 14495b482a8SLen Brown * function_name - Caller's procedure name 14595b482a8SLen Brown * module_name - Caller's module name 14695b482a8SLen Brown * component_id - Caller's component ID 147ba494beeSBob Moore * format - Printf format field 14895b482a8SLen Brown * ... - Optional printf arguments 14995b482a8SLen Brown * 15095b482a8SLen Brown * RETURN: None 15195b482a8SLen Brown * 15295b482a8SLen Brown * DESCRIPTION: Print error message with prefix consisting of the module name, 15395b482a8SLen Brown * line number, and component ID. 15495b482a8SLen Brown * 15595b482a8SLen Brown ******************************************************************************/ 15695b482a8SLen Brown 15795b482a8SLen Brown void ACPI_INTERNAL_VAR_XFACE 15895b482a8SLen Brown acpi_debug_print(u32 requested_debug_level, 15995b482a8SLen Brown u32 line_number, 16095b482a8SLen Brown const char *function_name, 16195b482a8SLen Brown const char *module_name, 16295b482a8SLen Brown u32 component_id, const char *format, ...) 16395b482a8SLen Brown { 16495b482a8SLen Brown acpi_thread_id thread_id; 16595b482a8SLen Brown va_list args; 1666be2d72bSBob Moore int fill_count; 16795b482a8SLen Brown 168db38bf5aSBob Moore /* Check if debug output enabled */ 169db38bf5aSBob Moore 170db38bf5aSBob Moore if (!ACPI_IS_DEBUG_ENABLED(requested_debug_level, component_id)) { 17195b482a8SLen Brown return; 17295b482a8SLen Brown } 17395b482a8SLen Brown 17495b482a8SLen Brown /* 17595b482a8SLen Brown * Thread tracking and context switch notification 17695b482a8SLen Brown */ 17795b482a8SLen Brown thread_id = acpi_os_get_thread_id(); 1780dfaaa3dSBob Moore if (thread_id != acpi_gbl_previous_thread_id) { 17995b482a8SLen Brown if (ACPI_LV_THREADS & acpi_dbg_level) { 18095b482a8SLen Brown acpi_os_printf 18128eb3fcfSLin Ming ("\n**** Context Switch from TID %u to TID %u ****\n\n", 1820dfaaa3dSBob Moore (u32)acpi_gbl_previous_thread_id, (u32)thread_id); 18395b482a8SLen Brown } 18495b482a8SLen Brown 1850dfaaa3dSBob Moore acpi_gbl_previous_thread_id = thread_id; 186bf9b448eSBob Moore acpi_gbl_nesting_level = 0; 18795b482a8SLen Brown } 18895b482a8SLen Brown 18995b482a8SLen Brown /* 19095b482a8SLen Brown * Display the module name, current line number, thread ID (if requested), 19195b482a8SLen Brown * current procedure nesting level, and the current procedure name 19295b482a8SLen Brown */ 1932856846eSBob Moore acpi_os_printf("%9s-%04ld ", module_name, line_number); 19495b482a8SLen Brown 1955076f005SBob Moore #ifdef ACPI_APPLICATION 196bf9b448eSBob Moore /* 1975076f005SBob Moore * For acpi_exec/iASL only, emit the thread ID and nesting level. 198bf9b448eSBob Moore * Note: nesting level is really only useful during a single-thread 199bf9b448eSBob Moore * execution. Otherwise, multiple threads will keep resetting the 200bf9b448eSBob Moore * level. 201bf9b448eSBob Moore */ 20295b482a8SLen Brown if (ACPI_LV_THREADS & acpi_dbg_level) { 20328eb3fcfSLin Ming acpi_os_printf("[%u] ", (u32)thread_id); 20495b482a8SLen Brown } 20595b482a8SLen Brown 2066be2d72bSBob Moore fill_count = 48 - acpi_gbl_nesting_level - 2076be2d72bSBob Moore strlen(acpi_ut_trim_function_name(function_name)); 2086be2d72bSBob Moore if (fill_count < 0) { 2096be2d72bSBob Moore fill_count = 0; 2106be2d72bSBob Moore } 211bf9b448eSBob Moore 2126be2d72bSBob Moore acpi_os_printf("[%02ld] %*s", 213*6e875fa0SErik Schmauss acpi_gbl_nesting_level, acpi_gbl_nesting_level + 1, " "); 2146be2d72bSBob Moore acpi_os_printf("%s%*s: ", 2156be2d72bSBob Moore acpi_ut_trim_function_name(function_name), fill_count, 2166be2d72bSBob Moore " "); 2176be2d72bSBob Moore 2186be2d72bSBob Moore #else 219bf9b448eSBob Moore acpi_os_printf("%-22.22s: ", acpi_ut_trim_function_name(function_name)); 2206be2d72bSBob Moore #endif 22195b482a8SLen Brown 22295b482a8SLen Brown va_start(args, format); 22395b482a8SLen Brown acpi_os_vprintf(format, args); 22495b482a8SLen Brown va_end(args); 22595b482a8SLen Brown } 22695b482a8SLen Brown 22795b482a8SLen Brown ACPI_EXPORT_SYMBOL(acpi_debug_print) 22895b482a8SLen Brown 22995b482a8SLen Brown /******************************************************************************* 23095b482a8SLen Brown * 23195b482a8SLen Brown * FUNCTION: acpi_debug_print_raw 23295b482a8SLen Brown * 23395b482a8SLen Brown * PARAMETERS: requested_debug_level - Requested debug print level 23495b482a8SLen Brown * line_number - Caller's line number 23595b482a8SLen Brown * function_name - Caller's procedure name 23695b482a8SLen Brown * module_name - Caller's module name 23795b482a8SLen Brown * component_id - Caller's component ID 238ba494beeSBob Moore * format - Printf format field 23995b482a8SLen Brown * ... - Optional printf arguments 24095b482a8SLen Brown * 24195b482a8SLen Brown * RETURN: None 24295b482a8SLen Brown * 24395b482a8SLen Brown * DESCRIPTION: Print message with no headers. Has same interface as 24495b482a8SLen Brown * debug_print so that the same macros can be used. 24595b482a8SLen Brown * 24695b482a8SLen Brown ******************************************************************************/ 24795b482a8SLen Brown void ACPI_INTERNAL_VAR_XFACE 24895b482a8SLen Brown acpi_debug_print_raw(u32 requested_debug_level, 24995b482a8SLen Brown u32 line_number, 25095b482a8SLen Brown const char *function_name, 25195b482a8SLen Brown const char *module_name, 25295b482a8SLen Brown u32 component_id, const char *format, ...) 25395b482a8SLen Brown { 25495b482a8SLen Brown va_list args; 25595b482a8SLen Brown 256db38bf5aSBob Moore /* Check if debug output enabled */ 257db38bf5aSBob Moore 258db38bf5aSBob Moore if (!ACPI_IS_DEBUG_ENABLED(requested_debug_level, component_id)) { 25995b482a8SLen Brown return; 26095b482a8SLen Brown } 26195b482a8SLen Brown 26295b482a8SLen Brown va_start(args, format); 26395b482a8SLen Brown acpi_os_vprintf(format, args); 26495b482a8SLen Brown va_end(args); 26595b482a8SLen Brown } 26695b482a8SLen Brown 26795b482a8SLen Brown ACPI_EXPORT_SYMBOL(acpi_debug_print_raw) 26895b482a8SLen Brown 26995b482a8SLen Brown /******************************************************************************* 27095b482a8SLen Brown * 27195b482a8SLen Brown * FUNCTION: acpi_ut_trace 27295b482a8SLen Brown * 27395b482a8SLen Brown * PARAMETERS: line_number - Caller's line number 27495b482a8SLen Brown * function_name - Caller's procedure name 27595b482a8SLen Brown * module_name - Caller's module name 27695b482a8SLen Brown * component_id - Caller's component ID 27795b482a8SLen Brown * 27895b482a8SLen Brown * RETURN: None 27995b482a8SLen Brown * 28095b482a8SLen Brown * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is 28195b482a8SLen Brown * set in debug_level 28295b482a8SLen Brown * 28395b482a8SLen Brown ******************************************************************************/ 28495b482a8SLen Brown void 28595b482a8SLen Brown acpi_ut_trace(u32 line_number, 28695b482a8SLen Brown const char *function_name, 28795b482a8SLen Brown const char *module_name, u32 component_id) 28895b482a8SLen Brown { 28995b482a8SLen Brown 29095b482a8SLen Brown acpi_gbl_nesting_level++; 29195b482a8SLen Brown acpi_ut_track_stack_ptr(); 29295b482a8SLen Brown 293db38bf5aSBob Moore /* Check if enabled up-front for performance */ 294db38bf5aSBob Moore 295db38bf5aSBob Moore if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) { 29695b482a8SLen Brown acpi_debug_print(ACPI_LV_FUNCTIONS, 297db38bf5aSBob Moore line_number, function_name, module_name, 2980dfaaa3dSBob Moore component_id, "%s\n", 2990dfaaa3dSBob Moore acpi_gbl_function_entry_prefix); 300db38bf5aSBob Moore } 30195b482a8SLen Brown } 30295b482a8SLen Brown 30395b482a8SLen Brown ACPI_EXPORT_SYMBOL(acpi_ut_trace) 30495b482a8SLen Brown 30595b482a8SLen Brown /******************************************************************************* 30695b482a8SLen Brown * 30795b482a8SLen Brown * FUNCTION: acpi_ut_trace_ptr 30895b482a8SLen Brown * 30995b482a8SLen Brown * PARAMETERS: line_number - Caller's line number 31095b482a8SLen Brown * function_name - Caller's procedure name 31195b482a8SLen Brown * module_name - Caller's module name 31295b482a8SLen Brown * component_id - Caller's component ID 313ba494beeSBob Moore * pointer - Pointer to display 31495b482a8SLen Brown * 31595b482a8SLen Brown * RETURN: None 31695b482a8SLen Brown * 31795b482a8SLen Brown * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is 31895b482a8SLen Brown * set in debug_level 31995b482a8SLen Brown * 32095b482a8SLen Brown ******************************************************************************/ 32195b482a8SLen Brown void 32295b482a8SLen Brown acpi_ut_trace_ptr(u32 line_number, 32395b482a8SLen Brown const char *function_name, 3240dfaaa3dSBob Moore const char *module_name, 3250dfaaa3dSBob Moore u32 component_id, const void *pointer) 32695b482a8SLen Brown { 32768aafc35SBob Moore 32895b482a8SLen Brown acpi_gbl_nesting_level++; 32995b482a8SLen Brown acpi_ut_track_stack_ptr(); 33095b482a8SLen Brown 331db38bf5aSBob Moore /* Check if enabled up-front for performance */ 332db38bf5aSBob Moore 333db38bf5aSBob Moore if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) { 33495b482a8SLen Brown acpi_debug_print(ACPI_LV_FUNCTIONS, 335db38bf5aSBob Moore line_number, function_name, module_name, 3360dfaaa3dSBob Moore component_id, "%s %p\n", 3370dfaaa3dSBob Moore acpi_gbl_function_entry_prefix, pointer); 338db38bf5aSBob Moore } 33995b482a8SLen Brown } 34095b482a8SLen Brown 34195b482a8SLen Brown /******************************************************************************* 34295b482a8SLen Brown * 34395b482a8SLen Brown * FUNCTION: acpi_ut_trace_str 34495b482a8SLen Brown * 34595b482a8SLen Brown * PARAMETERS: line_number - Caller's line number 34695b482a8SLen Brown * function_name - Caller's procedure name 34795b482a8SLen Brown * module_name - Caller's module name 34895b482a8SLen Brown * component_id - Caller's component ID 349ba494beeSBob Moore * string - Additional string to display 35095b482a8SLen Brown * 35195b482a8SLen Brown * RETURN: None 35295b482a8SLen Brown * 35395b482a8SLen Brown * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is 35495b482a8SLen Brown * set in debug_level 35595b482a8SLen Brown * 35695b482a8SLen Brown ******************************************************************************/ 35795b482a8SLen Brown 35895b482a8SLen Brown void 35995b482a8SLen Brown acpi_ut_trace_str(u32 line_number, 36095b482a8SLen Brown const char *function_name, 3610dfaaa3dSBob Moore const char *module_name, u32 component_id, const char *string) 36295b482a8SLen Brown { 36395b482a8SLen Brown 36495b482a8SLen Brown acpi_gbl_nesting_level++; 36595b482a8SLen Brown acpi_ut_track_stack_ptr(); 36695b482a8SLen Brown 367db38bf5aSBob Moore /* Check if enabled up-front for performance */ 368db38bf5aSBob Moore 369db38bf5aSBob Moore if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) { 37095b482a8SLen Brown acpi_debug_print(ACPI_LV_FUNCTIONS, 371db38bf5aSBob Moore line_number, function_name, module_name, 3720dfaaa3dSBob Moore component_id, "%s %s\n", 3730dfaaa3dSBob Moore acpi_gbl_function_entry_prefix, string); 374db38bf5aSBob Moore } 37595b482a8SLen Brown } 37695b482a8SLen Brown 37795b482a8SLen Brown /******************************************************************************* 37895b482a8SLen Brown * 37995b482a8SLen Brown * FUNCTION: acpi_ut_trace_u32 38095b482a8SLen Brown * 38195b482a8SLen Brown * PARAMETERS: line_number - Caller's line number 38295b482a8SLen Brown * function_name - Caller's procedure name 38395b482a8SLen Brown * module_name - Caller's module name 38495b482a8SLen Brown * component_id - Caller's component ID 385ba494beeSBob Moore * integer - Integer to display 38695b482a8SLen Brown * 38795b482a8SLen Brown * RETURN: None 38895b482a8SLen Brown * 38995b482a8SLen Brown * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is 39095b482a8SLen Brown * set in debug_level 39195b482a8SLen Brown * 39295b482a8SLen Brown ******************************************************************************/ 39395b482a8SLen Brown 39495b482a8SLen Brown void 39595b482a8SLen Brown acpi_ut_trace_u32(u32 line_number, 39695b482a8SLen Brown const char *function_name, 39795b482a8SLen Brown const char *module_name, u32 component_id, u32 integer) 39895b482a8SLen Brown { 39995b482a8SLen Brown 40095b482a8SLen Brown acpi_gbl_nesting_level++; 40195b482a8SLen Brown acpi_ut_track_stack_ptr(); 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, 408db38bf5aSBob Moore component_id, "%s %08X\n", 4090dfaaa3dSBob Moore acpi_gbl_function_entry_prefix, integer); 410db38bf5aSBob Moore } 41195b482a8SLen Brown } 41295b482a8SLen Brown 41395b482a8SLen Brown /******************************************************************************* 41495b482a8SLen Brown * 41595b482a8SLen Brown * FUNCTION: acpi_ut_exit 41695b482a8SLen Brown * 41795b482a8SLen Brown * PARAMETERS: line_number - Caller's line number 41895b482a8SLen Brown * function_name - Caller's procedure name 41995b482a8SLen Brown * module_name - Caller's module name 42095b482a8SLen Brown * component_id - Caller's component ID 42195b482a8SLen Brown * 42295b482a8SLen Brown * RETURN: None 42395b482a8SLen Brown * 42495b482a8SLen Brown * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is 42595b482a8SLen Brown * set in debug_level 42695b482a8SLen Brown * 42795b482a8SLen Brown ******************************************************************************/ 42895b482a8SLen Brown 42995b482a8SLen Brown void 43095b482a8SLen Brown acpi_ut_exit(u32 line_number, 43195b482a8SLen Brown const char *function_name, 43295b482a8SLen Brown const char *module_name, u32 component_id) 43395b482a8SLen Brown { 43495b482a8SLen Brown 435db38bf5aSBob Moore /* Check if enabled up-front for performance */ 436db38bf5aSBob Moore 437db38bf5aSBob Moore if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) { 43895b482a8SLen Brown acpi_debug_print(ACPI_LV_FUNCTIONS, 439db38bf5aSBob Moore line_number, function_name, module_name, 4400dfaaa3dSBob Moore component_id, "%s\n", 4410dfaaa3dSBob Moore acpi_gbl_function_exit_prefix); 442db38bf5aSBob Moore } 44395b482a8SLen Brown 444bf9b448eSBob Moore if (acpi_gbl_nesting_level) { 44595b482a8SLen Brown acpi_gbl_nesting_level--; 44695b482a8SLen Brown } 447bf9b448eSBob Moore } 44895b482a8SLen Brown 44995b482a8SLen Brown ACPI_EXPORT_SYMBOL(acpi_ut_exit) 45095b482a8SLen Brown 45195b482a8SLen Brown /******************************************************************************* 45295b482a8SLen Brown * 45395b482a8SLen Brown * FUNCTION: acpi_ut_status_exit 45495b482a8SLen Brown * 45595b482a8SLen Brown * PARAMETERS: line_number - Caller's line number 45695b482a8SLen Brown * function_name - Caller's procedure name 45795b482a8SLen Brown * module_name - Caller's module name 45895b482a8SLen Brown * component_id - Caller's component ID 459ba494beeSBob Moore * status - Exit status code 46095b482a8SLen Brown * 46195b482a8SLen Brown * RETURN: None 46295b482a8SLen Brown * 46395b482a8SLen Brown * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is 46495b482a8SLen Brown * set in debug_level. Prints exit status also. 46595b482a8SLen Brown * 46695b482a8SLen Brown ******************************************************************************/ 46795b482a8SLen Brown void 46895b482a8SLen Brown acpi_ut_status_exit(u32 line_number, 46995b482a8SLen Brown const char *function_name, 47095b482a8SLen Brown const char *module_name, 47195b482a8SLen Brown u32 component_id, acpi_status status) 47295b482a8SLen Brown { 47395b482a8SLen Brown 474db38bf5aSBob Moore /* Check if enabled up-front for performance */ 475db38bf5aSBob Moore 476db38bf5aSBob Moore if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) { 47795b482a8SLen Brown if (ACPI_SUCCESS(status)) { 47895b482a8SLen Brown acpi_debug_print(ACPI_LV_FUNCTIONS, 479db38bf5aSBob Moore line_number, function_name, 480db38bf5aSBob Moore module_name, component_id, "%s %s\n", 4810dfaaa3dSBob Moore acpi_gbl_function_exit_prefix, 48295b482a8SLen Brown acpi_format_exception(status)); 48395b482a8SLen Brown } else { 48495b482a8SLen Brown acpi_debug_print(ACPI_LV_FUNCTIONS, 485db38bf5aSBob Moore line_number, function_name, 486db38bf5aSBob Moore module_name, component_id, 487db38bf5aSBob Moore "%s ****Exception****: %s\n", 4880dfaaa3dSBob Moore acpi_gbl_function_exit_prefix, 48995b482a8SLen Brown acpi_format_exception(status)); 49095b482a8SLen Brown } 491db38bf5aSBob Moore } 49295b482a8SLen Brown 493bf9b448eSBob Moore if (acpi_gbl_nesting_level) { 49495b482a8SLen Brown acpi_gbl_nesting_level--; 49595b482a8SLen Brown } 496bf9b448eSBob Moore } 49795b482a8SLen Brown 49895b482a8SLen Brown ACPI_EXPORT_SYMBOL(acpi_ut_status_exit) 49995b482a8SLen Brown 50095b482a8SLen Brown /******************************************************************************* 50195b482a8SLen Brown * 50295b482a8SLen Brown * FUNCTION: acpi_ut_value_exit 50395b482a8SLen Brown * 50495b482a8SLen Brown * PARAMETERS: line_number - Caller's line number 50595b482a8SLen Brown * function_name - Caller's procedure name 50695b482a8SLen Brown * module_name - Caller's module name 50795b482a8SLen Brown * component_id - Caller's component ID 508ba494beeSBob Moore * value - Value to be printed with exit msg 50995b482a8SLen Brown * 51095b482a8SLen Brown * RETURN: None 51195b482a8SLen Brown * 51295b482a8SLen Brown * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is 51395b482a8SLen Brown * set in debug_level. Prints exit value also. 51495b482a8SLen Brown * 51595b482a8SLen Brown ******************************************************************************/ 51695b482a8SLen Brown void 51795b482a8SLen Brown acpi_ut_value_exit(u32 line_number, 51895b482a8SLen Brown const char *function_name, 5195df7e6cbSBob Moore const char *module_name, u32 component_id, u64 value) 52095b482a8SLen Brown { 52195b482a8SLen Brown 522db38bf5aSBob Moore /* Check if enabled up-front for performance */ 523db38bf5aSBob Moore 524db38bf5aSBob Moore if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) { 52595b482a8SLen Brown acpi_debug_print(ACPI_LV_FUNCTIONS, 526db38bf5aSBob Moore line_number, function_name, module_name, 527db38bf5aSBob Moore component_id, "%s %8.8X%8.8X\n", 5280dfaaa3dSBob Moore acpi_gbl_function_exit_prefix, 52995b482a8SLen Brown ACPI_FORMAT_UINT64(value)); 530db38bf5aSBob Moore } 53195b482a8SLen Brown 532bf9b448eSBob Moore if (acpi_gbl_nesting_level) { 53395b482a8SLen Brown acpi_gbl_nesting_level--; 53495b482a8SLen Brown } 535bf9b448eSBob Moore } 53695b482a8SLen Brown 53795b482a8SLen Brown ACPI_EXPORT_SYMBOL(acpi_ut_value_exit) 53895b482a8SLen Brown 53995b482a8SLen Brown /******************************************************************************* 54095b482a8SLen Brown * 54195b482a8SLen Brown * FUNCTION: acpi_ut_ptr_exit 54295b482a8SLen Brown * 54395b482a8SLen Brown * PARAMETERS: line_number - Caller's line number 54495b482a8SLen Brown * function_name - Caller's procedure name 54595b482a8SLen Brown * module_name - Caller's module name 54695b482a8SLen Brown * component_id - Caller's component ID 547ba494beeSBob Moore * ptr - Pointer to display 54895b482a8SLen Brown * 54995b482a8SLen Brown * RETURN: None 55095b482a8SLen Brown * 55195b482a8SLen Brown * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is 55295b482a8SLen Brown * set in debug_level. Prints exit value also. 55395b482a8SLen Brown * 55495b482a8SLen Brown ******************************************************************************/ 55595b482a8SLen Brown void 55695b482a8SLen Brown acpi_ut_ptr_exit(u32 line_number, 55795b482a8SLen Brown const char *function_name, 55895b482a8SLen Brown const char *module_name, u32 component_id, u8 *ptr) 55995b482a8SLen Brown { 56095b482a8SLen Brown 561db38bf5aSBob Moore /* Check if enabled up-front for performance */ 562db38bf5aSBob Moore 563db38bf5aSBob Moore if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) { 56495b482a8SLen Brown acpi_debug_print(ACPI_LV_FUNCTIONS, 565db38bf5aSBob Moore line_number, function_name, module_name, 5660dfaaa3dSBob Moore component_id, "%s %p\n", 5670dfaaa3dSBob Moore acpi_gbl_function_exit_prefix, ptr); 568db38bf5aSBob Moore } 56995b482a8SLen Brown 570bf9b448eSBob Moore if (acpi_gbl_nesting_level) { 57195b482a8SLen Brown acpi_gbl_nesting_level--; 57295b482a8SLen Brown } 573bf9b448eSBob Moore } 57495b482a8SLen Brown 575bab04824SLv Zheng /******************************************************************************* 576bab04824SLv Zheng * 5774857a94dSJung-uk Kim * FUNCTION: acpi_ut_str_exit 5784857a94dSJung-uk Kim * 5794857a94dSJung-uk Kim * PARAMETERS: line_number - Caller's line number 5804857a94dSJung-uk Kim * function_name - Caller's procedure name 5814857a94dSJung-uk Kim * module_name - Caller's module name 5824857a94dSJung-uk Kim * component_id - Caller's component ID 5834857a94dSJung-uk Kim * string - String to display 5844857a94dSJung-uk Kim * 5854857a94dSJung-uk Kim * RETURN: None 5864857a94dSJung-uk Kim * 5874857a94dSJung-uk Kim * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is 5884857a94dSJung-uk Kim * set in debug_level. Prints exit value also. 5894857a94dSJung-uk Kim * 5904857a94dSJung-uk Kim ******************************************************************************/ 5914857a94dSJung-uk Kim 5924857a94dSJung-uk Kim void 5934857a94dSJung-uk Kim acpi_ut_str_exit(u32 line_number, 5944857a94dSJung-uk Kim const char *function_name, 5954857a94dSJung-uk Kim const char *module_name, u32 component_id, const char *string) 5964857a94dSJung-uk Kim { 5974857a94dSJung-uk Kim 5984857a94dSJung-uk Kim /* Check if enabled up-front for performance */ 5994857a94dSJung-uk Kim 6004857a94dSJung-uk Kim if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) { 6014857a94dSJung-uk Kim acpi_debug_print(ACPI_LV_FUNCTIONS, 6024857a94dSJung-uk Kim line_number, function_name, module_name, 6034857a94dSJung-uk Kim component_id, "%s %s\n", 6044857a94dSJung-uk Kim acpi_gbl_function_exit_prefix, string); 6054857a94dSJung-uk Kim } 6064857a94dSJung-uk Kim 6074857a94dSJung-uk Kim if (acpi_gbl_nesting_level) { 6084857a94dSJung-uk Kim acpi_gbl_nesting_level--; 6094857a94dSJung-uk Kim } 6104857a94dSJung-uk Kim } 6114857a94dSJung-uk Kim 6124857a94dSJung-uk Kim /******************************************************************************* 6134857a94dSJung-uk Kim * 614bab04824SLv Zheng * FUNCTION: acpi_trace_point 615bab04824SLv Zheng * 616bab04824SLv Zheng * PARAMETERS: type - Trace event type 617bab04824SLv Zheng * begin - TRUE if before execution 618bab04824SLv Zheng * aml - Executed AML address 619bab04824SLv Zheng * pathname - Object path 620bab04824SLv Zheng * pointer - Pointer to the related object 621bab04824SLv Zheng * 622bab04824SLv Zheng * RETURN: None 623bab04824SLv Zheng * 624bab04824SLv Zheng * DESCRIPTION: Interpreter execution trace. 625bab04824SLv Zheng * 626bab04824SLv Zheng ******************************************************************************/ 6272e70da4cSLv Zheng 628bab04824SLv Zheng void 629bab04824SLv Zheng acpi_trace_point(acpi_trace_event_type type, u8 begin, u8 *aml, char *pathname) 630bab04824SLv Zheng { 631bab04824SLv Zheng 632bab04824SLv Zheng ACPI_FUNCTION_ENTRY(); 633bab04824SLv Zheng 634bab04824SLv Zheng acpi_ex_trace_point(type, begin, aml, pathname); 635bab04824SLv Zheng 636bab04824SLv Zheng #ifdef ACPI_USE_SYSTEM_TRACER 637bab04824SLv Zheng acpi_os_trace_point(type, begin, aml, pathname); 638bab04824SLv Zheng #endif 639bab04824SLv Zheng } 640bab04824SLv Zheng 641bab04824SLv Zheng ACPI_EXPORT_SYMBOL(acpi_trace_point) 6429cf7adecSBob Moore 643bab04824SLv Zheng #endif 644