13446Smrj /****************************************************************************** 23446Smrj * 33446Smrj * Module Name: utdebug - Debug print routines 43446Smrj * 53446Smrj *****************************************************************************/ 63446Smrj 73446Smrj /****************************************************************************** 83446Smrj * 93446Smrj * 1. Copyright Notice 103446Smrj * 11*9980SDana.Myers@Sun.COM * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. 123446Smrj * All rights reserved. 133446Smrj * 143446Smrj * 2. License 153446Smrj * 163446Smrj * 2.1. This is your license from Intel Corp. under its intellectual property 173446Smrj * rights. You may have additional license terms from the party that provided 183446Smrj * you this software, covering your right to use that party's intellectual 193446Smrj * property rights. 203446Smrj * 213446Smrj * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a 223446Smrj * copy of the source code appearing in this file ("Covered Code") an 233446Smrj * irrevocable, perpetual, worldwide license under Intel's copyrights in the 243446Smrj * base code distributed originally by Intel ("Original Intel Code") to copy, 253446Smrj * make derivatives, distribute, use and display any portion of the Covered 263446Smrj * Code in any form, with the right to sublicense such rights; and 273446Smrj * 283446Smrj * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent 293446Smrj * license (with the right to sublicense), under only those claims of Intel 303446Smrj * patents that are infringed by the Original Intel Code, to make, use, sell, 313446Smrj * offer to sell, and import the Covered Code and derivative works thereof 323446Smrj * solely to the minimum extent necessary to exercise the above copyright 333446Smrj * license, and in no event shall the patent license extend to any additions 343446Smrj * to or modifications of the Original Intel Code. No other license or right 353446Smrj * is granted directly or by implication, estoppel or otherwise; 363446Smrj * 373446Smrj * The above copyright and patent license is granted only if the following 383446Smrj * conditions are met: 393446Smrj * 403446Smrj * 3. Conditions 413446Smrj * 423446Smrj * 3.1. Redistribution of Source with Rights to Further Distribute Source. 433446Smrj * Redistribution of source code of any substantial portion of the Covered 443446Smrj * Code or modification with rights to further distribute source must include 453446Smrj * the above Copyright Notice, the above License, this list of Conditions, 463446Smrj * and the following Disclaimer and Export Compliance provision. In addition, 473446Smrj * Licensee must cause all Covered Code to which Licensee contributes to 483446Smrj * contain a file documenting the changes Licensee made to create that Covered 493446Smrj * Code and the date of any change. Licensee must include in that file the 503446Smrj * documentation of any changes made by any predecessor Licensee. Licensee 513446Smrj * must include a prominent statement that the modification is derived, 523446Smrj * directly or indirectly, from Original Intel Code. 533446Smrj * 543446Smrj * 3.2. Redistribution of Source with no Rights to Further Distribute Source. 553446Smrj * Redistribution of source code of any substantial portion of the Covered 563446Smrj * Code or modification without rights to further distribute source must 573446Smrj * include the following Disclaimer and Export Compliance provision in the 583446Smrj * documentation and/or other materials provided with distribution. In 593446Smrj * addition, Licensee may not authorize further sublicense of source of any 603446Smrj * portion of the Covered Code, and must include terms to the effect that the 613446Smrj * license from Licensee to its licensee is limited to the intellectual 623446Smrj * property embodied in the software Licensee provides to its licensee, and 633446Smrj * not to intellectual property embodied in modifications its licensee may 643446Smrj * make. 653446Smrj * 663446Smrj * 3.3. Redistribution of Executable. Redistribution in executable form of any 673446Smrj * substantial portion of the Covered Code or modification must reproduce the 683446Smrj * above Copyright Notice, and the following Disclaimer and Export Compliance 693446Smrj * provision in the documentation and/or other materials provided with the 703446Smrj * distribution. 713446Smrj * 723446Smrj * 3.4. Intel retains all right, title, and interest in and to the Original 733446Smrj * Intel Code. 743446Smrj * 753446Smrj * 3.5. Neither the name Intel nor any other trademark owned or controlled by 763446Smrj * Intel shall be used in advertising or otherwise to promote the sale, use or 773446Smrj * other dealings in products derived from or relating to the Covered Code 783446Smrj * without prior written authorization from Intel. 793446Smrj * 803446Smrj * 4. Disclaimer and Export Compliance 813446Smrj * 823446Smrj * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED 833446Smrj * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE 843446Smrj * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, 853446Smrj * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY 863446Smrj * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY 873446Smrj * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A 883446Smrj * PARTICULAR PURPOSE. 893446Smrj * 903446Smrj * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES 913446Smrj * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR 923446Smrj * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, 933446Smrj * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY 943446Smrj * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL 953446Smrj * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS 963446Smrj * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY 973446Smrj * LIMITED REMEDY. 983446Smrj * 993446Smrj * 4.3. Licensee shall not export, either directly or indirectly, any of this 1003446Smrj * software or system incorporating such software without first obtaining any 1013446Smrj * required license or other approval from the U. S. Department of Commerce or 1023446Smrj * any other agency or department of the United States Government. In the 1033446Smrj * event Licensee exports any such software from the United States or 1043446Smrj * re-exports any such software from a foreign destination, Licensee shall 1053446Smrj * ensure that the distribution and export/re-export of the software is in 1063446Smrj * compliance with all laws, regulations, orders, or other restrictions of the 1073446Smrj * U.S. Export Administration Regulations. Licensee agrees that neither it nor 1083446Smrj * any of its subsidiaries will export/re-export any technical data, process, 1093446Smrj * software, or service, directly or indirectly, to any country for which the 1103446Smrj * United States government or any agency thereof requires an export license, 1113446Smrj * other governmental approval, or letter of assurance, without first obtaining 1123446Smrj * such license, approval or letter. 1133446Smrj * 1143446Smrj *****************************************************************************/ 1153446Smrj 1163446Smrj #define __UTDEBUG_C__ 1173446Smrj 1183446Smrj #include "acpi.h" 119*9980SDana.Myers@Sun.COM #include "accommon.h" 1203446Smrj 1213446Smrj #define _COMPONENT ACPI_UTILITIES 1223446Smrj ACPI_MODULE_NAME ("utdebug") 1233446Smrj 1243446Smrj 1253446Smrj #ifdef ACPI_DEBUG_OUTPUT 1263446Smrj 127*9980SDana.Myers@Sun.COM static ACPI_THREAD_ID AcpiGbl_PrevThreadId = (ACPI_THREAD_ID) 0xFFFFFFFF; 1287851SDana.Myers@Sun.COM static char *AcpiGbl_FnEntryStr = "----Entry"; 1297851SDana.Myers@Sun.COM static char *AcpiGbl_FnExitStr = "----Exit-"; 1303446Smrj 1313446Smrj /* Local prototypes */ 1323446Smrj 1333446Smrj static const char * 1343446Smrj AcpiUtTrimFunctionName ( 1353446Smrj const char *FunctionName); 1363446Smrj 1373446Smrj 1383446Smrj /******************************************************************************* 1393446Smrj * 1403446Smrj * FUNCTION: AcpiUtInitStackPtrTrace 1413446Smrj * 1423446Smrj * PARAMETERS: None 1433446Smrj * 1443446Smrj * RETURN: None 1453446Smrj * 1463446Smrj * DESCRIPTION: Save the current CPU stack pointer at subsystem startup 1473446Smrj * 1483446Smrj ******************************************************************************/ 1493446Smrj 1503446Smrj void 1513446Smrj AcpiUtInitStackPtrTrace ( 1523446Smrj void) 1533446Smrj { 1547851SDana.Myers@Sun.COM ACPI_SIZE CurrentSp; 1553446Smrj 1563446Smrj 1577851SDana.Myers@Sun.COM AcpiGbl_EntryStackPointer = &CurrentSp; 1583446Smrj } 1593446Smrj 1603446Smrj 1613446Smrj /******************************************************************************* 1623446Smrj * 1633446Smrj * FUNCTION: AcpiUtTrackStackPtr 1643446Smrj * 1653446Smrj * PARAMETERS: None 1663446Smrj * 1673446Smrj * RETURN: None 1683446Smrj * 1693446Smrj * DESCRIPTION: Save the current CPU stack pointer 1703446Smrj * 1713446Smrj ******************************************************************************/ 1723446Smrj 1733446Smrj void 1743446Smrj AcpiUtTrackStackPtr ( 1753446Smrj void) 1763446Smrj { 1773446Smrj ACPI_SIZE CurrentSp; 1783446Smrj 1793446Smrj 1807851SDana.Myers@Sun.COM if (&CurrentSp < AcpiGbl_LowestStackPointer) 1813446Smrj { 1827851SDana.Myers@Sun.COM AcpiGbl_LowestStackPointer = &CurrentSp; 1833446Smrj } 1843446Smrj 1853446Smrj if (AcpiGbl_NestingLevel > AcpiGbl_DeepestNesting) 1863446Smrj { 1873446Smrj AcpiGbl_DeepestNesting = AcpiGbl_NestingLevel; 1883446Smrj } 1893446Smrj } 1903446Smrj 1913446Smrj 1923446Smrj /******************************************************************************* 1933446Smrj * 1943446Smrj * FUNCTION: AcpiUtTrimFunctionName 1953446Smrj * 1963446Smrj * PARAMETERS: FunctionName - Ascii string containing a procedure name 1973446Smrj * 1983446Smrj * RETURN: Updated pointer to the function name 1993446Smrj * 2003446Smrj * DESCRIPTION: Remove the "Acpi" prefix from the function name, if present. 2013446Smrj * This allows compiler macros such as __FUNCTION__ to be used 2023446Smrj * with no change to the debug output. 2033446Smrj * 2043446Smrj ******************************************************************************/ 2053446Smrj 2063446Smrj static const char * 2073446Smrj AcpiUtTrimFunctionName ( 2083446Smrj const char *FunctionName) 2093446Smrj { 2103446Smrj 2113446Smrj /* All Function names are longer than 4 chars, check is safe */ 2123446Smrj 2133446Smrj if (*(ACPI_CAST_PTR (UINT32, FunctionName)) == ACPI_PREFIX_MIXED) 2143446Smrj { 2153446Smrj /* This is the case where the original source has not been modified */ 2163446Smrj 2173446Smrj return (FunctionName + 4); 2183446Smrj } 2193446Smrj 2203446Smrj if (*(ACPI_CAST_PTR (UINT32, FunctionName)) == ACPI_PREFIX_LOWER) 2213446Smrj { 2223446Smrj /* This is the case where the source has been 'linuxized' */ 2233446Smrj 2243446Smrj return (FunctionName + 5); 2253446Smrj } 2263446Smrj 2273446Smrj return (FunctionName); 2283446Smrj } 2293446Smrj 2303446Smrj 2313446Smrj /******************************************************************************* 2323446Smrj * 233*9980SDana.Myers@Sun.COM * FUNCTION: AcpiDebugPrint 2343446Smrj * 2353446Smrj * PARAMETERS: RequestedDebugLevel - Requested debug print level 2363446Smrj * LineNumber - Caller's line number (for error output) 2373446Smrj * FunctionName - Caller's procedure name 2383446Smrj * ModuleName - Caller's module name 2393446Smrj * ComponentId - Caller's component ID 2403446Smrj * Format - Printf format field 2413446Smrj * ... - Optional printf arguments 2423446Smrj * 2433446Smrj * RETURN: None 2443446Smrj * 2453446Smrj * DESCRIPTION: Print error message with prefix consisting of the module name, 2463446Smrj * line number, and component ID. 2473446Smrj * 2483446Smrj ******************************************************************************/ 2493446Smrj 2503446Smrj void ACPI_INTERNAL_VAR_XFACE 251*9980SDana.Myers@Sun.COM AcpiDebugPrint ( 2523446Smrj UINT32 RequestedDebugLevel, 2533446Smrj UINT32 LineNumber, 2543446Smrj const char *FunctionName, 2557851SDana.Myers@Sun.COM const char *ModuleName, 2563446Smrj UINT32 ComponentId, 2577851SDana.Myers@Sun.COM const char *Format, 2583446Smrj ...) 2593446Smrj { 2603446Smrj ACPI_THREAD_ID ThreadId; 2613446Smrj va_list args; 2623446Smrj 2633446Smrj 2643446Smrj /* 2653446Smrj * Stay silent if the debug level or component ID is disabled 2663446Smrj */ 2673446Smrj if (!(RequestedDebugLevel & AcpiDbgLevel) || 2683446Smrj !(ComponentId & AcpiDbgLayer)) 2693446Smrj { 2703446Smrj return; 2713446Smrj } 2723446Smrj 2733446Smrj /* 2743446Smrj * Thread tracking and context switch notification 2753446Smrj */ 2763446Smrj ThreadId = AcpiOsGetThreadId (); 2773446Smrj if (ThreadId != AcpiGbl_PrevThreadId) 2783446Smrj { 2793446Smrj if (ACPI_LV_THREADS & AcpiDbgLevel) 2803446Smrj { 2813446Smrj AcpiOsPrintf ( 282*9980SDana.Myers@Sun.COM "\n**** Context Switch from TID %p to TID %p ****\n\n", 283*9980SDana.Myers@Sun.COM ACPI_CAST_PTR (void, AcpiGbl_PrevThreadId), 284*9980SDana.Myers@Sun.COM ACPI_CAST_PTR (void, ThreadId)); 2853446Smrj } 2863446Smrj 2873446Smrj AcpiGbl_PrevThreadId = ThreadId; 2883446Smrj } 2893446Smrj 2903446Smrj /* 2913446Smrj * Display the module name, current line number, thread ID (if requested), 2923446Smrj * current procedure nesting level, and the current procedure name 2933446Smrj */ 2943446Smrj AcpiOsPrintf ("%8s-%04ld ", ModuleName, LineNumber); 2953446Smrj 2963446Smrj if (ACPI_LV_THREADS & AcpiDbgLevel) 2973446Smrj { 298*9980SDana.Myers@Sun.COM AcpiOsPrintf ("[%p] ", ACPI_CAST_PTR (void, ThreadId)); 2993446Smrj } 3003446Smrj 3013446Smrj AcpiOsPrintf ("[%02ld] %-22.22s: ", 3023446Smrj AcpiGbl_NestingLevel, AcpiUtTrimFunctionName (FunctionName)); 3033446Smrj 3043446Smrj va_start (args, Format); 3053446Smrj AcpiOsVprintf (Format, args); 3067851SDana.Myers@Sun.COM va_end (args); 3073446Smrj } 3083446Smrj 309*9980SDana.Myers@Sun.COM ACPI_EXPORT_SYMBOL (AcpiDebugPrint) 3103446Smrj 3113446Smrj 3123446Smrj /******************************************************************************* 3133446Smrj * 314*9980SDana.Myers@Sun.COM * FUNCTION: AcpiDebugPrintRaw 3153446Smrj * 3163446Smrj * PARAMETERS: RequestedDebugLevel - Requested debug print level 3173446Smrj * LineNumber - Caller's line number 3183446Smrj * FunctionName - Caller's procedure name 3193446Smrj * ModuleName - Caller's module name 3203446Smrj * ComponentId - Caller's component ID 3213446Smrj * Format - Printf format field 3223446Smrj * ... - Optional printf arguments 3233446Smrj * 3243446Smrj * RETURN: None 3253446Smrj * 3263446Smrj * DESCRIPTION: Print message with no headers. Has same interface as 3273446Smrj * DebugPrint so that the same macros can be used. 3283446Smrj * 3293446Smrj ******************************************************************************/ 3303446Smrj 3313446Smrj void ACPI_INTERNAL_VAR_XFACE 332*9980SDana.Myers@Sun.COM AcpiDebugPrintRaw ( 3333446Smrj UINT32 RequestedDebugLevel, 3343446Smrj UINT32 LineNumber, 3353446Smrj const char *FunctionName, 3367851SDana.Myers@Sun.COM const char *ModuleName, 3373446Smrj UINT32 ComponentId, 3387851SDana.Myers@Sun.COM const char *Format, 3393446Smrj ...) 3403446Smrj { 3413446Smrj va_list args; 3423446Smrj 3433446Smrj 3443446Smrj if (!(RequestedDebugLevel & AcpiDbgLevel) || 3453446Smrj !(ComponentId & AcpiDbgLayer)) 3463446Smrj { 3473446Smrj return; 3483446Smrj } 3493446Smrj 3503446Smrj va_start (args, Format); 3513446Smrj AcpiOsVprintf (Format, args); 3527851SDana.Myers@Sun.COM va_end (args); 3533446Smrj } 3543446Smrj 355*9980SDana.Myers@Sun.COM ACPI_EXPORT_SYMBOL (AcpiDebugPrintRaw) 3563446Smrj 3573446Smrj 3583446Smrj /******************************************************************************* 3593446Smrj * 3603446Smrj * FUNCTION: AcpiUtTrace 3613446Smrj * 3623446Smrj * PARAMETERS: LineNumber - Caller's line number 3633446Smrj * FunctionName - Caller's procedure name 3643446Smrj * ModuleName - Caller's module name 3653446Smrj * ComponentId - Caller's component ID 3663446Smrj * 3673446Smrj * RETURN: None 3683446Smrj * 3693446Smrj * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is 3703446Smrj * set in DebugLevel 3713446Smrj * 3723446Smrj ******************************************************************************/ 3733446Smrj 3743446Smrj void 3753446Smrj AcpiUtTrace ( 3763446Smrj UINT32 LineNumber, 3773446Smrj const char *FunctionName, 3787851SDana.Myers@Sun.COM const char *ModuleName, 3793446Smrj UINT32 ComponentId) 3803446Smrj { 3813446Smrj 3823446Smrj AcpiGbl_NestingLevel++; 3833446Smrj AcpiUtTrackStackPtr (); 3843446Smrj 385*9980SDana.Myers@Sun.COM AcpiDebugPrint (ACPI_LV_FUNCTIONS, 3863446Smrj LineNumber, FunctionName, ModuleName, ComponentId, 3873446Smrj "%s\n", AcpiGbl_FnEntryStr); 3883446Smrj } 3893446Smrj 3903446Smrj ACPI_EXPORT_SYMBOL (AcpiUtTrace) 3913446Smrj 3923446Smrj 3933446Smrj /******************************************************************************* 3943446Smrj * 3953446Smrj * FUNCTION: AcpiUtTracePtr 3963446Smrj * 3973446Smrj * PARAMETERS: LineNumber - Caller's line number 3983446Smrj * FunctionName - Caller's procedure name 3993446Smrj * ModuleName - Caller's module name 4003446Smrj * ComponentId - Caller's component ID 4013446Smrj * Pointer - Pointer to display 4023446Smrj * 4033446Smrj * RETURN: None 4043446Smrj * 4053446Smrj * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is 4063446Smrj * set in DebugLevel 4073446Smrj * 4083446Smrj ******************************************************************************/ 4093446Smrj 4103446Smrj void 4113446Smrj AcpiUtTracePtr ( 4123446Smrj UINT32 LineNumber, 4133446Smrj const char *FunctionName, 4147851SDana.Myers@Sun.COM const char *ModuleName, 4153446Smrj UINT32 ComponentId, 4163446Smrj void *Pointer) 4173446Smrj { 4183446Smrj AcpiGbl_NestingLevel++; 4193446Smrj AcpiUtTrackStackPtr (); 4203446Smrj 421*9980SDana.Myers@Sun.COM AcpiDebugPrint (ACPI_LV_FUNCTIONS, 4223446Smrj LineNumber, FunctionName, ModuleName, ComponentId, 4233446Smrj "%s %p\n", AcpiGbl_FnEntryStr, Pointer); 4243446Smrj } 4253446Smrj 4263446Smrj 4273446Smrj /******************************************************************************* 4283446Smrj * 4293446Smrj * FUNCTION: AcpiUtTraceStr 4303446Smrj * 4313446Smrj * PARAMETERS: LineNumber - Caller's line number 4323446Smrj * FunctionName - Caller's procedure name 4333446Smrj * ModuleName - Caller's module name 4343446Smrj * ComponentId - Caller's component ID 4353446Smrj * String - Additional string to display 4363446Smrj * 4373446Smrj * RETURN: None 4383446Smrj * 4393446Smrj * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is 4403446Smrj * set in DebugLevel 4413446Smrj * 4423446Smrj ******************************************************************************/ 4433446Smrj 4443446Smrj void 4453446Smrj AcpiUtTraceStr ( 4463446Smrj UINT32 LineNumber, 4473446Smrj const char *FunctionName, 4487851SDana.Myers@Sun.COM const char *ModuleName, 4493446Smrj UINT32 ComponentId, 4503446Smrj char *String) 4513446Smrj { 4523446Smrj 4533446Smrj AcpiGbl_NestingLevel++; 4543446Smrj AcpiUtTrackStackPtr (); 4553446Smrj 456*9980SDana.Myers@Sun.COM AcpiDebugPrint (ACPI_LV_FUNCTIONS, 4573446Smrj LineNumber, FunctionName, ModuleName, ComponentId, 4583446Smrj "%s %s\n", AcpiGbl_FnEntryStr, String); 4593446Smrj } 4603446Smrj 4613446Smrj 4623446Smrj /******************************************************************************* 4633446Smrj * 4643446Smrj * FUNCTION: AcpiUtTraceU32 4653446Smrj * 4663446Smrj * PARAMETERS: LineNumber - Caller's line number 4673446Smrj * FunctionName - Caller's procedure name 4683446Smrj * ModuleName - Caller's module name 4693446Smrj * ComponentId - Caller's component ID 4703446Smrj * Integer - Integer to display 4713446Smrj * 4723446Smrj * RETURN: None 4733446Smrj * 4743446Smrj * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is 4753446Smrj * set in DebugLevel 4763446Smrj * 4773446Smrj ******************************************************************************/ 4783446Smrj 4793446Smrj void 4803446Smrj AcpiUtTraceU32 ( 4813446Smrj UINT32 LineNumber, 4823446Smrj const char *FunctionName, 4837851SDana.Myers@Sun.COM const char *ModuleName, 4843446Smrj UINT32 ComponentId, 4853446Smrj UINT32 Integer) 4863446Smrj { 4873446Smrj 4883446Smrj AcpiGbl_NestingLevel++; 4893446Smrj AcpiUtTrackStackPtr (); 4903446Smrj 491*9980SDana.Myers@Sun.COM AcpiDebugPrint (ACPI_LV_FUNCTIONS, 4923446Smrj LineNumber, FunctionName, ModuleName, ComponentId, 4933446Smrj "%s %08X\n", AcpiGbl_FnEntryStr, Integer); 4943446Smrj } 4953446Smrj 4963446Smrj 4973446Smrj /******************************************************************************* 4983446Smrj * 4993446Smrj * FUNCTION: AcpiUtExit 5003446Smrj * 5013446Smrj * PARAMETERS: LineNumber - Caller's line number 5023446Smrj * FunctionName - Caller's procedure name 5033446Smrj * ModuleName - Caller's module name 5043446Smrj * ComponentId - Caller's component ID 5053446Smrj * 5063446Smrj * RETURN: None 5073446Smrj * 5083446Smrj * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is 5093446Smrj * set in DebugLevel 5103446Smrj * 5113446Smrj ******************************************************************************/ 5123446Smrj 5133446Smrj void 5143446Smrj AcpiUtExit ( 5153446Smrj UINT32 LineNumber, 5163446Smrj const char *FunctionName, 5177851SDana.Myers@Sun.COM const char *ModuleName, 5183446Smrj UINT32 ComponentId) 5193446Smrj { 5203446Smrj 521*9980SDana.Myers@Sun.COM AcpiDebugPrint (ACPI_LV_FUNCTIONS, 5223446Smrj LineNumber, FunctionName, ModuleName, ComponentId, 5233446Smrj "%s\n", AcpiGbl_FnExitStr); 5243446Smrj 5253446Smrj AcpiGbl_NestingLevel--; 5263446Smrj } 5273446Smrj 5283446Smrj ACPI_EXPORT_SYMBOL (AcpiUtExit) 5293446Smrj 5303446Smrj 5313446Smrj /******************************************************************************* 5323446Smrj * 5333446Smrj * FUNCTION: AcpiUtStatusExit 5343446Smrj * 5353446Smrj * PARAMETERS: LineNumber - Caller's line number 5363446Smrj * FunctionName - Caller's procedure name 5373446Smrj * ModuleName - Caller's module name 5383446Smrj * ComponentId - Caller's component ID 5393446Smrj * Status - Exit status code 5403446Smrj * 5413446Smrj * RETURN: None 5423446Smrj * 5433446Smrj * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is 5443446Smrj * set in DebugLevel. Prints exit status also. 5453446Smrj * 5463446Smrj ******************************************************************************/ 5473446Smrj 5483446Smrj void 5493446Smrj AcpiUtStatusExit ( 5503446Smrj UINT32 LineNumber, 5513446Smrj const char *FunctionName, 5527851SDana.Myers@Sun.COM const char *ModuleName, 5533446Smrj UINT32 ComponentId, 5543446Smrj ACPI_STATUS Status) 5553446Smrj { 5563446Smrj 5573446Smrj if (ACPI_SUCCESS (Status)) 5583446Smrj { 559*9980SDana.Myers@Sun.COM AcpiDebugPrint (ACPI_LV_FUNCTIONS, 5603446Smrj LineNumber, FunctionName, ModuleName, ComponentId, 5613446Smrj "%s %s\n", AcpiGbl_FnExitStr, 5623446Smrj AcpiFormatException (Status)); 5633446Smrj } 5643446Smrj else 5653446Smrj { 566*9980SDana.Myers@Sun.COM AcpiDebugPrint (ACPI_LV_FUNCTIONS, 5673446Smrj LineNumber, FunctionName, ModuleName, ComponentId, 5683446Smrj "%s ****Exception****: %s\n", AcpiGbl_FnExitStr, 5693446Smrj AcpiFormatException (Status)); 5703446Smrj } 5713446Smrj 5723446Smrj AcpiGbl_NestingLevel--; 5733446Smrj } 5743446Smrj 5753446Smrj ACPI_EXPORT_SYMBOL (AcpiUtStatusExit) 5763446Smrj 5773446Smrj 5783446Smrj /******************************************************************************* 5793446Smrj * 5803446Smrj * FUNCTION: AcpiUtValueExit 5813446Smrj * 5823446Smrj * PARAMETERS: LineNumber - Caller's line number 5833446Smrj * FunctionName - Caller's procedure name 5843446Smrj * ModuleName - Caller's module name 5853446Smrj * ComponentId - Caller's component ID 5863446Smrj * Value - Value to be printed with exit msg 5873446Smrj * 5883446Smrj * RETURN: None 5893446Smrj * 5903446Smrj * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is 5913446Smrj * set in DebugLevel. Prints exit value also. 5923446Smrj * 5933446Smrj ******************************************************************************/ 5943446Smrj 5953446Smrj void 5963446Smrj AcpiUtValueExit ( 5973446Smrj UINT32 LineNumber, 5983446Smrj const char *FunctionName, 5997851SDana.Myers@Sun.COM const char *ModuleName, 6003446Smrj UINT32 ComponentId, 6013446Smrj ACPI_INTEGER Value) 6023446Smrj { 6033446Smrj 604*9980SDana.Myers@Sun.COM AcpiDebugPrint (ACPI_LV_FUNCTIONS, 6053446Smrj LineNumber, FunctionName, ModuleName, ComponentId, 6063446Smrj "%s %8.8X%8.8X\n", AcpiGbl_FnExitStr, 6073446Smrj ACPI_FORMAT_UINT64 (Value)); 6083446Smrj 6093446Smrj AcpiGbl_NestingLevel--; 6103446Smrj } 6113446Smrj 6123446Smrj ACPI_EXPORT_SYMBOL (AcpiUtValueExit) 6133446Smrj 6143446Smrj 6153446Smrj /******************************************************************************* 6163446Smrj * 6173446Smrj * FUNCTION: AcpiUtPtrExit 6183446Smrj * 6193446Smrj * PARAMETERS: LineNumber - Caller's line number 6203446Smrj * FunctionName - Caller's procedure name 6213446Smrj * ModuleName - Caller's module name 6223446Smrj * ComponentId - Caller's component ID 6233446Smrj * Ptr - Pointer to display 6243446Smrj * 6253446Smrj * RETURN: None 6263446Smrj * 6273446Smrj * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is 6283446Smrj * set in DebugLevel. Prints exit value also. 6293446Smrj * 6303446Smrj ******************************************************************************/ 6313446Smrj 6323446Smrj void 6333446Smrj AcpiUtPtrExit ( 6343446Smrj UINT32 LineNumber, 6353446Smrj const char *FunctionName, 6367851SDana.Myers@Sun.COM const char *ModuleName, 6373446Smrj UINT32 ComponentId, 6383446Smrj UINT8 *Ptr) 6393446Smrj { 6403446Smrj 641*9980SDana.Myers@Sun.COM AcpiDebugPrint (ACPI_LV_FUNCTIONS, 6423446Smrj LineNumber, FunctionName, ModuleName, ComponentId, 6433446Smrj "%s %p\n", AcpiGbl_FnExitStr, Ptr); 6443446Smrj 6453446Smrj AcpiGbl_NestingLevel--; 6463446Smrj } 6473446Smrj 6483446Smrj #endif 6493446Smrj 6503446Smrj 6513446Smrj /******************************************************************************* 6523446Smrj * 6533446Smrj * FUNCTION: AcpiUtDumpBuffer 6543446Smrj * 6553446Smrj * PARAMETERS: Buffer - Buffer to dump 6563446Smrj * Count - Amount to dump, in bytes 6573446Smrj * Display - BYTE, WORD, DWORD, or QWORD display 6583446Smrj * ComponentID - Caller's component ID 6593446Smrj * 6603446Smrj * RETURN: None 6613446Smrj * 6623446Smrj * DESCRIPTION: Generic dump buffer in both hex and ascii. 6633446Smrj * 6643446Smrj ******************************************************************************/ 6653446Smrj 6663446Smrj void 6673446Smrj AcpiUtDumpBuffer2 ( 6683446Smrj UINT8 *Buffer, 6693446Smrj UINT32 Count, 6703446Smrj UINT32 Display) 6713446Smrj { 6727851SDana.Myers@Sun.COM UINT32 i = 0; 6737851SDana.Myers@Sun.COM UINT32 j; 6743446Smrj UINT32 Temp32; 6753446Smrj UINT8 BufChar; 6763446Smrj 6773446Smrj 6787851SDana.Myers@Sun.COM if (!Buffer) 6797851SDana.Myers@Sun.COM { 6807851SDana.Myers@Sun.COM AcpiOsPrintf ("Null Buffer Pointer in DumpBuffer!\n"); 6817851SDana.Myers@Sun.COM return; 6827851SDana.Myers@Sun.COM } 6837851SDana.Myers@Sun.COM 6843446Smrj if ((Count < 4) || (Count & 0x01)) 6853446Smrj { 6863446Smrj Display = DB_BYTE_DISPLAY; 6873446Smrj } 6883446Smrj 6893446Smrj /* Nasty little dump buffer routine! */ 6903446Smrj 6913446Smrj while (i < Count) 6923446Smrj { 6933446Smrj /* Print current offset */ 6943446Smrj 6957851SDana.Myers@Sun.COM AcpiOsPrintf ("%6.4X: ", i); 6963446Smrj 6973446Smrj /* Print 16 hex chars */ 6983446Smrj 6993446Smrj for (j = 0; j < 16;) 7003446Smrj { 7013446Smrj if (i + j >= Count) 7023446Smrj { 7033446Smrj /* Dump fill spaces */ 7043446Smrj 7053446Smrj AcpiOsPrintf ("%*s", ((Display * 2) + 1), " "); 7067851SDana.Myers@Sun.COM j += Display; 7073446Smrj continue; 7083446Smrj } 7093446Smrj 7103446Smrj switch (Display) 7113446Smrj { 7123446Smrj case DB_BYTE_DISPLAY: 7133446Smrj default: /* Default is BYTE display */ 7143446Smrj 7157851SDana.Myers@Sun.COM AcpiOsPrintf ("%02X ", Buffer[(ACPI_SIZE) i + j]); 7163446Smrj break; 7173446Smrj 7183446Smrj 7193446Smrj case DB_WORD_DISPLAY: 7203446Smrj 7217851SDana.Myers@Sun.COM ACPI_MOVE_16_TO_32 (&Temp32, &Buffer[(ACPI_SIZE) i + j]); 7223446Smrj AcpiOsPrintf ("%04X ", Temp32); 7233446Smrj break; 7243446Smrj 7253446Smrj 7263446Smrj case DB_DWORD_DISPLAY: 7273446Smrj 7287851SDana.Myers@Sun.COM ACPI_MOVE_32_TO_32 (&Temp32, &Buffer[(ACPI_SIZE) i + j]); 7293446Smrj AcpiOsPrintf ("%08X ", Temp32); 7303446Smrj break; 7313446Smrj 7323446Smrj 7333446Smrj case DB_QWORD_DISPLAY: 7343446Smrj 7357851SDana.Myers@Sun.COM ACPI_MOVE_32_TO_32 (&Temp32, &Buffer[(ACPI_SIZE) i + j]); 7363446Smrj AcpiOsPrintf ("%08X", Temp32); 7373446Smrj 7387851SDana.Myers@Sun.COM ACPI_MOVE_32_TO_32 (&Temp32, &Buffer[(ACPI_SIZE) i + j + 4]); 7393446Smrj AcpiOsPrintf ("%08X ", Temp32); 7403446Smrj break; 7413446Smrj } 7423446Smrj 7437851SDana.Myers@Sun.COM j += Display; 7443446Smrj } 7453446Smrj 7463446Smrj /* 7473446Smrj * Print the ASCII equivalent characters but watch out for the bad 7483446Smrj * unprintable ones (printable chars are 0x20 through 0x7E) 7493446Smrj */ 7503446Smrj AcpiOsPrintf (" "); 7513446Smrj for (j = 0; j < 16; j++) 7523446Smrj { 7533446Smrj if (i + j >= Count) 7543446Smrj { 7553446Smrj AcpiOsPrintf ("\n"); 7563446Smrj return; 7573446Smrj } 7583446Smrj 7597851SDana.Myers@Sun.COM BufChar = Buffer[(ACPI_SIZE) i + j]; 7603446Smrj if (ACPI_IS_PRINT (BufChar)) 7613446Smrj { 7623446Smrj AcpiOsPrintf ("%c", BufChar); 7633446Smrj } 7643446Smrj else 7653446Smrj { 7663446Smrj AcpiOsPrintf ("."); 7673446Smrj } 7683446Smrj } 7693446Smrj 7703446Smrj /* Done with that line. */ 7713446Smrj 7723446Smrj AcpiOsPrintf ("\n"); 7733446Smrj i += 16; 7743446Smrj } 7753446Smrj 7763446Smrj return; 7773446Smrj } 7783446Smrj 7793446Smrj 7803446Smrj /******************************************************************************* 7813446Smrj * 7823446Smrj * FUNCTION: AcpiUtDumpBuffer 7833446Smrj * 7843446Smrj * PARAMETERS: Buffer - Buffer to dump 7853446Smrj * Count - Amount to dump, in bytes 7863446Smrj * Display - BYTE, WORD, DWORD, or QWORD display 7873446Smrj * ComponentID - Caller's component ID 7883446Smrj * 7893446Smrj * RETURN: None 7903446Smrj * 7913446Smrj * DESCRIPTION: Generic dump buffer in both hex and ascii. 7923446Smrj * 7933446Smrj ******************************************************************************/ 7943446Smrj 7953446Smrj void 7963446Smrj AcpiUtDumpBuffer ( 7973446Smrj UINT8 *Buffer, 7983446Smrj UINT32 Count, 7993446Smrj UINT32 Display, 8003446Smrj UINT32 ComponentId) 8013446Smrj { 8023446Smrj 8033446Smrj /* Only dump the buffer if tracing is enabled */ 8043446Smrj 8053446Smrj if (!((ACPI_LV_TABLES & AcpiDbgLevel) && 8063446Smrj (ComponentId & AcpiDbgLayer))) 8073446Smrj { 8083446Smrj return; 8093446Smrj } 8103446Smrj 8113446Smrj AcpiUtDumpBuffer2 (Buffer, Count, Display); 8123446Smrj } 8133446Smrj 8143446Smrj 815