ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

utdebug.c
Go to the documentation of this file.
00001 /******************************************************************************
00002  *
00003  * Module Name: utdebug - Debug print routines
00004  *
00005  *****************************************************************************/
00006 
00007 /******************************************************************************
00008  *
00009  * 1. Copyright Notice
00010  *
00011  * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
00012  * All rights reserved.
00013  *
00014  * 2. License
00015  *
00016  * 2.1. This is your license from Intel Corp. under its intellectual property
00017  * rights.  You may have additional license terms from the party that provided
00018  * you this software, covering your right to use that party's intellectual
00019  * property rights.
00020  *
00021  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
00022  * copy of the source code appearing in this file ("Covered Code") an
00023  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
00024  * base code distributed originally by Intel ("Original Intel Code") to copy,
00025  * make derivatives, distribute, use and display any portion of the Covered
00026  * Code in any form, with the right to sublicense such rights; and
00027  *
00028  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
00029  * license (with the right to sublicense), under only those claims of Intel
00030  * patents that are infringed by the Original Intel Code, to make, use, sell,
00031  * offer to sell, and import the Covered Code and derivative works thereof
00032  * solely to the minimum extent necessary to exercise the above copyright
00033  * license, and in no event shall the patent license extend to any additions
00034  * to or modifications of the Original Intel Code.  No other license or right
00035  * is granted directly or by implication, estoppel or otherwise;
00036  *
00037  * The above copyright and patent license is granted only if the following
00038  * conditions are met:
00039  *
00040  * 3. Conditions
00041  *
00042  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
00043  * Redistribution of source code of any substantial portion of the Covered
00044  * Code or modification with rights to further distribute source must include
00045  * the above Copyright Notice, the above License, this list of Conditions,
00046  * and the following Disclaimer and Export Compliance provision.  In addition,
00047  * Licensee must cause all Covered Code to which Licensee contributes to
00048  * contain a file documenting the changes Licensee made to create that Covered
00049  * Code and the date of any change.  Licensee must include in that file the
00050  * documentation of any changes made by any predecessor Licensee.  Licensee
00051  * must include a prominent statement that the modification is derived,
00052  * directly or indirectly, from Original Intel Code.
00053  *
00054  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
00055  * Redistribution of source code of any substantial portion of the Covered
00056  * Code or modification without rights to further distribute source must
00057  * include the following Disclaimer and Export Compliance provision in the
00058  * documentation and/or other materials provided with distribution.  In
00059  * addition, Licensee may not authorize further sublicense of source of any
00060  * portion of the Covered Code, and must include terms to the effect that the
00061  * license from Licensee to its licensee is limited to the intellectual
00062  * property embodied in the software Licensee provides to its licensee, and
00063  * not to intellectual property embodied in modifications its licensee may
00064  * make.
00065  *
00066  * 3.3. Redistribution of Executable. Redistribution in executable form of any
00067  * substantial portion of the Covered Code or modification must reproduce the
00068  * above Copyright Notice, and the following Disclaimer and Export Compliance
00069  * provision in the documentation and/or other materials provided with the
00070  * distribution.
00071  *
00072  * 3.4. Intel retains all right, title, and interest in and to the Original
00073  * Intel Code.
00074  *
00075  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
00076  * Intel shall be used in advertising or otherwise to promote the sale, use or
00077  * other dealings in products derived from or relating to the Covered Code
00078  * without prior written authorization from Intel.
00079  *
00080  * 4. Disclaimer and Export Compliance
00081  *
00082  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
00083  * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
00084  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
00085  * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
00086  * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
00087  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
00088  * PARTICULAR PURPOSE.
00089  *
00090  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
00091  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
00092  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
00093  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
00094  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
00095  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
00096  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
00097  * LIMITED REMEDY.
00098  *
00099  * 4.3. Licensee shall not export, either directly or indirectly, any of this
00100  * software or system incorporating such software without first obtaining any
00101  * required license or other approval from the U. S. Department of Commerce or
00102  * any other agency or department of the United States Government.  In the
00103  * event Licensee exports any such software from the United States or
00104  * re-exports any such software from a foreign destination, Licensee shall
00105  * ensure that the distribution and export/re-export of the software is in
00106  * compliance with all laws, regulations, orders, or other restrictions of the
00107  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
00108  * any of its subsidiaries will export/re-export any technical data, process,
00109  * software, or service, directly or indirectly, to any country for which the
00110  * United States government or any agency thereof requires an export license,
00111  * other governmental approval, or letter of assurance, without first obtaining
00112  * such license, approval or letter.
00113  *
00114  *****************************************************************************/
00115 
00116 #define __UTDEBUG_C__
00117 
00118 #include "acpi.h"
00119 #include "accommon.h"
00120 
00121 #define _COMPONENT          ACPI_UTILITIES
00122         ACPI_MODULE_NAME    ("utdebug")
00123 
00124 
00125 #ifdef ACPI_DEBUG_OUTPUT
00126 
00127 static ACPI_THREAD_ID       AcpiGbl_PrevThreadId = (ACPI_THREAD_ID) 0xFFFFFFFF;
00128 static char                 *AcpiGbl_FnEntryStr = "----Entry";
00129 static char                 *AcpiGbl_FnExitStr  = "----Exit-";
00130 
00131 /* Local prototypes */
00132 
00133 static const char *
00134 AcpiUtTrimFunctionName (
00135     const char              *FunctionName);
00136 
00137 
00138 /*******************************************************************************
00139  *
00140  * FUNCTION:    AcpiUtInitStackPtrTrace
00141  *
00142  * PARAMETERS:  None
00143  *
00144  * RETURN:      None
00145  *
00146  * DESCRIPTION: Save the current CPU stack pointer at subsystem startup
00147  *
00148  ******************************************************************************/
00149 
00150 void
00151 AcpiUtInitStackPtrTrace (
00152     void)
00153 {
00154     ACPI_SIZE               CurrentSp;
00155 
00156 
00157     AcpiGbl_EntryStackPointer = &CurrentSp;
00158 }
00159 
00160 
00161 /*******************************************************************************
00162  *
00163  * FUNCTION:    AcpiUtTrackStackPtr
00164  *
00165  * PARAMETERS:  None
00166  *
00167  * RETURN:      None
00168  *
00169  * DESCRIPTION: Save the current CPU stack pointer
00170  *
00171  ******************************************************************************/
00172 
00173 void
00174 AcpiUtTrackStackPtr (
00175     void)
00176 {
00177     ACPI_SIZE               CurrentSp;
00178 
00179 
00180     if (&CurrentSp < AcpiGbl_LowestStackPointer)
00181     {
00182         AcpiGbl_LowestStackPointer = &CurrentSp;
00183     }
00184 
00185     if (AcpiGbl_NestingLevel > AcpiGbl_DeepestNesting)
00186     {
00187         AcpiGbl_DeepestNesting = AcpiGbl_NestingLevel;
00188     }
00189 }
00190 
00191 
00192 /*******************************************************************************
00193  *
00194  * FUNCTION:    AcpiUtTrimFunctionName
00195  *
00196  * PARAMETERS:  FunctionName        - Ascii string containing a procedure name
00197  *
00198  * RETURN:      Updated pointer to the function name
00199  *
00200  * DESCRIPTION: Remove the "Acpi" prefix from the function name, if present.
00201  *              This allows compiler macros such as __FUNCTION__ to be used
00202  *              with no change to the debug output.
00203  *
00204  ******************************************************************************/
00205 
00206 static const char *
00207 AcpiUtTrimFunctionName (
00208     const char              *FunctionName)
00209 {
00210 
00211     /* All Function names are longer than 4 chars, check is safe */
00212 
00213     if (*(ACPI_CAST_PTR (UINT32, FunctionName)) == ACPI_PREFIX_MIXED)
00214     {
00215         /* This is the case where the original source has not been modified */
00216 
00217         return (FunctionName + 4);
00218     }
00219 
00220     if (*(ACPI_CAST_PTR (UINT32, FunctionName)) == ACPI_PREFIX_LOWER)
00221     {
00222         /* This is the case where the source has been 'linuxized' */
00223 
00224         return (FunctionName + 5);
00225     }
00226 
00227     return (FunctionName);
00228 }
00229 
00230 
00231 /*******************************************************************************
00232  *
00233  * FUNCTION:    AcpiDebugPrint
00234  *
00235  * PARAMETERS:  RequestedDebugLevel - Requested debug print level
00236  *              LineNumber          - Caller's line number (for error output)
00237  *              FunctionName        - Caller's procedure name
00238  *              ModuleName          - Caller's module name
00239  *              ComponentId         - Caller's component ID
00240  *              Format              - Printf format field
00241  *              ...                 - Optional printf arguments
00242  *
00243  * RETURN:      None
00244  *
00245  * DESCRIPTION: Print error message with prefix consisting of the module name,
00246  *              line number, and component ID.
00247  *
00248  ******************************************************************************/
00249 
00250 void  ACPI_INTERNAL_VAR_XFACE
00251 AcpiDebugPrint (
00252     UINT32                  RequestedDebugLevel,
00253     UINT32                  LineNumber,
00254     const char              *FunctionName,
00255     const char              *ModuleName,
00256     UINT32                  ComponentId,
00257     const char              *Format,
00258     ...)
00259 {
00260     ACPI_THREAD_ID          ThreadId;
00261     va_list                 args;
00262 
00263 
00264     /*
00265      * Stay silent if the debug level or component ID is disabled
00266      */
00267     if (!(RequestedDebugLevel & AcpiDbgLevel) ||
00268         !(ComponentId & AcpiDbgLayer))
00269     {
00270         return;
00271     }
00272 
00273     /*
00274      * Thread tracking and context switch notification
00275      */
00276     ThreadId = AcpiOsGetThreadId ();
00277     if (ThreadId != AcpiGbl_PrevThreadId)
00278     {
00279         if (ACPI_LV_THREADS & AcpiDbgLevel)
00280         {
00281             AcpiOsPrintf (
00282                 "\n**** Context Switch from TID %u to TID %u ****\n\n",
00283                 (UINT32) AcpiGbl_PrevThreadId, (UINT32) ThreadId);
00284         }
00285 
00286         AcpiGbl_PrevThreadId = ThreadId;
00287     }
00288 
00289     /*
00290      * Display the module name, current line number, thread ID (if requested),
00291      * current procedure nesting level, and the current procedure name
00292      */
00293     AcpiOsPrintf ("%8s-%04ld ", ModuleName, LineNumber);
00294 
00295     if (ACPI_LV_THREADS & AcpiDbgLevel)
00296     {
00297         AcpiOsPrintf ("[%u] ", (UINT32) ThreadId);
00298     }
00299 
00300     AcpiOsPrintf ("[%02ld] %-22.22s: ",
00301         AcpiGbl_NestingLevel, AcpiUtTrimFunctionName (FunctionName));
00302 
00303     va_start (args, Format);
00304     AcpiOsVprintf (Format, args);
00305     va_end (args);
00306 }
00307 
00308 ACPI_EXPORT_SYMBOL (AcpiDebugPrint)
00309 
00310 
00311 /*******************************************************************************
00312  *
00313  * FUNCTION:    AcpiDebugPrintRaw
00314  *
00315  * PARAMETERS:  RequestedDebugLevel - Requested debug print level
00316  *              LineNumber          - Caller's line number
00317  *              FunctionName        - Caller's procedure name
00318  *              ModuleName          - Caller's module name
00319  *              ComponentId         - Caller's component ID
00320  *              Format              - Printf format field
00321  *              ...                 - Optional printf arguments
00322  *
00323  * RETURN:      None
00324  *
00325  * DESCRIPTION: Print message with no headers.  Has same interface as
00326  *              DebugPrint so that the same macros can be used.
00327  *
00328  ******************************************************************************/
00329 
00330 void  ACPI_INTERNAL_VAR_XFACE
00331 AcpiDebugPrintRaw (
00332     UINT32                  RequestedDebugLevel,
00333     UINT32                  LineNumber,
00334     const char              *FunctionName,
00335     const char              *ModuleName,
00336     UINT32                  ComponentId,
00337     const char              *Format,
00338     ...)
00339 {
00340     va_list                 args;
00341 
00342 
00343     if (!(RequestedDebugLevel & AcpiDbgLevel) ||
00344         !(ComponentId & AcpiDbgLayer))
00345     {
00346         return;
00347     }
00348 
00349     va_start (args, Format);
00350     AcpiOsVprintf (Format, args);
00351     va_end (args);
00352 }
00353 
00354 ACPI_EXPORT_SYMBOL (AcpiDebugPrintRaw)
00355 
00356 
00357 /*******************************************************************************
00358  *
00359  * FUNCTION:    AcpiUtTrace
00360  *
00361  * PARAMETERS:  LineNumber          - Caller's line number
00362  *              FunctionName        - Caller's procedure name
00363  *              ModuleName          - Caller's module name
00364  *              ComponentId         - Caller's component ID
00365  *
00366  * RETURN:      None
00367  *
00368  * DESCRIPTION: Function entry trace.  Prints only if TRACE_FUNCTIONS bit is
00369  *              set in DebugLevel
00370  *
00371  ******************************************************************************/
00372 
00373 void
00374 AcpiUtTrace (
00375     UINT32                  LineNumber,
00376     const char              *FunctionName,
00377     const char              *ModuleName,
00378     UINT32                  ComponentId)
00379 {
00380 
00381     AcpiGbl_NestingLevel++;
00382     AcpiUtTrackStackPtr ();
00383 
00384     AcpiDebugPrint (ACPI_LV_FUNCTIONS,
00385         LineNumber, FunctionName, ModuleName, ComponentId,
00386         "%s\n", AcpiGbl_FnEntryStr);
00387 }
00388 
00389 ACPI_EXPORT_SYMBOL (AcpiUtTrace)
00390 
00391 
00392 /*******************************************************************************
00393  *
00394  * FUNCTION:    AcpiUtTracePtr
00395  *
00396  * PARAMETERS:  LineNumber          - Caller's line number
00397  *              FunctionName        - Caller's procedure name
00398  *              ModuleName          - Caller's module name
00399  *              ComponentId         - Caller's component ID
00400  *              Pointer             - Pointer to display
00401  *
00402  * RETURN:      None
00403  *
00404  * DESCRIPTION: Function entry trace.  Prints only if TRACE_FUNCTIONS bit is
00405  *              set in DebugLevel
00406  *
00407  ******************************************************************************/
00408 
00409 void
00410 AcpiUtTracePtr (
00411     UINT32                  LineNumber,
00412     const char              *FunctionName,
00413     const char              *ModuleName,
00414     UINT32                  ComponentId,
00415     void                    *Pointer)
00416 {
00417     AcpiGbl_NestingLevel++;
00418     AcpiUtTrackStackPtr ();
00419 
00420     AcpiDebugPrint (ACPI_LV_FUNCTIONS,
00421         LineNumber, FunctionName, ModuleName, ComponentId,
00422         "%s %p\n", AcpiGbl_FnEntryStr, Pointer);
00423 }
00424 
00425 
00426 /*******************************************************************************
00427  *
00428  * FUNCTION:    AcpiUtTraceStr
00429  *
00430  * PARAMETERS:  LineNumber          - Caller's line number
00431  *              FunctionName        - Caller's procedure name
00432  *              ModuleName          - Caller's module name
00433  *              ComponentId         - Caller's component ID
00434  *              String              - Additional string to display
00435  *
00436  * RETURN:      None
00437  *
00438  * DESCRIPTION: Function entry trace.  Prints only if TRACE_FUNCTIONS bit is
00439  *              set in DebugLevel
00440  *
00441  ******************************************************************************/
00442 
00443 void
00444 AcpiUtTraceStr (
00445     UINT32                  LineNumber,
00446     const char              *FunctionName,
00447     const char              *ModuleName,
00448     UINT32                  ComponentId,
00449     char                    *String)
00450 {
00451 
00452     AcpiGbl_NestingLevel++;
00453     AcpiUtTrackStackPtr ();
00454 
00455     AcpiDebugPrint (ACPI_LV_FUNCTIONS,
00456         LineNumber, FunctionName, ModuleName, ComponentId,
00457         "%s %s\n", AcpiGbl_FnEntryStr, String);
00458 }
00459 
00460 
00461 /*******************************************************************************
00462  *
00463  * FUNCTION:    AcpiUtTraceU32
00464  *
00465  * PARAMETERS:  LineNumber          - Caller's line number
00466  *              FunctionName        - Caller's procedure name
00467  *              ModuleName          - Caller's module name
00468  *              ComponentId         - Caller's component ID
00469  *              Integer             - Integer to display
00470  *
00471  * RETURN:      None
00472  *
00473  * DESCRIPTION: Function entry trace.  Prints only if TRACE_FUNCTIONS bit is
00474  *              set in DebugLevel
00475  *
00476  ******************************************************************************/
00477 
00478 void
00479 AcpiUtTraceU32 (
00480     UINT32                  LineNumber,
00481     const char              *FunctionName,
00482     const char              *ModuleName,
00483     UINT32                  ComponentId,
00484     UINT32                  Integer)
00485 {
00486 
00487     AcpiGbl_NestingLevel++;
00488     AcpiUtTrackStackPtr ();
00489 
00490     AcpiDebugPrint (ACPI_LV_FUNCTIONS,
00491         LineNumber, FunctionName, ModuleName, ComponentId,
00492         "%s %08X\n", AcpiGbl_FnEntryStr, Integer);
00493 }
00494 
00495 
00496 /*******************************************************************************
00497  *
00498  * FUNCTION:    AcpiUtExit
00499  *
00500  * PARAMETERS:  LineNumber          - Caller's line number
00501  *              FunctionName        - Caller's procedure name
00502  *              ModuleName          - Caller's module name
00503  *              ComponentId         - Caller's component ID
00504  *
00505  * RETURN:      None
00506  *
00507  * DESCRIPTION: Function exit trace.  Prints only if TRACE_FUNCTIONS bit is
00508  *              set in DebugLevel
00509  *
00510  ******************************************************************************/
00511 
00512 void
00513 AcpiUtExit (
00514     UINT32                  LineNumber,
00515     const char              *FunctionName,
00516     const char              *ModuleName,
00517     UINT32                  ComponentId)
00518 {
00519 
00520     AcpiDebugPrint (ACPI_LV_FUNCTIONS,
00521         LineNumber, FunctionName, ModuleName, ComponentId,
00522         "%s\n", AcpiGbl_FnExitStr);
00523 
00524     AcpiGbl_NestingLevel--;
00525 }
00526 
00527 ACPI_EXPORT_SYMBOL (AcpiUtExit)
00528 
00529 
00530 /*******************************************************************************
00531  *
00532  * FUNCTION:    AcpiUtStatusExit
00533  *
00534  * PARAMETERS:  LineNumber          - Caller's line number
00535  *              FunctionName        - Caller's procedure name
00536  *              ModuleName          - Caller's module name
00537  *              ComponentId         - Caller's component ID
00538  *              Status              - Exit status code
00539  *
00540  * RETURN:      None
00541  *
00542  * DESCRIPTION: Function exit trace.  Prints only if TRACE_FUNCTIONS bit is
00543  *              set in DebugLevel.  Prints exit status also.
00544  *
00545  ******************************************************************************/
00546 
00547 void
00548 AcpiUtStatusExit (
00549     UINT32                  LineNumber,
00550     const char              *FunctionName,
00551     const char              *ModuleName,
00552     UINT32                  ComponentId,
00553     ACPI_STATUS             Status)
00554 {
00555 
00556     if (ACPI_SUCCESS (Status))
00557     {
00558         AcpiDebugPrint (ACPI_LV_FUNCTIONS,
00559             LineNumber, FunctionName, ModuleName, ComponentId,
00560             "%s %s\n", AcpiGbl_FnExitStr,
00561             AcpiFormatException (Status));
00562     }
00563     else
00564     {
00565         AcpiDebugPrint (ACPI_LV_FUNCTIONS,
00566             LineNumber, FunctionName, ModuleName, ComponentId,
00567             "%s ****Exception****: %s\n", AcpiGbl_FnExitStr,
00568             AcpiFormatException (Status));
00569     }
00570 
00571     AcpiGbl_NestingLevel--;
00572 }
00573 
00574 ACPI_EXPORT_SYMBOL (AcpiUtStatusExit)
00575 
00576 
00577 /*******************************************************************************
00578  *
00579  * FUNCTION:    AcpiUtValueExit
00580  *
00581  * PARAMETERS:  LineNumber          - Caller's line number
00582  *              FunctionName        - Caller's procedure name
00583  *              ModuleName          - Caller's module name
00584  *              ComponentId         - Caller's component ID
00585  *              Value               - Value to be printed with exit msg
00586  *
00587  * RETURN:      None
00588  *
00589  * DESCRIPTION: Function exit trace.  Prints only if TRACE_FUNCTIONS bit is
00590  *              set in DebugLevel.  Prints exit value also.
00591  *
00592  ******************************************************************************/
00593 
00594 void
00595 AcpiUtValueExit (
00596     UINT32                  LineNumber,
00597     const char              *FunctionName,
00598     const char              *ModuleName,
00599     UINT32                  ComponentId,
00600     UINT64                  Value)
00601 {
00602 
00603     AcpiDebugPrint (ACPI_LV_FUNCTIONS,
00604         LineNumber, FunctionName, ModuleName, ComponentId,
00605         "%s %8.8X%8.8X\n", AcpiGbl_FnExitStr,
00606         ACPI_FORMAT_UINT64 (Value));
00607 
00608     AcpiGbl_NestingLevel--;
00609 }
00610 
00611 ACPI_EXPORT_SYMBOL (AcpiUtValueExit)
00612 
00613 
00614 /*******************************************************************************
00615  *
00616  * FUNCTION:    AcpiUtPtrExit
00617  *
00618  * PARAMETERS:  LineNumber          - Caller's line number
00619  *              FunctionName        - Caller's procedure name
00620  *              ModuleName          - Caller's module name
00621  *              ComponentId         - Caller's component ID
00622  *              Ptr                 - Pointer to display
00623  *
00624  * RETURN:      None
00625  *
00626  * DESCRIPTION: Function exit trace.  Prints only if TRACE_FUNCTIONS bit is
00627  *              set in DebugLevel.  Prints exit value also.
00628  *
00629  ******************************************************************************/
00630 
00631 void
00632 AcpiUtPtrExit (
00633     UINT32                  LineNumber,
00634     const char              *FunctionName,
00635     const char              *ModuleName,
00636     UINT32                  ComponentId,
00637     UINT8                   *Ptr)
00638 {
00639 
00640     AcpiDebugPrint (ACPI_LV_FUNCTIONS,
00641         LineNumber, FunctionName, ModuleName, ComponentId,
00642         "%s %p\n", AcpiGbl_FnExitStr, Ptr);
00643 
00644     AcpiGbl_NestingLevel--;
00645 }
00646 
00647 #endif
00648 
00649 
00650 /*******************************************************************************
00651  *
00652  * FUNCTION:    AcpiUtDumpBuffer
00653  *
00654  * PARAMETERS:  Buffer              - Buffer to dump
00655  *              Count               - Amount to dump, in bytes
00656  *              Display             - BYTE, WORD, DWORD, or QWORD display
00657  *              ComponentID         - Caller's component ID
00658  *
00659  * RETURN:      None
00660  *
00661  * DESCRIPTION: Generic dump buffer in both hex and ascii.
00662  *
00663  ******************************************************************************/
00664 
00665 void
00666 AcpiUtDumpBuffer2 (
00667     UINT8                   *Buffer,
00668     UINT32                  Count,
00669     UINT32                  Display)
00670 {
00671     UINT32                  i = 0;
00672     UINT32                  j;
00673     UINT32                  Temp32;
00674     UINT8                   BufChar;
00675 
00676 
00677     if (!Buffer)
00678     {
00679         AcpiOsPrintf ("Null Buffer Pointer in DumpBuffer!\n");
00680         return;
00681     }
00682 
00683     if ((Count < 4) || (Count & 0x01))
00684     {
00685         Display = DB_BYTE_DISPLAY;
00686     }
00687 
00688     /* Nasty little dump buffer routine! */
00689 
00690     while (i < Count)
00691     {
00692         /* Print current offset */
00693 
00694         AcpiOsPrintf ("%6.4X: ", i);
00695 
00696         /* Print 16 hex chars */
00697 
00698         for (j = 0; j < 16;)
00699         {
00700             if (i + j >= Count)
00701             {
00702                 /* Dump fill spaces */
00703 
00704                 AcpiOsPrintf ("%*s", ((Display * 2) + 1), " ");
00705                 j += Display;
00706                 continue;
00707             }
00708 
00709             switch (Display)
00710             {
00711             case DB_BYTE_DISPLAY:
00712             default:    /* Default is BYTE display */
00713 
00714                 AcpiOsPrintf ("%02X ", Buffer[(ACPI_SIZE) i + j]);
00715                 break;
00716 
00717 
00718             case DB_WORD_DISPLAY:
00719 
00720                 ACPI_MOVE_16_TO_32 (&Temp32, &Buffer[(ACPI_SIZE) i + j]);
00721                 AcpiOsPrintf ("%04X ", Temp32);
00722                 break;
00723 
00724 
00725             case DB_DWORD_DISPLAY:
00726 
00727                 ACPI_MOVE_32_TO_32 (&Temp32, &Buffer[(ACPI_SIZE) i + j]);
00728                 AcpiOsPrintf ("%08X ", Temp32);
00729                 break;
00730 
00731 
00732             case DB_QWORD_DISPLAY:
00733 
00734                 ACPI_MOVE_32_TO_32 (&Temp32, &Buffer[(ACPI_SIZE) i + j]);
00735                 AcpiOsPrintf ("%08X", Temp32);
00736 
00737                 ACPI_MOVE_32_TO_32 (&Temp32, &Buffer[(ACPI_SIZE) i + j + 4]);
00738                 AcpiOsPrintf ("%08X ", Temp32);
00739                 break;
00740             }
00741 
00742             j += Display;
00743         }
00744 
00745         /*
00746          * Print the ASCII equivalent characters but watch out for the bad
00747          * unprintable ones (printable chars are 0x20 through 0x7E)
00748          */
00749         AcpiOsPrintf (" ");
00750         for (j = 0; j < 16; j++)
00751         {
00752             if (i + j >= Count)
00753             {
00754                 AcpiOsPrintf ("\n");
00755                 return;
00756             }
00757 
00758             BufChar = Buffer[(ACPI_SIZE) i + j];
00759             if (ACPI_IS_PRINT (BufChar))
00760             {
00761                 AcpiOsPrintf ("%c", BufChar);
00762             }
00763             else
00764             {
00765                 AcpiOsPrintf (".");
00766             }
00767         }
00768 
00769         /* Done with that line. */
00770 
00771         AcpiOsPrintf ("\n");
00772         i += 16;
00773     }
00774 
00775     return;
00776 }
00777 
00778 
00779 /*******************************************************************************
00780  *
00781  * FUNCTION:    AcpiUtDumpBuffer
00782  *
00783  * PARAMETERS:  Buffer              - Buffer to dump
00784  *              Count               - Amount to dump, in bytes
00785  *              Display             - BYTE, WORD, DWORD, or QWORD display
00786  *              ComponentID         - Caller's component ID
00787  *
00788  * RETURN:      None
00789  *
00790  * DESCRIPTION: Generic dump buffer in both hex and ascii.
00791  *
00792  ******************************************************************************/
00793 
00794 void
00795 AcpiUtDumpBuffer (
00796     UINT8                   *Buffer,
00797     UINT32                  Count,
00798     UINT32                  Display,
00799     UINT32                  ComponentId)
00800 {
00801 
00802     /* Only dump the buffer if tracing is enabled */
00803 
00804     if (!((ACPI_LV_TABLES & AcpiDbgLevel) &&
00805         (ComponentId & AcpiDbgLayer)))
00806     {
00807         return;
00808     }
00809 
00810     AcpiUtDumpBuffer2 (Buffer, Count, Display);
00811 }
00812 
00813 

Generated on Fri May 25 2012 04:25:40 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.