167754Smsmith/****************************************************************************** 267754Smsmith * 3250838Sjkim * Module Name: utdebug - Debug print/trace routines 467754Smsmith * 567754Smsmith *****************************************************************************/ 667754Smsmith 7217365Sjkim/* 8306536Sjkim * Copyright (C) 2000 - 2016, Intel Corp. 970243Smsmith * All rights reserved. 1067754Smsmith * 11217365Sjkim * Redistribution and use in source and binary forms, with or without 12217365Sjkim * modification, are permitted provided that the following conditions 13217365Sjkim * are met: 14217365Sjkim * 1. Redistributions of source code must retain the above copyright 15217365Sjkim * notice, this list of conditions, and the following disclaimer, 16217365Sjkim * without modification. 17217365Sjkim * 2. Redistributions in binary form must reproduce at minimum a disclaimer 18217365Sjkim * substantially similar to the "NO WARRANTY" disclaimer below 19217365Sjkim * ("Disclaimer") and any redistribution must be conditioned upon 20217365Sjkim * including a substantially similar Disclaimer requirement for further 21217365Sjkim * binary redistribution. 22217365Sjkim * 3. Neither the names of the above-listed copyright holders nor the names 23217365Sjkim * of any contributors may be used to endorse or promote products derived 24217365Sjkim * from this software without specific prior written permission. 2567754Smsmith * 26217365Sjkim * Alternatively, this software may be distributed under the terms of the 27217365Sjkim * GNU General Public License ("GPL") version 2 as published by the Free 28217365Sjkim * Software Foundation. 2967754Smsmith * 30217365Sjkim * NO WARRANTY 31217365Sjkim * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 32217365Sjkim * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 33217365Sjkim * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR 34217365Sjkim * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 35217365Sjkim * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 36217365Sjkim * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 37217365Sjkim * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 38217365Sjkim * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 39217365Sjkim * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 40217365Sjkim * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 41217365Sjkim * POSSIBILITY OF SUCH DAMAGES. 42217365Sjkim */ 4367754Smsmith 44281075Sdim#define EXPORT_ACPI_INTERFACES 4567754Smsmith 46193341Sjkim#include <contrib/dev/acpica/include/acpi.h> 47193341Sjkim#include <contrib/dev/acpica/include/accommon.h> 48306536Sjkim#include <contrib/dev/acpica/include/acinterp.h> 4967754Smsmith 5077424Smsmith#define _COMPONENT ACPI_UTILITIES 5191116Smsmith ACPI_MODULE_NAME ("utdebug") 5267754Smsmith 5367754Smsmith 54102550Siwasaki#ifdef ACPI_DEBUG_OUTPUT 5577424Smsmith 56306536Sjkimstatic ACPI_THREAD_ID AcpiGbl_PreviousThreadId = (ACPI_THREAD_ID) 0xFFFFFFFF; 57306536Sjkimstatic const char *AcpiGbl_FunctionEntryPrefix = "----Entry"; 58306536Sjkimstatic const char *AcpiGbl_FunctionExitPrefix = "----Exit-"; 5983174Smsmith 6083174Smsmith 61151937Sjkim/******************************************************************************* 6267754Smsmith * 6383174Smsmith * FUNCTION: AcpiUtInitStackPtrTrace 6467754Smsmith * 6583174Smsmith * PARAMETERS: None 6667754Smsmith * 6783174Smsmith * RETURN: None 6867754Smsmith * 69151937Sjkim * DESCRIPTION: Save the current CPU stack pointer at subsystem startup 7083174Smsmith * 71151937Sjkim ******************************************************************************/ 7267754Smsmith 7383174Smsmithvoid 7483174SmsmithAcpiUtInitStackPtrTrace ( 7583174Smsmith void) 7667754Smsmith{ 77193267Sjkim ACPI_SIZE CurrentSp; 7867754Smsmith 7983174Smsmith 80193267Sjkim AcpiGbl_EntryStackPointer = &CurrentSp; 8167754Smsmith} 8267754Smsmith 8383174Smsmith 84151937Sjkim/******************************************************************************* 8583174Smsmith * 8683174Smsmith * FUNCTION: AcpiUtTrackStackPtr 8783174Smsmith * 8883174Smsmith * PARAMETERS: None 8983174Smsmith * 9083174Smsmith * RETURN: None 9183174Smsmith * 92151937Sjkim * DESCRIPTION: Save the current CPU stack pointer 9383174Smsmith * 94151937Sjkim ******************************************************************************/ 9583174Smsmith 9667754Smsmithvoid 9783174SmsmithAcpiUtTrackStackPtr ( 9883174Smsmith void) 9967754Smsmith{ 100151937Sjkim ACPI_SIZE CurrentSp; 10167754Smsmith 10283174Smsmith 103193267Sjkim if (&CurrentSp < AcpiGbl_LowestStackPointer) 10483174Smsmith { 105193267Sjkim AcpiGbl_LowestStackPointer = &CurrentSp; 10683174Smsmith } 10783174Smsmith 10883174Smsmith if (AcpiGbl_NestingLevel > AcpiGbl_DeepestNesting) 10983174Smsmith { 11083174Smsmith AcpiGbl_DeepestNesting = AcpiGbl_NestingLevel; 11183174Smsmith } 11267754Smsmith} 11367754Smsmith 11467754Smsmith 115151937Sjkim/******************************************************************************* 11667754Smsmith * 117151937Sjkim * FUNCTION: AcpiUtTrimFunctionName 118151937Sjkim * 119151937Sjkim * PARAMETERS: FunctionName - Ascii string containing a procedure name 120151937Sjkim * 121151937Sjkim * RETURN: Updated pointer to the function name 122151937Sjkim * 123151937Sjkim * DESCRIPTION: Remove the "Acpi" prefix from the function name, if present. 124151937Sjkim * This allows compiler macros such as __FUNCTION__ to be used 125151937Sjkim * with no change to the debug output. 126151937Sjkim * 127151937Sjkim ******************************************************************************/ 128151937Sjkim 129151937Sjkimstatic const char * 130151937SjkimAcpiUtTrimFunctionName ( 131151937Sjkim const char *FunctionName) 132151937Sjkim{ 133151937Sjkim 134151937Sjkim /* All Function names are longer than 4 chars, check is safe */ 135151937Sjkim 136151937Sjkim if (*(ACPI_CAST_PTR (UINT32, FunctionName)) == ACPI_PREFIX_MIXED) 137151937Sjkim { 138151937Sjkim /* This is the case where the original source has not been modified */ 139151937Sjkim 140151937Sjkim return (FunctionName + 4); 141151937Sjkim } 142151937Sjkim 143151937Sjkim if (*(ACPI_CAST_PTR (UINT32, FunctionName)) == ACPI_PREFIX_LOWER) 144151937Sjkim { 145151937Sjkim /* This is the case where the source has been 'linuxized' */ 146151937Sjkim 147151937Sjkim return (FunctionName + 5); 148151937Sjkim } 149151937Sjkim 150151937Sjkim return (FunctionName); 151151937Sjkim} 152151937Sjkim 153151937Sjkim 154151937Sjkim/******************************************************************************* 155151937Sjkim * 156193267Sjkim * FUNCTION: AcpiDebugPrint 15782367Smsmith * 158151937Sjkim * PARAMETERS: RequestedDebugLevel - Requested debug print level 15982367Smsmith * LineNumber - Caller's line number (for error output) 160151937Sjkim * FunctionName - Caller's procedure name 161151937Sjkim * ModuleName - Caller's module name 162151937Sjkim * ComponentId - Caller's component ID 16382367Smsmith * Format - Printf format field 16482367Smsmith * ... - Optional printf arguments 16582367Smsmith * 16682367Smsmith * RETURN: None 16782367Smsmith * 16882367Smsmith * DESCRIPTION: Print error message with prefix consisting of the module name, 16982367Smsmith * line number, and component ID. 17082367Smsmith * 171151937Sjkim ******************************************************************************/ 17282367Smsmith 17392388Smsmithvoid ACPI_INTERNAL_VAR_XFACE 174193267SjkimAcpiDebugPrint ( 17582367Smsmith UINT32 RequestedDebugLevel, 17682367Smsmith UINT32 LineNumber, 177151937Sjkim const char *FunctionName, 178193267Sjkim const char *ModuleName, 179151937Sjkim UINT32 ComponentId, 180193267Sjkim const char *Format, 18182367Smsmith ...) 18282367Smsmith{ 183167802Sjkim ACPI_THREAD_ID ThreadId; 18482367Smsmith va_list args; 18582367Smsmith 18682367Smsmith 187245582Sjkim /* Check if debug output enabled */ 188245582Sjkim 189245582Sjkim if (!ACPI_IS_DEBUG_ENABLED (RequestedDebugLevel, ComponentId)) 19082367Smsmith { 19182367Smsmith return; 19282367Smsmith } 19382367Smsmith 19483174Smsmith /* 19583174Smsmith * Thread tracking and context switch notification 19683174Smsmith */ 19782367Smsmith ThreadId = AcpiOsGetThreadId (); 198306536Sjkim if (ThreadId != AcpiGbl_PreviousThreadId) 19982367Smsmith { 20082367Smsmith if (ACPI_LV_THREADS & AcpiDbgLevel) 20182367Smsmith { 202151937Sjkim AcpiOsPrintf ( 203212761Sjkim "\n**** Context Switch from TID %u to TID %u ****\n\n", 204306536Sjkim (UINT32) AcpiGbl_PreviousThreadId, (UINT32) ThreadId); 20582367Smsmith } 20682367Smsmith 207306536Sjkim AcpiGbl_PreviousThreadId = ThreadId; 208281075Sdim AcpiGbl_NestingLevel = 0; 20982367Smsmith } 21082367Smsmith 21183174Smsmith /* 21283174Smsmith * Display the module name, current line number, thread ID (if requested), 21383174Smsmith * current procedure nesting level, and the current procedure name 21483174Smsmith */ 215254745Sjkim AcpiOsPrintf ("%9s-%04ld ", ModuleName, LineNumber); 21683174Smsmith 217281075Sdim#ifdef ACPI_APPLICATION 218281075Sdim /* 219281075Sdim * For AcpiExec/iASL only, emit the thread ID and nesting level. 220281075Sdim * Note: nesting level is really only useful during a single-thread 221281075Sdim * execution. Otherwise, multiple threads will keep resetting the 222281075Sdim * level. 223281075Sdim */ 22482367Smsmith if (ACPI_LV_THREADS & AcpiDbgLevel) 22582367Smsmith { 226212761Sjkim AcpiOsPrintf ("[%u] ", (UINT32) ThreadId); 22782367Smsmith } 22882367Smsmith 229281075Sdim AcpiOsPrintf ("[%02ld] ", AcpiGbl_NestingLevel); 230281075Sdim#endif 23182367Smsmith 232281075Sdim AcpiOsPrintf ("%-22.22s: ", AcpiUtTrimFunctionName (FunctionName)); 233281075Sdim 23482367Smsmith va_start (args, Format); 23582367Smsmith AcpiOsVprintf (Format, args); 236193267Sjkim va_end (args); 23782367Smsmith} 23882367Smsmith 239193267SjkimACPI_EXPORT_SYMBOL (AcpiDebugPrint) 24082367Smsmith 241167802Sjkim 242151937Sjkim/******************************************************************************* 24382367Smsmith * 244193267Sjkim * FUNCTION: AcpiDebugPrintRaw 24582367Smsmith * 24683174Smsmith * PARAMETERS: RequestedDebugLevel - Requested debug print level 24783174Smsmith * LineNumber - Caller's line number 248151937Sjkim * FunctionName - Caller's procedure name 249151937Sjkim * ModuleName - Caller's module name 250151937Sjkim * ComponentId - Caller's component ID 25182367Smsmith * Format - Printf format field 25282367Smsmith * ... - Optional printf arguments 25382367Smsmith * 25482367Smsmith * RETURN: None 25582367Smsmith * 256241973Sjkim * DESCRIPTION: Print message with no headers. Has same interface as 25782367Smsmith * DebugPrint so that the same macros can be used. 25882367Smsmith * 259151937Sjkim ******************************************************************************/ 26082367Smsmith 26192388Smsmithvoid ACPI_INTERNAL_VAR_XFACE 262193267SjkimAcpiDebugPrintRaw ( 26382367Smsmith UINT32 RequestedDebugLevel, 26482367Smsmith UINT32 LineNumber, 265151937Sjkim const char *FunctionName, 266193267Sjkim const char *ModuleName, 267151937Sjkim UINT32 ComponentId, 268193267Sjkim const char *Format, 26982367Smsmith ...) 27082367Smsmith{ 27182367Smsmith va_list args; 27282367Smsmith 27382367Smsmith 274245582Sjkim /* Check if debug output enabled */ 275245582Sjkim 276245582Sjkim if (!ACPI_IS_DEBUG_ENABLED (RequestedDebugLevel, ComponentId)) 27782367Smsmith { 27882367Smsmith return; 27982367Smsmith } 28082367Smsmith 28182367Smsmith va_start (args, Format); 28282367Smsmith AcpiOsVprintf (Format, args); 283193267Sjkim va_end (args); 28482367Smsmith} 28582367Smsmith 286193267SjkimACPI_EXPORT_SYMBOL (AcpiDebugPrintRaw) 28782367Smsmith 288167802Sjkim 289151937Sjkim/******************************************************************************* 29082367Smsmith * 29183174Smsmith * FUNCTION: AcpiUtTrace 29267754Smsmith * 29383174Smsmith * PARAMETERS: LineNumber - Caller's line number 294151937Sjkim * FunctionName - Caller's procedure name 295151937Sjkim * ModuleName - Caller's module name 296151937Sjkim * ComponentId - Caller's component ID 29767754Smsmith * 29867754Smsmith * RETURN: None 29967754Smsmith * 300241973Sjkim * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is 30167754Smsmith * set in DebugLevel 30267754Smsmith * 303151937Sjkim ******************************************************************************/ 30467754Smsmith 30567754Smsmithvoid 30683174SmsmithAcpiUtTrace ( 30767754Smsmith UINT32 LineNumber, 308151937Sjkim const char *FunctionName, 309193267Sjkim const char *ModuleName, 310151937Sjkim UINT32 ComponentId) 31167754Smsmith{ 31267754Smsmith 31367754Smsmith AcpiGbl_NestingLevel++; 31483174Smsmith AcpiUtTrackStackPtr (); 31567754Smsmith 316245582Sjkim /* Check if enabled up-front for performance */ 317245582Sjkim 318245582Sjkim if (ACPI_IS_DEBUG_ENABLED (ACPI_LV_FUNCTIONS, ComponentId)) 319245582Sjkim { 320245582Sjkim AcpiDebugPrint (ACPI_LV_FUNCTIONS, 321245582Sjkim LineNumber, FunctionName, ModuleName, ComponentId, 322306536Sjkim "%s\n", AcpiGbl_FunctionEntryPrefix); 323245582Sjkim } 32467754Smsmith} 32567754Smsmith 326167802SjkimACPI_EXPORT_SYMBOL (AcpiUtTrace) 32767754Smsmith 328167802Sjkim 329151937Sjkim/******************************************************************************* 33067754Smsmith * 33183174Smsmith * FUNCTION: AcpiUtTracePtr 33267754Smsmith * 33383174Smsmith * PARAMETERS: LineNumber - Caller's line number 334151937Sjkim * FunctionName - Caller's procedure name 335151937Sjkim * ModuleName - Caller's module name 336151937Sjkim * ComponentId - Caller's component ID 33767754Smsmith * Pointer - Pointer to display 33867754Smsmith * 33967754Smsmith * RETURN: None 34067754Smsmith * 341241973Sjkim * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is 34267754Smsmith * set in DebugLevel 34367754Smsmith * 344151937Sjkim ******************************************************************************/ 34567754Smsmith 34667754Smsmithvoid 34783174SmsmithAcpiUtTracePtr ( 34867754Smsmith UINT32 LineNumber, 349151937Sjkim const char *FunctionName, 350193267Sjkim const char *ModuleName, 351151937Sjkim UINT32 ComponentId, 352306536Sjkim const void *Pointer) 35367754Smsmith{ 354241973Sjkim 35567754Smsmith AcpiGbl_NestingLevel++; 35683174Smsmith AcpiUtTrackStackPtr (); 35783174Smsmith 358245582Sjkim /* Check if enabled up-front for performance */ 359245582Sjkim 360245582Sjkim if (ACPI_IS_DEBUG_ENABLED (ACPI_LV_FUNCTIONS, ComponentId)) 361245582Sjkim { 362245582Sjkim AcpiDebugPrint (ACPI_LV_FUNCTIONS, 363245582Sjkim LineNumber, FunctionName, ModuleName, ComponentId, 364306536Sjkim "%s %p\n", AcpiGbl_FunctionEntryPrefix, Pointer); 365245582Sjkim } 36667754Smsmith} 36767754Smsmith 36867754Smsmith 369151937Sjkim/******************************************************************************* 37067754Smsmith * 37183174Smsmith * FUNCTION: AcpiUtTraceStr 37267754Smsmith * 37383174Smsmith * PARAMETERS: LineNumber - Caller's line number 374151937Sjkim * FunctionName - Caller's procedure name 375151937Sjkim * ModuleName - Caller's module name 376151937Sjkim * ComponentId - Caller's component ID 37767754Smsmith * String - Additional string to display 37867754Smsmith * 37967754Smsmith * RETURN: None 38067754Smsmith * 381241973Sjkim * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is 38267754Smsmith * set in DebugLevel 38367754Smsmith * 384151937Sjkim ******************************************************************************/ 38567754Smsmith 38667754Smsmithvoid 38783174SmsmithAcpiUtTraceStr ( 38867754Smsmith UINT32 LineNumber, 389151937Sjkim const char *FunctionName, 390193267Sjkim const char *ModuleName, 391151937Sjkim UINT32 ComponentId, 392306536Sjkim const char *String) 39367754Smsmith{ 39467754Smsmith 39567754Smsmith AcpiGbl_NestingLevel++; 39683174Smsmith AcpiUtTrackStackPtr (); 39783174Smsmith 398245582Sjkim /* Check if enabled up-front for performance */ 399245582Sjkim 400245582Sjkim if (ACPI_IS_DEBUG_ENABLED (ACPI_LV_FUNCTIONS, ComponentId)) 401245582Sjkim { 402245582Sjkim AcpiDebugPrint (ACPI_LV_FUNCTIONS, 403245582Sjkim LineNumber, FunctionName, ModuleName, ComponentId, 404306536Sjkim "%s %s\n", AcpiGbl_FunctionEntryPrefix, String); 405245582Sjkim } 40667754Smsmith} 40767754Smsmith 40867754Smsmith 409151937Sjkim/******************************************************************************* 41067754Smsmith * 41183174Smsmith * FUNCTION: AcpiUtTraceU32 41267754Smsmith * 41383174Smsmith * PARAMETERS: LineNumber - Caller's line number 414151937Sjkim * FunctionName - Caller's procedure name 415151937Sjkim * ModuleName - Caller's module name 416151937Sjkim * ComponentId - Caller's component ID 41767754Smsmith * Integer - Integer to display 41867754Smsmith * 41967754Smsmith * RETURN: None 42067754Smsmith * 421241973Sjkim * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is 42267754Smsmith * set in DebugLevel 42367754Smsmith * 424151937Sjkim ******************************************************************************/ 42567754Smsmith 42667754Smsmithvoid 42783174SmsmithAcpiUtTraceU32 ( 42867754Smsmith UINT32 LineNumber, 429151937Sjkim const char *FunctionName, 430193267Sjkim const char *ModuleName, 431151937Sjkim UINT32 ComponentId, 43267754Smsmith UINT32 Integer) 43367754Smsmith{ 43467754Smsmith 43567754Smsmith AcpiGbl_NestingLevel++; 43683174Smsmith AcpiUtTrackStackPtr (); 43783174Smsmith 438245582Sjkim /* Check if enabled up-front for performance */ 439245582Sjkim 440245582Sjkim if (ACPI_IS_DEBUG_ENABLED (ACPI_LV_FUNCTIONS, ComponentId)) 441245582Sjkim { 442245582Sjkim AcpiDebugPrint (ACPI_LV_FUNCTIONS, 443245582Sjkim LineNumber, FunctionName, ModuleName, ComponentId, 444306536Sjkim "%s %08X\n", AcpiGbl_FunctionEntryPrefix, Integer); 445245582Sjkim } 44667754Smsmith} 44767754Smsmith 44867754Smsmith 449151937Sjkim/******************************************************************************* 45067754Smsmith * 45183174Smsmith * FUNCTION: AcpiUtExit 45267754Smsmith * 45383174Smsmith * PARAMETERS: LineNumber - Caller's line number 454151937Sjkim * FunctionName - Caller's procedure name 455151937Sjkim * ModuleName - Caller's module name 456151937Sjkim * ComponentId - Caller's component ID 45767754Smsmith * 45867754Smsmith * RETURN: None 45967754Smsmith * 460241973Sjkim * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is 46167754Smsmith * set in DebugLevel 46267754Smsmith * 463151937Sjkim ******************************************************************************/ 46467754Smsmith 46567754Smsmithvoid 46683174SmsmithAcpiUtExit ( 46767754Smsmith UINT32 LineNumber, 468151937Sjkim const char *FunctionName, 469193267Sjkim const char *ModuleName, 470151937Sjkim UINT32 ComponentId) 47167754Smsmith{ 47267754Smsmith 473245582Sjkim /* Check if enabled up-front for performance */ 47467754Smsmith 475245582Sjkim if (ACPI_IS_DEBUG_ENABLED (ACPI_LV_FUNCTIONS, ComponentId)) 476245582Sjkim { 477245582Sjkim AcpiDebugPrint (ACPI_LV_FUNCTIONS, 478245582Sjkim LineNumber, FunctionName, ModuleName, ComponentId, 479306536Sjkim "%s\n", AcpiGbl_FunctionExitPrefix); 480245582Sjkim } 481245582Sjkim 482281075Sdim if (AcpiGbl_NestingLevel) 483281075Sdim { 484281075Sdim AcpiGbl_NestingLevel--; 485281075Sdim } 48667754Smsmith} 48767754Smsmith 488167802SjkimACPI_EXPORT_SYMBOL (AcpiUtExit) 48967754Smsmith 490167802Sjkim 491151937Sjkim/******************************************************************************* 49267754Smsmith * 49383174Smsmith * FUNCTION: AcpiUtStatusExit 49467754Smsmith * 49583174Smsmith * PARAMETERS: LineNumber - Caller's line number 496151937Sjkim * FunctionName - Caller's procedure name 497151937Sjkim * ModuleName - Caller's module name 498151937Sjkim * ComponentId - Caller's component ID 49967754Smsmith * Status - Exit status code 50067754Smsmith * 50167754Smsmith * RETURN: None 50267754Smsmith * 503241973Sjkim * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is 504241973Sjkim * set in DebugLevel. Prints exit status also. 50567754Smsmith * 506151937Sjkim ******************************************************************************/ 50767754Smsmith 50867754Smsmithvoid 50983174SmsmithAcpiUtStatusExit ( 51067754Smsmith UINT32 LineNumber, 511151937Sjkim const char *FunctionName, 512193267Sjkim const char *ModuleName, 513151937Sjkim UINT32 ComponentId, 51467754Smsmith ACPI_STATUS Status) 51567754Smsmith{ 51667754Smsmith 517245582Sjkim /* Check if enabled up-front for performance */ 518245582Sjkim 519245582Sjkim if (ACPI_IS_DEBUG_ENABLED (ACPI_LV_FUNCTIONS, ComponentId)) 52083174Smsmith { 521245582Sjkim if (ACPI_SUCCESS (Status)) 522245582Sjkim { 523245582Sjkim AcpiDebugPrint (ACPI_LV_FUNCTIONS, 524245582Sjkim LineNumber, FunctionName, ModuleName, ComponentId, 525306536Sjkim "%s %s\n", AcpiGbl_FunctionExitPrefix, 526245582Sjkim AcpiFormatException (Status)); 527245582Sjkim } 528245582Sjkim else 529245582Sjkim { 530245582Sjkim AcpiDebugPrint (ACPI_LV_FUNCTIONS, 531245582Sjkim LineNumber, FunctionName, ModuleName, ComponentId, 532306536Sjkim "%s ****Exception****: %s\n", AcpiGbl_FunctionExitPrefix, 533245582Sjkim AcpiFormatException (Status)); 534245582Sjkim } 53583174Smsmith } 53667754Smsmith 537281075Sdim if (AcpiGbl_NestingLevel) 538281075Sdim { 539281075Sdim AcpiGbl_NestingLevel--; 540281075Sdim } 54167754Smsmith} 54267754Smsmith 543167802SjkimACPI_EXPORT_SYMBOL (AcpiUtStatusExit) 54467754Smsmith 545167802Sjkim 546151937Sjkim/******************************************************************************* 54767754Smsmith * 54883174Smsmith * FUNCTION: AcpiUtValueExit 54967754Smsmith * 55083174Smsmith * PARAMETERS: LineNumber - Caller's line number 551151937Sjkim * FunctionName - Caller's procedure name 552151937Sjkim * ModuleName - Caller's module name 553151937Sjkim * ComponentId - Caller's component ID 55467754Smsmith * Value - Value to be printed with exit msg 55567754Smsmith * 55667754Smsmith * RETURN: None 55767754Smsmith * 558241973Sjkim * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is 559241973Sjkim * set in DebugLevel. Prints exit value also. 56067754Smsmith * 561151937Sjkim ******************************************************************************/ 56267754Smsmith 56367754Smsmithvoid 56483174SmsmithAcpiUtValueExit ( 56567754Smsmith UINT32 LineNumber, 566151937Sjkim const char *FunctionName, 567193267Sjkim const char *ModuleName, 568151937Sjkim UINT32 ComponentId, 569202771Sjkim UINT64 Value) 57067754Smsmith{ 57167754Smsmith 572245582Sjkim /* Check if enabled up-front for performance */ 57367754Smsmith 574245582Sjkim if (ACPI_IS_DEBUG_ENABLED (ACPI_LV_FUNCTIONS, ComponentId)) 575245582Sjkim { 576245582Sjkim AcpiDebugPrint (ACPI_LV_FUNCTIONS, 577245582Sjkim LineNumber, FunctionName, ModuleName, ComponentId, 578306536Sjkim "%s %8.8X%8.8X\n", AcpiGbl_FunctionExitPrefix, 579245582Sjkim ACPI_FORMAT_UINT64 (Value)); 580245582Sjkim } 581245582Sjkim 582281075Sdim if (AcpiGbl_NestingLevel) 583281075Sdim { 584281075Sdim AcpiGbl_NestingLevel--; 585281075Sdim } 58667754Smsmith} 58767754Smsmith 588167802SjkimACPI_EXPORT_SYMBOL (AcpiUtValueExit) 58967754Smsmith 590167802Sjkim 591151937Sjkim/******************************************************************************* 59267754Smsmith * 59383174Smsmith * FUNCTION: AcpiUtPtrExit 59467754Smsmith * 59583174Smsmith * PARAMETERS: LineNumber - Caller's line number 596151937Sjkim * FunctionName - Caller's procedure name 597151937Sjkim * ModuleName - Caller's module name 598151937Sjkim * ComponentId - Caller's component ID 599151937Sjkim * Ptr - Pointer to display 60067754Smsmith * 60167754Smsmith * RETURN: None 60267754Smsmith * 603241973Sjkim * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is 604241973Sjkim * set in DebugLevel. Prints exit value also. 60567754Smsmith * 606151937Sjkim ******************************************************************************/ 60767754Smsmith 60867754Smsmithvoid 60983174SmsmithAcpiUtPtrExit ( 61067754Smsmith UINT32 LineNumber, 611151937Sjkim const char *FunctionName, 612193267Sjkim const char *ModuleName, 613151937Sjkim UINT32 ComponentId, 61467754Smsmith UINT8 *Ptr) 61567754Smsmith{ 61667754Smsmith 617245582Sjkim /* Check if enabled up-front for performance */ 61867754Smsmith 619245582Sjkim if (ACPI_IS_DEBUG_ENABLED (ACPI_LV_FUNCTIONS, ComponentId)) 620245582Sjkim { 621245582Sjkim AcpiDebugPrint (ACPI_LV_FUNCTIONS, 622245582Sjkim LineNumber, FunctionName, ModuleName, ComponentId, 623306536Sjkim "%s %p\n", AcpiGbl_FunctionExitPrefix, Ptr); 624245582Sjkim } 625245582Sjkim 626281075Sdim if (AcpiGbl_NestingLevel) 627281075Sdim { 628281075Sdim AcpiGbl_NestingLevel--; 629281075Sdim } 63067754Smsmith} 63167754Smsmith 632306536Sjkim 633306536Sjkim/******************************************************************************* 634306536Sjkim * 635306536Sjkim * FUNCTION: AcpiUtStrExit 636306536Sjkim * 637306536Sjkim * PARAMETERS: LineNumber - Caller's line number 638306536Sjkim * FunctionName - Caller's procedure name 639306536Sjkim * ModuleName - Caller's module name 640306536Sjkim * ComponentId - Caller's component ID 641306536Sjkim * String - String to display 642306536Sjkim * 643306536Sjkim * RETURN: None 644306536Sjkim * 645306536Sjkim * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is 646306536Sjkim * set in DebugLevel. Prints exit value also. 647306536Sjkim * 648306536Sjkim ******************************************************************************/ 649306536Sjkim 650306536Sjkimvoid 651306536SjkimAcpiUtStrExit ( 652306536Sjkim UINT32 LineNumber, 653306536Sjkim const char *FunctionName, 654306536Sjkim const char *ModuleName, 655306536Sjkim UINT32 ComponentId, 656306536Sjkim const char *String) 657306536Sjkim{ 658306536Sjkim 659306536Sjkim /* Check if enabled up-front for performance */ 660306536Sjkim 661306536Sjkim if (ACPI_IS_DEBUG_ENABLED (ACPI_LV_FUNCTIONS, ComponentId)) 662306536Sjkim { 663306536Sjkim AcpiDebugPrint (ACPI_LV_FUNCTIONS, 664306536Sjkim LineNumber, FunctionName, ModuleName, ComponentId, 665306536Sjkim "%s %s\n", AcpiGbl_FunctionExitPrefix, String); 666306536Sjkim } 667306536Sjkim 668306536Sjkim if (AcpiGbl_NestingLevel) 669306536Sjkim { 670306536Sjkim AcpiGbl_NestingLevel--; 671306536Sjkim } 672306536Sjkim} 673306536Sjkim 674306536Sjkim 675306536Sjkim/******************************************************************************* 676306536Sjkim * 677306536Sjkim * FUNCTION: AcpiTracePoint 678306536Sjkim * 679306536Sjkim * PARAMETERS: Type - Trace event type 680306536Sjkim * Begin - TRUE if before execution 681306536Sjkim * Aml - Executed AML address 682306536Sjkim * Pathname - Object path 683306536Sjkim * Pointer - Pointer to the related object 684306536Sjkim * 685306536Sjkim * RETURN: None 686306536Sjkim * 687306536Sjkim * DESCRIPTION: Interpreter execution trace. 688306536Sjkim * 689306536Sjkim ******************************************************************************/ 690306536Sjkim 691306536Sjkimvoid 692306536SjkimAcpiTracePoint ( 693306536Sjkim ACPI_TRACE_EVENT_TYPE Type, 694306536Sjkim BOOLEAN Begin, 695306536Sjkim UINT8 *Aml, 696306536Sjkim char *Pathname) 697306536Sjkim{ 698306536Sjkim 699306536Sjkim ACPI_FUNCTION_ENTRY (); 700306536Sjkim 701306536Sjkim AcpiExTracePoint (Type, Begin, Aml, Pathname); 702306536Sjkim 703306536Sjkim#ifdef ACPI_USE_SYSTEM_TRACER 704306536Sjkim AcpiOsTracePoint (Type, Begin, Aml, Pathname); 70583174Smsmith#endif 706306536Sjkim} 707281075Sdim 708306536SjkimACPI_EXPORT_SYMBOL (AcpiTracePoint) 709281075Sdim 710306536Sjkim#endif 711306536Sjkim 712306536Sjkim 713281075Sdim#ifdef ACPI_APPLICATION 714281075Sdim/******************************************************************************* 715281075Sdim * 716281075Sdim * FUNCTION: AcpiLogError 717281075Sdim * 718281075Sdim * PARAMETERS: Format - Printf format field 719281075Sdim * ... - Optional printf arguments 720281075Sdim * 721281075Sdim * RETURN: None 722281075Sdim * 723281075Sdim * DESCRIPTION: Print error message to the console, used by applications. 724281075Sdim * 725281075Sdim ******************************************************************************/ 726281075Sdim 727281075Sdimvoid ACPI_INTERNAL_VAR_XFACE 728281075SdimAcpiLogError ( 729281075Sdim const char *Format, 730281075Sdim ...) 731281075Sdim{ 732281075Sdim va_list Args; 733281075Sdim 734281075Sdim va_start (Args, Format); 735281075Sdim (void) AcpiUtFileVprintf (ACPI_FILE_ERR, Format, Args); 736281075Sdim va_end (Args); 737281075Sdim} 738281075Sdim 739281075SdimACPI_EXPORT_SYMBOL (AcpiLogError) 740281075Sdim#endif 741