utdebug.c revision 92388
1189747Ssam/****************************************************************************** 2189747Ssam * 3189747Ssam * Module Name: utdebug - Debug print routines 4189747Ssam * $Revision: 96 $ 5189747Ssam * 6189747Ssam *****************************************************************************/ 7189747Ssam 8189747Ssam/****************************************************************************** 9189747Ssam * 10189747Ssam * 1. Copyright Notice 11189747Ssam * 12189747Ssam * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp. 13189747Ssam * All rights reserved. 14189747Ssam * 15189747Ssam * 2. License 16189747Ssam * 17189747Ssam * 2.1. This is your license from Intel Corp. under its intellectual property 18189747Ssam * rights. You may have additional license terms from the party that provided 19189747Ssam * you this software, covering your right to use that party's intellectual 20189747Ssam * property rights. 21189747Ssam * 22189747Ssam * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a 23189747Ssam * copy of the source code appearing in this file ("Covered Code") an 24189747Ssam * irrevocable, perpetual, worldwide license under Intel's copyrights in the 25189747Ssam * base code distributed originally by Intel ("Original Intel Code") to copy, 26189747Ssam * make derivatives, distribute, use and display any portion of the Covered 27189747Ssam * Code in any form, with the right to sublicense such rights; and 28189747Ssam * 29189747Ssam * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent 30189747Ssam * license (with the right to sublicense), under only those claims of Intel 31189747Ssam * patents that are infringed by the Original Intel Code, to make, use, sell, 32189747Ssam * offer to sell, and import the Covered Code and derivative works thereof 33189747Ssam * solely to the minimum extent necessary to exercise the above copyright 34189747Ssam * license, and in no event shall the patent license extend to any additions 35189747Ssam * to or modifications of the Original Intel Code. No other license or right 36189747Ssam * is granted directly or by implication, estoppel or otherwise; 37189747Ssam * 38189747Ssam * The above copyright and patent license is granted only if the following 39189747Ssam * conditions are met: 40189747Ssam * 41189747Ssam * 3. Conditions 42189747Ssam * 43189747Ssam * 3.1. Redistribution of Source with Rights to Further Distribute Source. 44189747Ssam * Redistribution of source code of any substantial portion of the Covered 45189747Ssam * Code or modification with rights to further distribute source must include 46189747Ssam * the above Copyright Notice, the above License, this list of Conditions, 47189747Ssam * and the following Disclaimer and Export Compliance provision. In addition, 48189747Ssam * Licensee must cause all Covered Code to which Licensee contributes to 49189747Ssam * contain a file documenting the changes Licensee made to create that Covered 50189747Ssam * Code and the date of any change. Licensee must include in that file the 51189747Ssam * documentation of any changes made by any predecessor Licensee. Licensee 52189747Ssam * must include a prominent statement that the modification is derived, 53189747Ssam * directly or indirectly, from Original Intel Code. 54189747Ssam * 55189747Ssam * 3.2. Redistribution of Source with no Rights to Further Distribute Source. 56189747Ssam * Redistribution of source code of any substantial portion of the Covered 57189747Ssam * Code or modification without rights to further distribute source must 58189747Ssam * include the following Disclaimer and Export Compliance provision in the 59189747Ssam * documentation and/or other materials provided with distribution. In 60189747Ssam * addition, Licensee may not authorize further sublicense of source of any 61189747Ssam * portion of the Covered Code, and must include terms to the effect that the 62189747Ssam * license from Licensee to its licensee is limited to the intellectual 63189747Ssam * property embodied in the software Licensee provides to its licensee, and 64189747Ssam * not to intellectual property embodied in modifications its licensee may 65189747Ssam * make. 66189747Ssam * 67189747Ssam * 3.3. Redistribution of Executable. Redistribution in executable form of any 68189747Ssam * substantial portion of the Covered Code or modification must reproduce the 69189747Ssam * above Copyright Notice, and the following Disclaimer and Export Compliance 70189747Ssam * provision in the documentation and/or other materials provided with the 71189747Ssam * distribution. 72189747Ssam * 73189747Ssam * 3.4. Intel retains all right, title, and interest in and to the Original 74189747Ssam * Intel Code. 75189747Ssam * 76189747Ssam * 3.5. Neither the name Intel nor any other trademark owned or controlled by 77189747Ssam * Intel shall be used in advertising or otherwise to promote the sale, use or 78189747Ssam * other dealings in products derived from or relating to the Covered Code 79189747Ssam * without prior written authorization from Intel. 80189747Ssam * 81189747Ssam * 4. Disclaimer and Export Compliance 82189747Ssam * 83189747Ssam * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED 84189747Ssam * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE 85189747Ssam * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, 86189747Ssam * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY 87189747Ssam * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY 88189747Ssam * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A 89189747Ssam * PARTICULAR PURPOSE. 90189747Ssam * 91189747Ssam * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES 92189747Ssam * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR 93189747Ssam * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, 94189747Ssam * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY 95189747Ssam * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL 96189747Ssam * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS 97189747Ssam * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY 98189747Ssam * LIMITED REMEDY. 99189747Ssam * 100189747Ssam * 4.3. Licensee shall not export, either directly or indirectly, any of this 101189747Ssam * software or system incorporating such software without first obtaining any 102189747Ssam * required license or other approval from the U. S. Department of Commerce or 103189747Ssam * any other agency or department of the United States Government. In the 104189747Ssam * event Licensee exports any such software from the United States or 105189747Ssam * re-exports any such software from a foreign destination, Licensee shall 106189747Ssam * ensure that the distribution and export/re-export of the software is in 107189747Ssam * compliance with all laws, regulations, orders, or other restrictions of the 108189747Ssam * U.S. Export Administration Regulations. Licensee agrees that neither it nor 109189747Ssam * any of its subsidiaries will export/re-export any technical data, process, 110189747Ssam * software, or service, directly or indirectly, to any country for which the 111189747Ssam * United States government or any agency thereof requires an export license, 112189747Ssam * other governmental approval, or letter of assurance, without first obtaining 113189747Ssam * such license, approval or letter. 114189747Ssam * 115189747Ssam *****************************************************************************/ 116189747Ssam 117189747Ssam#define __UTDEBUG_C__ 118189747Ssam 119189747Ssam#include "acpi.h" 120189747Ssam 121189747Ssam#define _COMPONENT ACPI_UTILITIES 122189747Ssam ACPI_MODULE_NAME ("utdebug") 123189747Ssam 124189747Ssam 125189747SsamUINT32 AcpiGbl_PrevThreadId = 0xFFFFFFFF; 126189747Ssamchar *AcpiGbl_FnEntryStr = "----Entry"; 127189747Ssamchar *AcpiGbl_FnExitStr = "----Exit-"; 128189747Ssam 129189747Ssam 130189747Ssam#ifdef ACPI_DEBUG 131189747Ssam 132189747Ssam 133189747Ssam/***************************************************************************** 134189747Ssam * 135189747Ssam * FUNCTION: AcpiUtInitStackPtrTrace 136189747Ssam * 137189747Ssam * PARAMETERS: None 138189747Ssam * 139189747Ssam * RETURN: None 140189747Ssam * 141189747Ssam * DESCRIPTION: Save the current stack pointer 142189747Ssam * 143189747Ssam ****************************************************************************/ 144189747Ssam 145189747Ssamvoid 146189747SsamAcpiUtInitStackPtrTrace ( 147189747Ssam void) 148203882Srpaulo{ 149189747Ssam UINT32 CurrentSp; 150189747Ssam 151189747Ssam 152189747Ssam AcpiGbl_EntryStackPointer = ACPI_PTR_DIFF (&CurrentSp, NULL); 153189747Ssam} 154189747Ssam 155189747Ssam 156189747Ssam/***************************************************************************** 157189747Ssam * 158189747Ssam * FUNCTION: AcpiUtTrackStackPtr 159189747Ssam * 160189747Ssam * PARAMETERS: None 161189747Ssam * 162189747Ssam * RETURN: None 163203882Srpaulo * 164189747Ssam * DESCRIPTION: Save the current stack pointer 165189747Ssam * 166189747Ssam ****************************************************************************/ 167189747Ssam 168189747Ssamvoid 169189747SsamAcpiUtTrackStackPtr ( 170189747Ssam void) 171189747Ssam{ 172189747Ssam ACPI_SIZE CurrentSp; 173189747Ssam 174189747Ssam 175189747Ssam CurrentSp = ACPI_PTR_DIFF (&CurrentSp, NULL); 176189747Ssam 177189747Ssam if (CurrentSp < AcpiGbl_LowestStackPointer) 178189747Ssam { 179189747Ssam AcpiGbl_LowestStackPointer = CurrentSp; 180189747Ssam } 181189747Ssam 182189747Ssam if (AcpiGbl_NestingLevel > AcpiGbl_DeepestNesting) 183189747Ssam { 184189747Ssam AcpiGbl_DeepestNesting = AcpiGbl_NestingLevel; 185189747Ssam } 186189747Ssam} 187189747Ssam 188189747Ssam 189189747Ssam/***************************************************************************** 190189747Ssam * 191189747Ssam * FUNCTION: AcpiUtDebugPrint 192189747Ssam * 193189747Ssam * PARAMETERS: DebugLevel - Requested debug print level 194189747Ssam * ProcName - Caller's procedure name 195189747Ssam * ModuleName - Caller's module name (for error output) 196189747Ssam * LineNumber - Caller's line number (for error output) 197189747Ssam * ComponentId - Caller's component ID (for error output) 198189747Ssam * 199189747Ssam * Format - Printf format field 200189747Ssam * ... - Optional printf arguments 201189747Ssam * 202189747Ssam * RETURN: None 203189747Ssam * 204189747Ssam * DESCRIPTION: Print error message with prefix consisting of the module name, 205189747Ssam * line number, and component ID. 206189747Ssam * 207189747Ssam ****************************************************************************/ 208189747Ssam 209189747Ssamvoid ACPI_INTERNAL_VAR_XFACE 210189747SsamAcpiUtDebugPrint ( 211189747Ssam UINT32 RequestedDebugLevel, 212189747Ssam UINT32 LineNumber, 213189747Ssam ACPI_DEBUG_PRINT_INFO *DbgInfo, 214189747Ssam char *Format, 215189747Ssam ...) 216189747Ssam{ 217189747Ssam UINT32 ThreadId; 218189747Ssam va_list args; 219189747Ssam 220189747Ssam 221189747Ssam /* 222189747Ssam * Stay silent if the debug level or component ID is disabled 223189747Ssam */ 224189747Ssam if (!(RequestedDebugLevel & AcpiDbgLevel) || 225189747Ssam !(DbgInfo->ComponentId & AcpiDbgLayer)) 226189747Ssam { 227189747Ssam return; 228189747Ssam } 229189747Ssam 230189747Ssam 231189747Ssam /* 232189747Ssam * Thread tracking and context switch notification 233189747Ssam */ 234189747Ssam ThreadId = AcpiOsGetThreadId (); 235189747Ssam 236203882Srpaulo if (ThreadId != AcpiGbl_PrevThreadId) 237189747Ssam { 238189747Ssam if (ACPI_LV_THREADS & AcpiDbgLevel) 239189747Ssam { 240189747Ssam AcpiOsPrintf ("\n**** Context Switch from TID %X to TID %X ****\n\n", 241189747Ssam AcpiGbl_PrevThreadId, ThreadId); 242189747Ssam } 243189747Ssam 244189747Ssam AcpiGbl_PrevThreadId = ThreadId; 245189747Ssam } 246189747Ssam 247189747Ssam /* 248189747Ssam * Display the module name, current line number, thread ID (if requested), 249189747Ssam * current procedure nesting level, and the current procedure name 250189747Ssam */ 251189747Ssam AcpiOsPrintf ("%8s-%04d ", DbgInfo->ModuleName, LineNumber); 252189747Ssam 253189747Ssam if (ACPI_LV_THREADS & AcpiDbgLevel) 254189747Ssam { 255189747Ssam AcpiOsPrintf ("[%04X] ", ThreadId, AcpiGbl_NestingLevel, DbgInfo->ProcName); 256189747Ssam } 257189747Ssam 258189747Ssam AcpiOsPrintf ("[%02d] %-22.22s: ", AcpiGbl_NestingLevel, DbgInfo->ProcName); 259189747Ssam 260189747Ssam 261189747Ssam va_start (args, Format); 262189747Ssam AcpiOsVprintf (Format, args); 263189747Ssam} 264189747Ssam 265189747Ssam 266189747Ssam/***************************************************************************** 267189747Ssam * 268189747Ssam * FUNCTION: AcpiUtDebugPrintRaw 269189747Ssam * 270189747Ssam * PARAMETERS: RequestedDebugLevel - Requested debug print level 271189747Ssam * LineNumber - Caller's line number 272189747Ssam * DbgInfo - Contains: 273189747Ssam * ProcName - Caller's procedure name 274189747Ssam * ModuleName - Caller's module name 275189747Ssam * ComponentId - Caller's component ID 276189747Ssam * Format - Printf format field 277189747Ssam * ... - Optional printf arguments 278189747Ssam * 279189747Ssam * RETURN: None 280189747Ssam * 281189747Ssam * DESCRIPTION: Print message with no headers. Has same interface as 282203882Srpaulo * DebugPrint so that the same macros can be used. 283189747Ssam * 284189747Ssam ****************************************************************************/ 285189747Ssam 286189747Ssamvoid ACPI_INTERNAL_VAR_XFACE 287189747SsamAcpiUtDebugPrintRaw ( 288189747Ssam UINT32 RequestedDebugLevel, 289189747Ssam UINT32 LineNumber, 290189747Ssam ACPI_DEBUG_PRINT_INFO *DbgInfo, 291189747Ssam char *Format, 292189747Ssam ...) 293189747Ssam{ 294189747Ssam va_list args; 295189747Ssam 296189747Ssam 297189747Ssam if (!(RequestedDebugLevel & AcpiDbgLevel) || 298189747Ssam !(DbgInfo->ComponentId & AcpiDbgLayer)) 299189747Ssam { 300189747Ssam return; 301189747Ssam } 302203882Srpaulo 303189747Ssam va_start (args, Format); 304189747Ssam 305189747Ssam AcpiOsVprintf (Format, args); 306189747Ssam} 307189747Ssam 308189747Ssam 309189747Ssam/***************************************************************************** 310189747Ssam * 311189747Ssam * FUNCTION: AcpiUtTrace 312189747Ssam * 313189747Ssam * PARAMETERS: LineNumber - Caller's line number 314189747Ssam * DbgInfo - Contains: 315189747Ssam * ProcName - Caller's procedure name 316189747Ssam * ModuleName - Caller's module name 317189747Ssam * ComponentId - Caller's component ID 318189747Ssam * 319189747Ssam * RETURN: None 320189747Ssam * 321189747Ssam * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is 322189747Ssam * set in DebugLevel 323189747Ssam * 324189747Ssam ****************************************************************************/ 325189747Ssam 326189747Ssamvoid 327189747SsamAcpiUtTrace ( 328189747Ssam UINT32 LineNumber, 329189747Ssam ACPI_DEBUG_PRINT_INFO *DbgInfo) 330189747Ssam{ 331189747Ssam 332189747Ssam AcpiGbl_NestingLevel++; 333189747Ssam AcpiUtTrackStackPtr (); 334189747Ssam 335189747Ssam AcpiUtDebugPrint (ACPI_LV_FUNCTIONS, LineNumber, DbgInfo, 336189747Ssam "%s\n", AcpiGbl_FnEntryStr); 337189747Ssam} 338189747Ssam 339189747Ssam 340189747Ssam/***************************************************************************** 341189747Ssam * 342189747Ssam * FUNCTION: AcpiUtTracePtr 343189747Ssam * 344189747Ssam * PARAMETERS: LineNumber - Caller's line number 345189747Ssam * DbgInfo - Contains: 346189747Ssam * ProcName - Caller's procedure name 347189747Ssam * ModuleName - Caller's module name 348189747Ssam * ComponentId - Caller's component ID 349189747Ssam * Pointer - Pointer to display 350189747Ssam * 351189747Ssam * RETURN: None 352189747Ssam * 353189747Ssam * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is 354189747Ssam * set in DebugLevel 355189747Ssam * 356189747Ssam ****************************************************************************/ 357189747Ssam 358189747Ssamvoid 359189747SsamAcpiUtTracePtr ( 360189747Ssam UINT32 LineNumber, 361203930Srpaulo ACPI_DEBUG_PRINT_INFO *DbgInfo, 362189747Ssam void *Pointer) 363189747Ssam{ 364189747Ssam AcpiGbl_NestingLevel++; 365189747Ssam AcpiUtTrackStackPtr (); 366189747Ssam 367189747Ssam AcpiUtDebugPrint (ACPI_LV_FUNCTIONS, LineNumber, DbgInfo, 368189747Ssam "%s %p\n", AcpiGbl_FnEntryStr, Pointer); 369189747Ssam} 370189747Ssam 371189747Ssam 372189747Ssam/***************************************************************************** 373189747Ssam * 374189747Ssam * FUNCTION: AcpiUtTraceStr 375189747Ssam * 376189747Ssam * PARAMETERS: LineNumber - Caller's line number 377189747Ssam * DbgInfo - Contains: 378189747Ssam * ProcName - Caller's procedure name 379189747Ssam * ModuleName - Caller's module name 380189747Ssam * ComponentId - Caller's component ID 381189747Ssam * String - Additional string to display 382189747Ssam * 383189747Ssam * RETURN: None 384189747Ssam * 385189747Ssam * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is 386189747Ssam * set in DebugLevel 387189747Ssam * 388189747Ssam ****************************************************************************/ 389189747Ssam 390189747Ssamvoid 391189747SsamAcpiUtTraceStr ( 392189747Ssam UINT32 LineNumber, 393189747Ssam ACPI_DEBUG_PRINT_INFO *DbgInfo, 394189747Ssam NATIVE_CHAR *String) 395189747Ssam{ 396189747Ssam 397189747Ssam AcpiGbl_NestingLevel++; 398189747Ssam AcpiUtTrackStackPtr (); 399189747Ssam 400189747Ssam AcpiUtDebugPrint (ACPI_LV_FUNCTIONS, LineNumber, DbgInfo, 401189747Ssam "%s %s\n", AcpiGbl_FnEntryStr, String); 402189747Ssam} 403189747Ssam 404189747Ssam 405189747Ssam/***************************************************************************** 406189747Ssam * 407189747Ssam * FUNCTION: AcpiUtTraceU32 408189747Ssam * 409189747Ssam * PARAMETERS: LineNumber - Caller's line number 410189747Ssam * DbgInfo - Contains: 411189747Ssam * ProcName - Caller's procedure name 412189747Ssam * ModuleName - Caller's module name 413189747Ssam * ComponentId - Caller's component ID 414189747Ssam * Integer - Integer to display 415189747Ssam * 416189747Ssam * RETURN: None 417189747Ssam * 418189747Ssam * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is 419189747Ssam * set in DebugLevel 420189747Ssam * 421189747Ssam ****************************************************************************/ 422189747Ssam 423189747Ssamvoid 424189747SsamAcpiUtTraceU32 ( 425189747Ssam UINT32 LineNumber, 426189747Ssam ACPI_DEBUG_PRINT_INFO *DbgInfo, 427189747Ssam UINT32 Integer) 428189747Ssam{ 429189747Ssam 430189747Ssam AcpiGbl_NestingLevel++; 431189747Ssam AcpiUtTrackStackPtr (); 432189747Ssam 433189747Ssam AcpiUtDebugPrint (ACPI_LV_FUNCTIONS, LineNumber, DbgInfo, 434189747Ssam "%s %08X\n", AcpiGbl_FnEntryStr, Integer); 435189747Ssam} 436189747Ssam 437189747Ssam 438189747Ssam/***************************************************************************** 439189747Ssam * 440189747Ssam * FUNCTION: AcpiUtExit 441189747Ssam * 442189747Ssam * PARAMETERS: LineNumber - Caller's line number 443189747Ssam * DbgInfo - Contains: 444189747Ssam * ProcName - Caller's procedure name 445189747Ssam * ModuleName - Caller's module name 446189747Ssam * ComponentId - Caller's component ID 447189747Ssam * 448189747Ssam * RETURN: None 449189747Ssam * 450189747Ssam * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is 451189747Ssam * set in DebugLevel 452189747Ssam * 453189747Ssam ****************************************************************************/ 454189747Ssam 455189747Ssamvoid 456189747SsamAcpiUtExit ( 457189747Ssam UINT32 LineNumber, 458189747Ssam ACPI_DEBUG_PRINT_INFO *DbgInfo) 459189747Ssam{ 460189747Ssam 461189747Ssam AcpiUtDebugPrint (ACPI_LV_FUNCTIONS, LineNumber, DbgInfo, 462189747Ssam "%s\n", AcpiGbl_FnExitStr); 463189747Ssam 464189747Ssam AcpiGbl_NestingLevel--; 465189747Ssam} 466189747Ssam 467189747Ssam 468189747Ssam/***************************************************************************** 469189747Ssam * 470189747Ssam * FUNCTION: AcpiUtStatusExit 471189747Ssam * 472189747Ssam * PARAMETERS: LineNumber - Caller's line number 473189747Ssam * DbgInfo - Contains: 474189747Ssam * ProcName - Caller's procedure name 475189747Ssam * ModuleName - Caller's module name 476189747Ssam * ComponentId - Caller's component ID 477189747Ssam * Status - Exit status code 478189747Ssam * 479189747Ssam * RETURN: None 480189747Ssam * 481189747Ssam * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is 482189747Ssam * set in DebugLevel. Prints exit status also. 483189747Ssam * 484189747Ssam ****************************************************************************/ 485189747Ssam 486189747Ssamvoid 487189747SsamAcpiUtStatusExit ( 488189747Ssam UINT32 LineNumber, 489189747Ssam ACPI_DEBUG_PRINT_INFO *DbgInfo, 490189747Ssam ACPI_STATUS Status) 491189747Ssam{ 492189747Ssam 493189747Ssam if (ACPI_SUCCESS (Status)) 494189747Ssam { 495189747Ssam AcpiUtDebugPrint (ACPI_LV_FUNCTIONS, LineNumber, DbgInfo, 496189747Ssam "%s %s\n", AcpiGbl_FnExitStr, 497189747Ssam AcpiFormatException (Status)); 498189747Ssam } 499189747Ssam else 500189747Ssam { 501189747Ssam AcpiUtDebugPrint (ACPI_LV_FUNCTIONS, LineNumber, DbgInfo, 502189747Ssam "%s ****Exception****: %s\n", AcpiGbl_FnExitStr, 503189747Ssam AcpiFormatException (Status)); 504189747Ssam } 505189747Ssam 506189747Ssam AcpiGbl_NestingLevel--; 507189747Ssam} 508189747Ssam 509189747Ssam 510189747Ssam/***************************************************************************** 511189747Ssam * 512189747Ssam * FUNCTION: AcpiUtValueExit 513189747Ssam * 514189747Ssam * PARAMETERS: LineNumber - Caller's line number 515189747Ssam * DbgInfo - Contains: 516189747Ssam * ProcName - Caller's procedure name 517189747Ssam * ModuleName - Caller's module name 518189747Ssam * ComponentId - Caller's component ID 519189747Ssam * Value - Value to be printed with exit msg 520189747Ssam * 521189747Ssam * RETURN: None 522189747Ssam * 523189747Ssam * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is 524189747Ssam * set in DebugLevel. Prints exit value also. 525189747Ssam * 526189747Ssam ****************************************************************************/ 527189747Ssam 528189747Ssamvoid 529189747SsamAcpiUtValueExit ( 530189747Ssam UINT32 LineNumber, 531189747Ssam ACPI_DEBUG_PRINT_INFO *DbgInfo, 532189747Ssam ACPI_INTEGER Value) 533189747Ssam{ 534189747Ssam 535189747Ssam AcpiUtDebugPrint (ACPI_LV_FUNCTIONS, LineNumber, DbgInfo, 536189747Ssam "%s %8.8X%8.8X\n", AcpiGbl_FnExitStr, 537189747Ssam ACPI_HIDWORD (Value), ACPI_LODWORD (Value)); 538189747Ssam 539189747Ssam AcpiGbl_NestingLevel--; 540189747Ssam} 541189747Ssam 542189747Ssam 543189747Ssam/***************************************************************************** 544189747Ssam * 545189747Ssam * FUNCTION: AcpiUtPtrExit 546189747Ssam * 547189747Ssam * PARAMETERS: LineNumber - Caller's line number 548189747Ssam * DbgInfo - Contains: 549189747Ssam * ProcName - Caller's procedure name 550189747Ssam * ModuleName - Caller's module name 551189747Ssam * ComponentId - Caller's component ID 552189747Ssam * Value - Value to be printed with exit msg 553189747Ssam * 554189747Ssam * RETURN: None 555189747Ssam * 556189747Ssam * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is 557189747Ssam * set in DebugLevel. Prints exit value also. 558189747Ssam * 559189747Ssam ****************************************************************************/ 560189747Ssam 561189747Ssamvoid 562189747SsamAcpiUtPtrExit ( 563189747Ssam UINT32 LineNumber, 564189747Ssam ACPI_DEBUG_PRINT_INFO *DbgInfo, 565189747Ssam UINT8 *Ptr) 566189747Ssam{ 567189747Ssam 568189747Ssam AcpiUtDebugPrint (ACPI_LV_FUNCTIONS, LineNumber, DbgInfo, 569189747Ssam "%s %p\n", AcpiGbl_FnExitStr, Ptr); 570189747Ssam 571189747Ssam AcpiGbl_NestingLevel--; 572189747Ssam} 573189747Ssam 574189747Ssam#endif 575189747Ssam 576189747Ssam 577189747Ssam/***************************************************************************** 578189747Ssam * 579189747Ssam * FUNCTION: AcpiUtDumpBuffer 580189747Ssam * 581189747Ssam * PARAMETERS: Buffer - Buffer to dump 582189747Ssam * Count - Amount to dump, in bytes 583189747Ssam * Display - BYTE, WORD, DWORD, or QWORD display 584189747Ssam * ComponentID - Caller's component ID 585189747Ssam * 586189747Ssam * RETURN: None 587189747Ssam * 588189747Ssam * DESCRIPTION: Generic dump buffer in both hex and ascii. 589189747Ssam * 590189747Ssam ****************************************************************************/ 591189747Ssam 592189747Ssamvoid 593189747SsamAcpiUtDumpBuffer ( 594189747Ssam UINT8 *Buffer, 595189747Ssam UINT32 Count, 596189747Ssam UINT32 Display, 597189747Ssam UINT32 ComponentId) 598189747Ssam{ 599189747Ssam UINT32 i = 0; 600189747Ssam UINT32 j; 601189747Ssam UINT32 Temp32; 602189747Ssam UINT8 BufChar; 603189747Ssam 604189747Ssam 605189747Ssam /* Only dump the buffer if tracing is enabled */ 606189747Ssam 607189747Ssam if (!((ACPI_LV_TABLES & AcpiDbgLevel) && 608189747Ssam (ComponentId & AcpiDbgLayer))) 609189747Ssam { 610189747Ssam return; 611189747Ssam } 612189747Ssam 613189747Ssam 614189747Ssam /* 615189747Ssam * Nasty little dump buffer routine! 616189747Ssam */ 617189747Ssam while (i < Count) 618189747Ssam { 619189747Ssam /* Print current offset */ 620189747Ssam 621189747Ssam AcpiOsPrintf ("%05X ", i); 622189747Ssam 623189747Ssam 624189747Ssam /* Print 16 hex chars */ 625189747Ssam 626189747Ssam for (j = 0; j < 16;) 627189747Ssam { 628189747Ssam if (i + j >= Count) 629189747Ssam { 630189747Ssam AcpiOsPrintf ("\n"); 631189747Ssam return; 632189747Ssam } 633189747Ssam 634189747Ssam /* Make sure that the INT8 doesn't get sign-extended! */ 635189747Ssam 636189747Ssam switch (Display) 637189747Ssam { 638189747Ssam /* Default is BYTE display */ 639189747Ssam 640189747Ssam default: 641189747Ssam 642189747Ssam AcpiOsPrintf ("%02X ", 643189747Ssam *((UINT8 *) &Buffer[i + j])); 644189747Ssam j += 1; 645189747Ssam break; 646189747Ssam 647189747Ssam 648189747Ssam case DB_WORD_DISPLAY: 649189747Ssam 650189747Ssam ACPI_MOVE_UNALIGNED16_TO_32 (&Temp32, 651189747Ssam &Buffer[i + j]); 652189747Ssam AcpiOsPrintf ("%04X ", Temp32); 653189747Ssam j += 2; 654189747Ssam break; 655189747Ssam 656189747Ssam 657189747Ssam case DB_DWORD_DISPLAY: 658189747Ssam 659189747Ssam ACPI_MOVE_UNALIGNED32_TO_32 (&Temp32, 660189747Ssam &Buffer[i + j]); 661189747Ssam AcpiOsPrintf ("%08X ", Temp32); 662189747Ssam j += 4; 663189747Ssam break; 664189747Ssam 665189747Ssam 666189747Ssam case DB_QWORD_DISPLAY: 667189747Ssam 668189747Ssam ACPI_MOVE_UNALIGNED32_TO_32 (&Temp32, 669189747Ssam &Buffer[i + j]); 670189747Ssam AcpiOsPrintf ("%08X", Temp32); 671203882Srpaulo 672189747Ssam ACPI_MOVE_UNALIGNED32_TO_32 (&Temp32, 673189747Ssam &Buffer[i + j + 4]); 674189747Ssam AcpiOsPrintf ("%08X ", Temp32); 675189747Ssam j += 8; 676189747Ssam break; 677189747Ssam } 678189747Ssam } 679189747Ssam 680189747Ssam 681189747Ssam /* 682189747Ssam * Print the ASCII equivalent characters 683189747Ssam * But watch out for the bad unprintable ones... 684189747Ssam */ 685189747Ssam 686189747Ssam for (j = 0; j < 16; j++) 687189747Ssam { 688189747Ssam if (i + j >= Count) 689189747Ssam { 690189747Ssam AcpiOsPrintf ("\n"); 691189747Ssam return; 692189747Ssam } 693189747Ssam 694189747Ssam BufChar = Buffer[i + j]; 695189747Ssam if ((BufChar > 0x1F && BufChar < 0x2E) || 696189747Ssam (BufChar > 0x2F && BufChar < 0x61) || 697189747Ssam (BufChar > 0x60 && BufChar < 0x7F)) 698189747Ssam { 699189747Ssam AcpiOsPrintf ("%c", BufChar); 700189747Ssam } 701189747Ssam else 702189747Ssam { 703189747Ssam AcpiOsPrintf ("."); 704189747Ssam } 705189747Ssam } 706189747Ssam 707189747Ssam /* Done with that line. */ 708189747Ssam 709189747Ssam AcpiOsPrintf ("\n"); 710189747Ssam i += 16; 711189747Ssam } 712189747Ssam 713189747Ssam return; 714189747Ssam} 715189747Ssam 716189747Ssam