|
||||
Warning, cross-references for /kernel/drivers/acpica/utdebug.c need to be fixed.
0001 /****************************************************************************** 0002 * 0003 * Module Name: utdebug - Debug print routines 0004 * 0005 *****************************************************************************/ 0006 0007 /****************************************************************************** 0008 * 0009 * 1. Copyright Notice 0010 * 0011 * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. 0012 * All rights reserved. 0013 * 0014 * 2. License 0015 * 0016 * 2.1. This is your license from Intel Corp. under its intellectual property 0017 * rights. You may have additional license terms from the party that provided 0018 * you this software, covering your right to use that party's intellectual 0019 * property rights. 0020 * 0021 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a 0022 * copy of the source code appearing in this file ("Covered Code") an 0023 * irrevocable, perpetual, worldwide license under Intel's copyrights in the 0024 * base code distributed originally by Intel ("Original Intel Code") to copy, 0025 * make derivatives, distribute, use and display any portion of the Covered 0026 * Code in any form, with the right to sublicense such rights; and 0027 * 0028 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent 0029 * license (with the right to sublicense), under only those claims of Intel 0030 * patents that are infringed by the Original Intel Code, to make, use, sell, 0031 * offer to sell, and import the Covered Code and derivative works thereof 0032 * solely to the minimum extent necessary to exercise the above copyright 0033 * license, and in no event shall the patent license extend to any additions 0034 * to or modifications of the Original Intel Code. No other license or right 0035 * is granted directly or by implication, estoppel or otherwise; 0036 * 0037 * The above copyright and patent license is granted only if the following 0038 * conditions are met: 0039 * 0040 * 3. Conditions 0041 * 0042 * 3.1. Redistribution of Source with Rights to Further Distribute Source. 0043 * Redistribution of source code of any substantial portion of the Covered 0044 * Code or modification with rights to further distribute source must include 0045 * the above Copyright Notice, the above License, this list of Conditions, 0046 * and the following Disclaimer and Export Compliance provision. In addition, 0047 * Licensee must cause all Covered Code to which Licensee contributes to 0048 * contain a file documenting the changes Licensee made to create that Covered 0049 * Code and the date of any change. Licensee must include in that file the 0050 * documentation of any changes made by any predecessor Licensee. Licensee 0051 * must include a prominent statement that the modification is derived, 0052 * directly or indirectly, from Original Intel Code. 0053 * 0054 * 3.2. Redistribution of Source with no Rights to Further Distribute Source. 0055 * Redistribution of source code of any substantial portion of the Covered 0056 * Code or modification without rights to further distribute source must 0057 * include the following Disclaimer and Export Compliance provision in the 0058 * documentation and/or other materials provided with distribution. In 0059 * addition, Licensee may not authorize further sublicense of source of any 0060 * portion of the Covered Code, and must include terms to the effect that the 0061 * license from Licensee to its licensee is limited to the intellectual 0062 * property embodied in the software Licensee provides to its licensee, and 0063 * not to intellectual property embodied in modifications its licensee may 0064 * make. 0065 * 0066 * 3.3. Redistribution of Executable. Redistribution in executable form of any 0067 * substantial portion of the Covered Code or modification must reproduce the 0068 * above Copyright Notice, and the following Disclaimer and Export Compliance 0069 * provision in the documentation and/or other materials provided with the 0070 * distribution. 0071 * 0072 * 3.4. Intel retains all right, title, and interest in and to the Original 0073 * Intel Code. 0074 * 0075 * 3.5. Neither the name Intel nor any other trademark owned or controlled by 0076 * Intel shall be used in advertising or otherwise to promote the sale, use or 0077 * other dealings in products derived from or relating to the Covered Code 0078 * without prior written authorization from Intel. 0079 * 0080 * 4. Disclaimer and Export Compliance 0081 * 0082 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED 0083 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE 0084 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, 0085 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY 0086 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY 0087 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A 0088 * PARTICULAR PURPOSE. 0089 * 0090 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES 0091 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR 0092 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, 0093 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY 0094 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL 0095 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS 0096 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY 0097 * LIMITED REMEDY. 0098 * 0099 * 4.3. Licensee shall not export, either directly or indirectly, any of this 0100 * software or system incorporating such software without first obtaining any 0101 * required license or other approval from the U. S. Department of Commerce or 0102 * any other agency or department of the United States Government. In the 0103 * event Licensee exports any such software from the United States or 0104 * re-exports any such software from a foreign destination, Licensee shall 0105 * ensure that the distribution and export/re-export of the software is in 0106 * compliance with all laws, regulations, orders, or other restrictions of the 0107 * U.S. Export Administration Regulations. Licensee agrees that neither it nor 0108 * any of its subsidiaries will export/re-export any technical data, process, 0109 * software, or service, directly or indirectly, to any country for which the 0110 * United States government or any agency thereof requires an export license, 0111 * other governmental approval, or letter of assurance, without first obtaining 0112 * such license, approval or letter. 0113 * 0114 *****************************************************************************/ 0115 0116 #define __UTDEBUG_C__ 0117 0118 #include "acpi.h" 0119 #include "accommon.h" 0120 0121 #define _COMPONENT ACPI_UTILITIES 0122 ACPI_MODULE_NAME ("utdebug") 0123 0124 0125 #ifdef ACPI_DEBUG_OUTPUT 0126 0127 static ACPI_THREAD_ID AcpiGbl_PrevThreadId = (ACPI_THREAD_ID) 0xFFFFFFFF; 0128 static char *AcpiGbl_FnEntryStr = "----Entry"; 0129 static char *AcpiGbl_FnExitStr = "----Exit-"; 0130 0131 /* Local prototypes */ 0132 0133 static const char * 0134 AcpiUtTrimFunctionName ( 0135 const char *FunctionName); 0136 0137 0138 /******************************************************************************* 0139 * 0140 * FUNCTION: AcpiUtInitStackPtrTrace 0141 * 0142 * PARAMETERS: None 0143 * 0144 * RETURN: None 0145 * 0146 * DESCRIPTION: Save the current CPU stack pointer at subsystem startup 0147 * 0148 ******************************************************************************/ 0149 0150 void 0151 AcpiUtInitStackPtrTrace ( 0152 void) 0153 { 0154 ACPI_SIZE CurrentSp; 0155 0156 0157 AcpiGbl_EntryStackPointer = &CurrentSp; 0158 } 0159 0160 0161 /******************************************************************************* 0162 * 0163 * FUNCTION: AcpiUtTrackStackPtr 0164 * 0165 * PARAMETERS: None 0166 * 0167 * RETURN: None 0168 * 0169 * DESCRIPTION: Save the current CPU stack pointer 0170 * 0171 ******************************************************************************/ 0172 0173 void 0174 AcpiUtTrackStackPtr ( 0175 void) 0176 { 0177 ACPI_SIZE CurrentSp; 0178 0179 0180 if (&CurrentSp < AcpiGbl_LowestStackPointer) 0181 { 0182 AcpiGbl_LowestStackPointer = &CurrentSp; 0183 } 0184 0185 if (AcpiGbl_NestingLevel > AcpiGbl_DeepestNesting) 0186 { 0187 AcpiGbl_DeepestNesting = AcpiGbl_NestingLevel; 0188 } 0189 } 0190 0191 0192 /******************************************************************************* 0193 * 0194 * FUNCTION: AcpiUtTrimFunctionName 0195 * 0196 * PARAMETERS: FunctionName - Ascii string containing a procedure name 0197 * 0198 * RETURN: Updated pointer to the function name 0199 * 0200 * DESCRIPTION: Remove the "Acpi" prefix from the function name, if present. 0201 * This allows compiler macros such as __FUNCTION__ to be used 0202 * with no change to the debug output. 0203 * 0204 ******************************************************************************/ 0205 0206 static const char * 0207 AcpiUtTrimFunctionName ( 0208 const char *FunctionName) 0209 { 0210 0211 /* All Function names are longer than 4 chars, check is safe */ 0212 0213 if (*(ACPI_CAST_PTR (UINT32, FunctionName)) == ACPI_PREFIX_MIXED) 0214 { 0215 /* This is the case where the original source has not been modified */ 0216 0217 return (FunctionName + 4); 0218 } 0219 0220 if (*(ACPI_CAST_PTR (UINT32, FunctionName)) == ACPI_PREFIX_LOWER) 0221 { 0222 /* This is the case where the source has been 'linuxized' */ 0223 0224 return (FunctionName + 5); 0225 } 0226 0227 return (FunctionName); 0228 } 0229 0230 0231 /******************************************************************************* 0232 * 0233 * FUNCTION: AcpiDebugPrint 0234 * 0235 * PARAMETERS: RequestedDebugLevel - Requested debug print level 0236 * LineNumber - Caller's line number (for error output) 0237 * FunctionName - Caller's procedure name 0238 * ModuleName - Caller's module name 0239 * ComponentId - Caller's component ID 0240 * Format - Printf format field 0241 * ... - Optional printf arguments 0242 * 0243 * RETURN: None 0244 * 0245 * DESCRIPTION: Print error message with prefix consisting of the module name, 0246 * line number, and component ID. 0247 * 0248 ******************************************************************************/ 0249 0250 void ACPI_INTERNAL_VAR_XFACE 0251 AcpiDebugPrint ( 0252 UINT32 RequestedDebugLevel, 0253 UINT32 LineNumber, 0254 const char *FunctionName, 0255 const char *ModuleName, 0256 UINT32 ComponentId, 0257 const char *Format, 0258 ...) 0259 { 0260 ACPI_THREAD_ID ThreadId; 0261 va_list args; 0262 0263 0264 /* 0265 * Stay silent if the debug level or component ID is disabled 0266 */ 0267 if (!(RequestedDebugLevel & AcpiDbgLevel) || 0268 !(ComponentId & AcpiDbgLayer)) 0269 { 0270 return; 0271 } 0272 0273 /* 0274 * Thread tracking and context switch notification 0275 */ 0276 ThreadId = AcpiOsGetThreadId (); 0277 if (ThreadId != AcpiGbl_PrevThreadId) 0278 { 0279 if (ACPI_LV_THREADS & AcpiDbgLevel) 0280 { 0281 AcpiOsPrintf ( 0282 "\n**** Context Switch from TID %p to TID %p ****\n\n", 0283 ACPI_CAST_PTR (void, AcpiGbl_PrevThreadId), 0284 ACPI_CAST_PTR (void, ThreadId)); 0285 } 0286 0287 AcpiGbl_PrevThreadId = ThreadId; 0288 } 0289 0290 /* 0291 * Display the module name, current line number, thread ID (if requested), 0292 * current procedure nesting level, and the current procedure name 0293 */ 0294 AcpiOsPrintf ("%8s-%04ld ", ModuleName, LineNumber); 0295 0296 if (ACPI_LV_THREADS & AcpiDbgLevel) 0297 { 0298 AcpiOsPrintf ("[%p] ", ACPI_CAST_PTR (void, ThreadId)); 0299 } 0300 0301 AcpiOsPrintf ("[%02ld] %-22.22s: ", 0302 AcpiGbl_NestingLevel, AcpiUtTrimFunctionName (FunctionName)); 0303 0304 va_start (args, Format); 0305 AcpiOsVprintf (Format, args); 0306 va_end (args); 0307 } 0308 0309 ACPI_EXPORT_SYMBOL (AcpiDebugPrint) 0310 0311 0312 /******************************************************************************* 0313 * 0314 * FUNCTION: AcpiDebugPrintRaw 0315 * 0316 * PARAMETERS: RequestedDebugLevel - Requested debug print level 0317 * LineNumber - Caller's line number 0318 * FunctionName - Caller's procedure name 0319 * ModuleName - Caller's module name 0320 * ComponentId - Caller's component ID 0321 * Format - Printf format field 0322 * ... - Optional printf arguments 0323 * 0324 * RETURN: None 0325 * 0326 * DESCRIPTION: Print message with no headers. Has same interface as 0327 * DebugPrint so that the same macros can be used. 0328 * 0329 ******************************************************************************/ 0330 0331 void ACPI_INTERNAL_VAR_XFACE 0332 AcpiDebugPrintRaw ( 0333 UINT32 RequestedDebugLevel, 0334 UINT32 LineNumber, 0335 const char *FunctionName, 0336 const char *ModuleName, 0337 UINT32 ComponentId, 0338 const char *Format, 0339 ...) 0340 { 0341 va_list args; 0342 0343 0344 if (!(RequestedDebugLevel & AcpiDbgLevel) || 0345 !(ComponentId & AcpiDbgLayer)) 0346 { 0347 return; 0348 } 0349 0350 va_start (args, Format); 0351 AcpiOsVprintf (Format, args); 0352 va_end (args); 0353 } 0354 0355 ACPI_EXPORT_SYMBOL (AcpiDebugPrintRaw) 0356 0357 0358 /******************************************************************************* 0359 * 0360 * FUNCTION: AcpiUtTrace 0361 * 0362 * PARAMETERS: LineNumber - Caller's line number 0363 * FunctionName - Caller's procedure name 0364 * ModuleName - Caller's module name 0365 * ComponentId - Caller's component ID 0366 * 0367 * RETURN: None 0368 * 0369 * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is 0370 * set in DebugLevel 0371 * 0372 ******************************************************************************/ 0373 0374 void 0375 AcpiUtTrace ( 0376 UINT32 LineNumber, 0377 const char *FunctionName, 0378 const char *ModuleName, 0379 UINT32 ComponentId) 0380 { 0381 0382 AcpiGbl_NestingLevel++; 0383 AcpiUtTrackStackPtr (); 0384 0385 AcpiDebugPrint (ACPI_LV_FUNCTIONS, 0386 LineNumber, FunctionName, ModuleName, ComponentId, 0387 "%s\n", AcpiGbl_FnEntryStr); 0388 } 0389 0390 ACPI_EXPORT_SYMBOL (AcpiUtTrace) 0391 0392 0393 /******************************************************************************* 0394 * 0395 * FUNCTION: AcpiUtTracePtr 0396 * 0397 * PARAMETERS: LineNumber - Caller's line number 0398 * FunctionName - Caller's procedure name 0399 * ModuleName - Caller's module name 0400 * ComponentId - Caller's component ID 0401 * Pointer - Pointer to display 0402 * 0403 * RETURN: None 0404 * 0405 * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is 0406 * set in DebugLevel 0407 * 0408 ******************************************************************************/ 0409 0410 void 0411 AcpiUtTracePtr ( 0412 UINT32 LineNumber, 0413 const char *FunctionName, 0414 const char *ModuleName, 0415 UINT32 ComponentId, 0416 void *Pointer) 0417 { 0418 AcpiGbl_NestingLevel++; 0419 AcpiUtTrackStackPtr (); 0420 0421 AcpiDebugPrint (ACPI_LV_FUNCTIONS, 0422 LineNumber, FunctionName, ModuleName, ComponentId, 0423 "%s %p\n", AcpiGbl_FnEntryStr, Pointer); 0424 } 0425 0426 0427 /******************************************************************************* 0428 * 0429 * FUNCTION: AcpiUtTraceStr 0430 * 0431 * PARAMETERS: LineNumber - Caller's line number 0432 * FunctionName - Caller's procedure name 0433 * ModuleName - Caller's module name 0434 * ComponentId - Caller's component ID 0435 * String - Additional string to display 0436 * 0437 * RETURN: None 0438 * 0439 * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is 0440 * set in DebugLevel 0441 * 0442 ******************************************************************************/ 0443 0444 void 0445 AcpiUtTraceStr ( 0446 UINT32 LineNumber, 0447 const char *FunctionName, 0448 const char *ModuleName, 0449 UINT32 ComponentId, 0450 char *String) 0451 { 0452 0453 AcpiGbl_NestingLevel++; 0454 AcpiUtTrackStackPtr (); 0455 0456 AcpiDebugPrint (ACPI_LV_FUNCTIONS, 0457 LineNumber, FunctionName, ModuleName, ComponentId, 0458 "%s %s\n", AcpiGbl_FnEntryStr, String); 0459 } 0460 0461 0462 /******************************************************************************* 0463 * 0464 * FUNCTION: AcpiUtTraceU32 0465 * 0466 * PARAMETERS: LineNumber - Caller's line number 0467 * FunctionName - Caller's procedure name 0468 * ModuleName - Caller's module name 0469 * ComponentId - Caller's component ID 0470 * Integer - Integer to display 0471 * 0472 * RETURN: None 0473 * 0474 * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is 0475 * set in DebugLevel 0476 * 0477 ******************************************************************************/ 0478 0479 void 0480 AcpiUtTraceU32 ( 0481 UINT32 LineNumber, 0482 const char *FunctionName, 0483 const char *ModuleName, 0484 UINT32 ComponentId, 0485 UINT32 Integer) 0486 { 0487 0488 AcpiGbl_NestingLevel++; 0489 AcpiUtTrackStackPtr (); 0490 0491 AcpiDebugPrint (ACPI_LV_FUNCTIONS, 0492 LineNumber, FunctionName, ModuleName, ComponentId, 0493 "%s %08X\n", AcpiGbl_FnEntryStr, Integer); 0494 } 0495 0496 0497 /******************************************************************************* 0498 * 0499 * FUNCTION: AcpiUtExit 0500 * 0501 * PARAMETERS: LineNumber - Caller's line number 0502 * FunctionName - Caller's procedure name 0503 * ModuleName - Caller's module name 0504 * ComponentId - Caller's component ID 0505 * 0506 * RETURN: None 0507 * 0508 * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is 0509 * set in DebugLevel 0510 * 0511 ******************************************************************************/ 0512 0513 void 0514 AcpiUtExit ( 0515 UINT32 LineNumber, 0516 const char *FunctionName, 0517 const char *ModuleName, 0518 UINT32 ComponentId) 0519 { 0520 0521 AcpiDebugPrint (ACPI_LV_FUNCTIONS, 0522 LineNumber, FunctionName, ModuleName, ComponentId, 0523 "%s\n", AcpiGbl_FnExitStr); 0524 0525 AcpiGbl_NestingLevel--; 0526 } 0527 0528 ACPI_EXPORT_SYMBOL (AcpiUtExit) 0529 0530 0531 /******************************************************************************* 0532 * 0533 * FUNCTION: AcpiUtStatusExit 0534 * 0535 * PARAMETERS: LineNumber - Caller's line number 0536 * FunctionName - Caller's procedure name 0537 * ModuleName - Caller's module name 0538 * ComponentId - Caller's component ID 0539 * Status - Exit status code 0540 * 0541 * RETURN: None 0542 * 0543 * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is 0544 * set in DebugLevel. Prints exit status also. 0545 * 0546 ******************************************************************************/ 0547 0548 void 0549 AcpiUtStatusExit ( 0550 UINT32 LineNumber, 0551 const char *FunctionName, 0552 const char *ModuleName, 0553 UINT32 ComponentId, 0554 ACPI_STATUS Status) 0555 { 0556 0557 if (ACPI_SUCCESS (Status)) 0558 { 0559 AcpiDebugPrint (ACPI_LV_FUNCTIONS, 0560 LineNumber, FunctionName, ModuleName, ComponentId, 0561 "%s %s\n", AcpiGbl_FnExitStr, 0562 AcpiFormatException (Status)); 0563 } 0564 else 0565 { 0566 AcpiDebugPrint (ACPI_LV_FUNCTIONS, 0567 LineNumber, FunctionName, ModuleName, ComponentId, 0568 "%s ****Exception****: %s\n", AcpiGbl_FnExitStr, 0569 AcpiFormatException (Status)); 0570 } 0571 0572 AcpiGbl_NestingLevel--; 0573 } 0574 0575 ACPI_EXPORT_SYMBOL (AcpiUtStatusExit) 0576 0577 0578 /******************************************************************************* 0579 * 0580 * FUNCTION: AcpiUtValueExit 0581 * 0582 * PARAMETERS: LineNumber - Caller's line number 0583 * FunctionName - Caller's procedure name 0584 * ModuleName - Caller's module name 0585 * ComponentId - Caller's component ID 0586 * Value - Value to be printed with exit msg 0587 * 0588 * RETURN: None 0589 * 0590 * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is 0591 * set in DebugLevel. Prints exit value also. 0592 * 0593 ******************************************************************************/ 0594 0595 void 0596 AcpiUtValueExit ( 0597 UINT32 LineNumber, 0598 const char *FunctionName, 0599 const char *ModuleName, 0600 UINT32 ComponentId, 0601 ACPI_INTEGER Value) 0602 { 0603 0604 AcpiDebugPrint (ACPI_LV_FUNCTIONS, 0605 LineNumber, FunctionName, ModuleName, ComponentId, 0606 "%s %8.8X%8.8X\n", AcpiGbl_FnExitStr, 0607 ACPI_FORMAT_UINT64 (Value)); 0608 0609 AcpiGbl_NestingLevel--; 0610 } 0611 0612 ACPI_EXPORT_SYMBOL (AcpiUtValueExit) 0613 0614 0615 /******************************************************************************* 0616 * 0617 * FUNCTION: AcpiUtPtrExit 0618 * 0619 * PARAMETERS: LineNumber - Caller's line number 0620 * FunctionName - Caller's procedure name 0621 * ModuleName - Caller's module name 0622 * ComponentId - Caller's component ID 0623 * Ptr - Pointer to display 0624 * 0625 * RETURN: None 0626 * 0627 * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is 0628 * set in DebugLevel. Prints exit value also. 0629 * 0630 ******************************************************************************/ 0631 0632 void 0633 AcpiUtPtrExit ( 0634 UINT32 LineNumber, 0635 const char *FunctionName, 0636 const char *ModuleName, 0637 UINT32 ComponentId, 0638 UINT8 *Ptr) 0639 { 0640 0641 AcpiDebugPrint (ACPI_LV_FUNCTIONS, 0642 LineNumber, FunctionName, ModuleName, ComponentId, 0643 "%s %p\n", AcpiGbl_FnExitStr, Ptr); 0644 0645 AcpiGbl_NestingLevel--; 0646 } 0647 0648 #endif 0649 0650 0651 /******************************************************************************* 0652 * 0653 * FUNCTION: AcpiUtDumpBuffer 0654 * 0655 * PARAMETERS: Buffer - Buffer to dump 0656 * Count - Amount to dump, in bytes 0657 * Display - BYTE, WORD, DWORD, or QWORD display 0658 * ComponentID - Caller's component ID 0659 * 0660 * RETURN: None 0661 * 0662 * DESCRIPTION: Generic dump buffer in both hex and ascii. 0663 * 0664 ******************************************************************************/ 0665 0666 void 0667 AcpiUtDumpBuffer2 ( 0668 UINT8 *Buffer, 0669 UINT32 Count, 0670 UINT32 Display) 0671 { 0672 UINT32 i = 0; 0673 UINT32 j; 0674 UINT32 Temp32; 0675 UINT8 BufChar; 0676 0677 0678 if (!Buffer) 0679 { 0680 AcpiOsPrintf ("Null Buffer Pointer in DumpBuffer!\n"); 0681 return; 0682 } 0683 0684 if ((Count < 4) || (Count & 0x01)) 0685 { 0686 Display = DB_BYTE_DISPLAY; 0687 } 0688 0689 /* Nasty little dump buffer routine! */ 0690 0691 while (i < Count) 0692 { 0693 /* Print current offset */ 0694 0695 AcpiOsPrintf ("%6.4X: ", i); 0696 0697 /* Print 16 hex chars */ 0698 0699 for (j = 0; j < 16;) 0700 { 0701 if (i + j >= Count) 0702 { 0703 /* Dump fill spaces */ 0704 0705 AcpiOsPrintf ("%*s", ((Display * 2) + 1), " "); 0706 j += Display; 0707 continue; 0708 } 0709 0710 switch (Display) 0711 { 0712 case DB_BYTE_DISPLAY: 0713 default: /* Default is BYTE display */ 0714 0715 AcpiOsPrintf ("%02X ", Buffer[(ACPI_SIZE) i + j]); 0716 break; 0717 0718 0719 case DB_WORD_DISPLAY: 0720 0721 ACPI_MOVE_16_TO_32 (&Temp32, &Buffer[(ACPI_SIZE) i + j]); 0722 AcpiOsPrintf ("%04X ", Temp32); 0723 break; 0724 0725 0726 case DB_DWORD_DISPLAY: 0727 0728 ACPI_MOVE_32_TO_32 (&Temp32, &Buffer[(ACPI_SIZE) i + j]); 0729 AcpiOsPrintf ("%08X ", Temp32); 0730 break; 0731 0732 0733 case DB_QWORD_DISPLAY: 0734 0735 ACPI_MOVE_32_TO_32 (&Temp32, &Buffer[(ACPI_SIZE) i + j]); 0736 AcpiOsPrintf ("%08X", Temp32); 0737 0738 ACPI_MOVE_32_TO_32 (&Temp32, &Buffer[(ACPI_SIZE) i + j + 4]); 0739 AcpiOsPrintf ("%08X ", Temp32); 0740 break; 0741 } 0742 0743 j += Display; 0744 } 0745 0746 /* 0747 * Print the ASCII equivalent characters but watch out for the bad 0748 * unprintable ones (printable chars are 0x20 through 0x7E) 0749 */ 0750 AcpiOsPrintf (" "); 0751 for (j = 0; j < 16; j++) 0752 { 0753 if (i + j >= Count) 0754 { 0755 AcpiOsPrintf ("\n"); 0756 return; 0757 } 0758 0759 BufChar = Buffer[(ACPI_SIZE) i + j]; 0760 if (ACPI_IS_PRINT (BufChar)) 0761 { 0762 AcpiOsPrintf ("%c", BufChar); 0763 } 0764 else 0765 { 0766 AcpiOsPrintf ("."); 0767 } 0768 } 0769 0770 /* Done with that line. */ 0771 0772 AcpiOsPrintf ("\n"); 0773 i += 16; 0774 } 0775 0776 return; 0777 } 0778 0779 0780 /******************************************************************************* 0781 * 0782 * FUNCTION: AcpiUtDumpBuffer 0783 * 0784 * PARAMETERS: Buffer - Buffer to dump 0785 * Count - Amount to dump, in bytes 0786 * Display - BYTE, WORD, DWORD, or QWORD display 0787 * ComponentID - Caller's component ID 0788 * 0789 * RETURN: None 0790 * 0791 * DESCRIPTION: Generic dump buffer in both hex and ascii. 0792 * 0793 ******************************************************************************/ 0794 0795 void 0796 AcpiUtDumpBuffer ( 0797 UINT8 *Buffer, 0798 UINT32 Count, 0799 UINT32 Display, 0800 UINT32 ComponentId) 0801 { 0802 0803 /* Only dump the buffer if tracing is enabled */ 0804 0805 if (!((ACPI_LV_TABLES & AcpiDbgLevel) && 0806 (ComponentId & AcpiDbgLayer))) 0807 { 0808 return; 0809 } 0810 0811 AcpiUtDumpBuffer2 (Buffer, Count, Display); 0812 } 0813 0814
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 1.2.0 LXR engine. |