]> CyberLeo.Net >> Repos - FreeBSD/releng/8.2.git/blob - sys/contrib/dev/acpica/utilities/utdebug.c
Copy stable/8 to releng/8.2 in preparation for FreeBSD-8.2 release.
[FreeBSD/releng/8.2.git] / sys / contrib / dev / acpica / utilities / utdebug.c
1 /******************************************************************************
2  *
3  * Module Name: utdebug - Debug print routines
4  *
5  *****************************************************************************/
6
7 /******************************************************************************
8  *
9  * 1. Copyright Notice
10  *
11  * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
12  * All rights reserved.
13  *
14  * 2. License
15  *
16  * 2.1. This is your license from Intel Corp. under its intellectual property
17  * rights.  You may have additional license terms from the party that provided
18  * you this software, covering your right to use that party's intellectual
19  * property rights.
20  *
21  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
22  * copy of the source code appearing in this file ("Covered Code") an
23  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
24  * base code distributed originally by Intel ("Original Intel Code") to copy,
25  * make derivatives, distribute, use and display any portion of the Covered
26  * Code in any form, with the right to sublicense such rights; and
27  *
28  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
29  * license (with the right to sublicense), under only those claims of Intel
30  * patents that are infringed by the Original Intel Code, to make, use, sell,
31  * offer to sell, and import the Covered Code and derivative works thereof
32  * solely to the minimum extent necessary to exercise the above copyright
33  * license, and in no event shall the patent license extend to any additions
34  * to or modifications of the Original Intel Code.  No other license or right
35  * is granted directly or by implication, estoppel or otherwise;
36  *
37  * The above copyright and patent license is granted only if the following
38  * conditions are met:
39  *
40  * 3. Conditions
41  *
42  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
43  * Redistribution of source code of any substantial portion of the Covered
44  * Code or modification with rights to further distribute source must include
45  * the above Copyright Notice, the above License, this list of Conditions,
46  * and the following Disclaimer and Export Compliance provision.  In addition,
47  * Licensee must cause all Covered Code to which Licensee contributes to
48  * contain a file documenting the changes Licensee made to create that Covered
49  * Code and the date of any change.  Licensee must include in that file the
50  * documentation of any changes made by any predecessor Licensee.  Licensee
51  * must include a prominent statement that the modification is derived,
52  * directly or indirectly, from Original Intel Code.
53  *
54  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
55  * Redistribution of source code of any substantial portion of the Covered
56  * Code or modification without rights to further distribute source must
57  * include the following Disclaimer and Export Compliance provision in the
58  * documentation and/or other materials provided with distribution.  In
59  * addition, Licensee may not authorize further sublicense of source of any
60  * portion of the Covered Code, and must include terms to the effect that the
61  * license from Licensee to its licensee is limited to the intellectual
62  * property embodied in the software Licensee provides to its licensee, and
63  * not to intellectual property embodied in modifications its licensee may
64  * make.
65  *
66  * 3.3. Redistribution of Executable. Redistribution in executable form of any
67  * substantial portion of the Covered Code or modification must reproduce the
68  * above Copyright Notice, and the following Disclaimer and Export Compliance
69  * provision in the documentation and/or other materials provided with the
70  * distribution.
71  *
72  * 3.4. Intel retains all right, title, and interest in and to the Original
73  * Intel Code.
74  *
75  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
76  * Intel shall be used in advertising or otherwise to promote the sale, use or
77  * other dealings in products derived from or relating to the Covered Code
78  * without prior written authorization from Intel.
79  *
80  * 4. Disclaimer and Export Compliance
81  *
82  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
83  * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
84  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
85  * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
86  * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
87  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
88  * PARTICULAR PURPOSE.
89  *
90  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
91  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
92  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
93  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
94  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
95  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
96  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
97  * LIMITED REMEDY.
98  *
99  * 4.3. Licensee shall not export, either directly or indirectly, any of this
100  * software or system incorporating such software without first obtaining any
101  * required license or other approval from the U. S. Department of Commerce or
102  * any other agency or department of the United States Government.  In the
103  * event Licensee exports any such software from the United States or
104  * re-exports any such software from a foreign destination, Licensee shall
105  * ensure that the distribution and export/re-export of the software is in
106  * compliance with all laws, regulations, orders, or other restrictions of the
107  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
108  * any of its subsidiaries will export/re-export any technical data, process,
109  * software, or service, directly or indirectly, to any country for which the
110  * United States government or any agency thereof requires an export license,
111  * other governmental approval, or letter of assurance, without first obtaining
112  * such license, approval or letter.
113  *
114  *****************************************************************************/
115
116 #define __UTDEBUG_C__
117
118 #include <contrib/dev/acpica/include/acpi.h>
119 #include <contrib/dev/acpica/include/accommon.h>
120
121 #define _COMPONENT          ACPI_UTILITIES
122         ACPI_MODULE_NAME    ("utdebug")
123
124
125 #ifdef ACPI_DEBUG_OUTPUT
126
127 static ACPI_THREAD_ID       AcpiGbl_PrevThreadId = (ACPI_THREAD_ID) 0xFFFFFFFF;
128 static char                 *AcpiGbl_FnEntryStr = "----Entry";
129 static char                 *AcpiGbl_FnExitStr  = "----Exit-";
130
131 /* Local prototypes */
132
133 static const char *
134 AcpiUtTrimFunctionName (
135     const char              *FunctionName);
136
137
138 /*******************************************************************************
139  *
140  * FUNCTION:    AcpiUtInitStackPtrTrace
141  *
142  * PARAMETERS:  None
143  *
144  * RETURN:      None
145  *
146  * DESCRIPTION: Save the current CPU stack pointer at subsystem startup
147  *
148  ******************************************************************************/
149
150 void
151 AcpiUtInitStackPtrTrace (
152     void)
153 {
154     ACPI_SIZE               CurrentSp;
155
156
157     AcpiGbl_EntryStackPointer = &CurrentSp;
158 }
159
160
161 /*******************************************************************************
162  *
163  * FUNCTION:    AcpiUtTrackStackPtr
164  *
165  * PARAMETERS:  None
166  *
167  * RETURN:      None
168  *
169  * DESCRIPTION: Save the current CPU stack pointer
170  *
171  ******************************************************************************/
172
173 void
174 AcpiUtTrackStackPtr (
175     void)
176 {
177     ACPI_SIZE               CurrentSp;
178
179
180     if (&CurrentSp < AcpiGbl_LowestStackPointer)
181     {
182         AcpiGbl_LowestStackPointer = &CurrentSp;
183     }
184
185     if (AcpiGbl_NestingLevel > AcpiGbl_DeepestNesting)
186     {
187         AcpiGbl_DeepestNesting = AcpiGbl_NestingLevel;
188     }
189 }
190
191
192 /*******************************************************************************
193  *
194  * FUNCTION:    AcpiUtTrimFunctionName
195  *
196  * PARAMETERS:  FunctionName        - Ascii string containing a procedure name
197  *
198  * RETURN:      Updated pointer to the function name
199  *
200  * DESCRIPTION: Remove the "Acpi" prefix from the function name, if present.
201  *              This allows compiler macros such as __FUNCTION__ to be used
202  *              with no change to the debug output.
203  *
204  ******************************************************************************/
205
206 static const char *
207 AcpiUtTrimFunctionName (
208     const char              *FunctionName)
209 {
210
211     /* All Function names are longer than 4 chars, check is safe */
212
213     if (*(ACPI_CAST_PTR (UINT32, FunctionName)) == ACPI_PREFIX_MIXED)
214     {
215         /* This is the case where the original source has not been modified */
216
217         return (FunctionName + 4);
218     }
219
220     if (*(ACPI_CAST_PTR (UINT32, FunctionName)) == ACPI_PREFIX_LOWER)
221     {
222         /* This is the case where the source has been 'linuxized' */
223
224         return (FunctionName + 5);
225     }
226
227     return (FunctionName);
228 }
229
230
231 /*******************************************************************************
232  *
233  * FUNCTION:    AcpiDebugPrint
234  *
235  * PARAMETERS:  RequestedDebugLevel - Requested debug print level
236  *              LineNumber          - Caller's line number (for error output)
237  *              FunctionName        - Caller's procedure name
238  *              ModuleName          - Caller's module name
239  *              ComponentId         - Caller's component ID
240  *              Format              - Printf format field
241  *              ...                 - Optional printf arguments
242  *
243  * RETURN:      None
244  *
245  * DESCRIPTION: Print error message with prefix consisting of the module name,
246  *              line number, and component ID.
247  *
248  ******************************************************************************/
249
250 void  ACPI_INTERNAL_VAR_XFACE
251 AcpiDebugPrint (
252     UINT32                  RequestedDebugLevel,
253     UINT32                  LineNumber,
254     const char              *FunctionName,
255     const char              *ModuleName,
256     UINT32                  ComponentId,
257     const char              *Format,
258     ...)
259 {
260     ACPI_THREAD_ID          ThreadId;
261     va_list                 args;
262
263
264     /*
265      * Stay silent if the debug level or component ID is disabled
266      */
267     if (!(RequestedDebugLevel & AcpiDbgLevel) ||
268         !(ComponentId & AcpiDbgLayer))
269     {
270         return;
271     }
272
273     /*
274      * Thread tracking and context switch notification
275      */
276     ThreadId = AcpiOsGetThreadId ();
277     if (ThreadId != AcpiGbl_PrevThreadId)
278     {
279         if (ACPI_LV_THREADS & AcpiDbgLevel)
280         {
281             AcpiOsPrintf (
282                 "\n**** Context Switch from TID %u to TID %u ****\n\n",
283                 (UINT32) AcpiGbl_PrevThreadId, (UINT32) ThreadId);
284         }
285
286         AcpiGbl_PrevThreadId = ThreadId;
287     }
288
289     /*
290      * Display the module name, current line number, thread ID (if requested),
291      * current procedure nesting level, and the current procedure name
292      */
293     AcpiOsPrintf ("%8s-%04ld ", ModuleName, LineNumber);
294
295     if (ACPI_LV_THREADS & AcpiDbgLevel)
296     {
297         AcpiOsPrintf ("[%u] ", (UINT32) ThreadId);
298     }
299
300     AcpiOsPrintf ("[%02ld] %-22.22s: ",
301         AcpiGbl_NestingLevel, AcpiUtTrimFunctionName (FunctionName));
302
303     va_start (args, Format);
304     AcpiOsVprintf (Format, args);
305     va_end (args);
306 }
307
308 ACPI_EXPORT_SYMBOL (AcpiDebugPrint)
309
310
311 /*******************************************************************************
312  *
313  * FUNCTION:    AcpiDebugPrintRaw
314  *
315  * PARAMETERS:  RequestedDebugLevel - Requested debug print level
316  *              LineNumber          - Caller's line number
317  *              FunctionName        - Caller's procedure name
318  *              ModuleName          - Caller's module name
319  *              ComponentId         - Caller's component ID
320  *              Format              - Printf format field
321  *              ...                 - Optional printf arguments
322  *
323  * RETURN:      None
324  *
325  * DESCRIPTION: Print message with no headers.  Has same interface as
326  *              DebugPrint so that the same macros can be used.
327  *
328  ******************************************************************************/
329
330 void  ACPI_INTERNAL_VAR_XFACE
331 AcpiDebugPrintRaw (
332     UINT32                  RequestedDebugLevel,
333     UINT32                  LineNumber,
334     const char              *FunctionName,
335     const char              *ModuleName,
336     UINT32                  ComponentId,
337     const char              *Format,
338     ...)
339 {
340     va_list                 args;
341
342
343     if (!(RequestedDebugLevel & AcpiDbgLevel) ||
344         !(ComponentId & AcpiDbgLayer))
345     {
346         return;
347     }
348
349     va_start (args, Format);
350     AcpiOsVprintf (Format, args);
351     va_end (args);
352 }
353
354 ACPI_EXPORT_SYMBOL (AcpiDebugPrintRaw)
355
356
357 /*******************************************************************************
358  *
359  * FUNCTION:    AcpiUtTrace
360  *
361  * PARAMETERS:  LineNumber          - Caller's line number
362  *              FunctionName        - Caller's procedure name
363  *              ModuleName          - Caller's module name
364  *              ComponentId         - Caller's component ID
365  *
366  * RETURN:      None
367  *
368  * DESCRIPTION: Function entry trace.  Prints only if TRACE_FUNCTIONS bit is
369  *              set in DebugLevel
370  *
371  ******************************************************************************/
372
373 void
374 AcpiUtTrace (
375     UINT32                  LineNumber,
376     const char              *FunctionName,
377     const char              *ModuleName,
378     UINT32                  ComponentId)
379 {
380
381     AcpiGbl_NestingLevel++;
382     AcpiUtTrackStackPtr ();
383
384     AcpiDebugPrint (ACPI_LV_FUNCTIONS,
385         LineNumber, FunctionName, ModuleName, ComponentId,
386         "%s\n", AcpiGbl_FnEntryStr);
387 }
388
389 ACPI_EXPORT_SYMBOL (AcpiUtTrace)
390
391
392 /*******************************************************************************
393  *
394  * FUNCTION:    AcpiUtTracePtr
395  *
396  * PARAMETERS:  LineNumber          - Caller's line number
397  *              FunctionName        - Caller's procedure name
398  *              ModuleName          - Caller's module name
399  *              ComponentId         - Caller's component ID
400  *              Pointer             - Pointer to display
401  *
402  * RETURN:      None
403  *
404  * DESCRIPTION: Function entry trace.  Prints only if TRACE_FUNCTIONS bit is
405  *              set in DebugLevel
406  *
407  ******************************************************************************/
408
409 void
410 AcpiUtTracePtr (
411     UINT32                  LineNumber,
412     const char              *FunctionName,
413     const char              *ModuleName,
414     UINT32                  ComponentId,
415     void                    *Pointer)
416 {
417     AcpiGbl_NestingLevel++;
418     AcpiUtTrackStackPtr ();
419
420     AcpiDebugPrint (ACPI_LV_FUNCTIONS,
421         LineNumber, FunctionName, ModuleName, ComponentId,
422         "%s %p\n", AcpiGbl_FnEntryStr, Pointer);
423 }
424
425
426 /*******************************************************************************
427  *
428  * FUNCTION:    AcpiUtTraceStr
429  *
430  * PARAMETERS:  LineNumber          - Caller's line number
431  *              FunctionName        - Caller's procedure name
432  *              ModuleName          - Caller's module name
433  *              ComponentId         - Caller's component ID
434  *              String              - Additional string to display
435  *
436  * RETURN:      None
437  *
438  * DESCRIPTION: Function entry trace.  Prints only if TRACE_FUNCTIONS bit is
439  *              set in DebugLevel
440  *
441  ******************************************************************************/
442
443 void
444 AcpiUtTraceStr (
445     UINT32                  LineNumber,
446     const char              *FunctionName,
447     const char              *ModuleName,
448     UINT32                  ComponentId,
449     char                    *String)
450 {
451
452     AcpiGbl_NestingLevel++;
453     AcpiUtTrackStackPtr ();
454
455     AcpiDebugPrint (ACPI_LV_FUNCTIONS,
456         LineNumber, FunctionName, ModuleName, ComponentId,
457         "%s %s\n", AcpiGbl_FnEntryStr, String);
458 }
459
460
461 /*******************************************************************************
462  *
463  * FUNCTION:    AcpiUtTraceU32
464  *
465  * PARAMETERS:  LineNumber          - Caller's line number
466  *              FunctionName        - Caller's procedure name
467  *              ModuleName          - Caller's module name
468  *              ComponentId         - Caller's component ID
469  *              Integer             - Integer to display
470  *
471  * RETURN:      None
472  *
473  * DESCRIPTION: Function entry trace.  Prints only if TRACE_FUNCTIONS bit is
474  *              set in DebugLevel
475  *
476  ******************************************************************************/
477
478 void
479 AcpiUtTraceU32 (
480     UINT32                  LineNumber,
481     const char              *FunctionName,
482     const char              *ModuleName,
483     UINT32                  ComponentId,
484     UINT32                  Integer)
485 {
486
487     AcpiGbl_NestingLevel++;
488     AcpiUtTrackStackPtr ();
489
490     AcpiDebugPrint (ACPI_LV_FUNCTIONS,
491         LineNumber, FunctionName, ModuleName, ComponentId,
492         "%s %08X\n", AcpiGbl_FnEntryStr, Integer);
493 }
494
495
496 /*******************************************************************************
497  *
498  * FUNCTION:    AcpiUtExit
499  *
500  * PARAMETERS:  LineNumber          - Caller's line number
501  *              FunctionName        - Caller's procedure name
502  *              ModuleName          - Caller's module name
503  *              ComponentId         - Caller's component ID
504  *
505  * RETURN:      None
506  *
507  * DESCRIPTION: Function exit trace.  Prints only if TRACE_FUNCTIONS bit is
508  *              set in DebugLevel
509  *
510  ******************************************************************************/
511
512 void
513 AcpiUtExit (
514     UINT32                  LineNumber,
515     const char              *FunctionName,
516     const char              *ModuleName,
517     UINT32                  ComponentId)
518 {
519
520     AcpiDebugPrint (ACPI_LV_FUNCTIONS,
521         LineNumber, FunctionName, ModuleName, ComponentId,
522         "%s\n", AcpiGbl_FnExitStr);
523
524     AcpiGbl_NestingLevel--;
525 }
526
527 ACPI_EXPORT_SYMBOL (AcpiUtExit)
528
529
530 /*******************************************************************************
531  *
532  * FUNCTION:    AcpiUtStatusExit
533  *
534  * PARAMETERS:  LineNumber          - Caller's line number
535  *              FunctionName        - Caller's procedure name
536  *              ModuleName          - Caller's module name
537  *              ComponentId         - Caller's component ID
538  *              Status              - Exit status code
539  *
540  * RETURN:      None
541  *
542  * DESCRIPTION: Function exit trace.  Prints only if TRACE_FUNCTIONS bit is
543  *              set in DebugLevel.  Prints exit status also.
544  *
545  ******************************************************************************/
546
547 void
548 AcpiUtStatusExit (
549     UINT32                  LineNumber,
550     const char              *FunctionName,
551     const char              *ModuleName,
552     UINT32                  ComponentId,
553     ACPI_STATUS             Status)
554 {
555
556     if (ACPI_SUCCESS (Status))
557     {
558         AcpiDebugPrint (ACPI_LV_FUNCTIONS,
559             LineNumber, FunctionName, ModuleName, ComponentId,
560             "%s %s\n", AcpiGbl_FnExitStr,
561             AcpiFormatException (Status));
562     }
563     else
564     {
565         AcpiDebugPrint (ACPI_LV_FUNCTIONS,
566             LineNumber, FunctionName, ModuleName, ComponentId,
567             "%s ****Exception****: %s\n", AcpiGbl_FnExitStr,
568             AcpiFormatException (Status));
569     }
570
571     AcpiGbl_NestingLevel--;
572 }
573
574 ACPI_EXPORT_SYMBOL (AcpiUtStatusExit)
575
576
577 /*******************************************************************************
578  *
579  * FUNCTION:    AcpiUtValueExit
580  *
581  * PARAMETERS:  LineNumber          - Caller's line number
582  *              FunctionName        - Caller's procedure name
583  *              ModuleName          - Caller's module name
584  *              ComponentId         - Caller's component ID
585  *              Value               - Value to be printed with exit msg
586  *
587  * RETURN:      None
588  *
589  * DESCRIPTION: Function exit trace.  Prints only if TRACE_FUNCTIONS bit is
590  *              set in DebugLevel.  Prints exit value also.
591  *
592  ******************************************************************************/
593
594 void
595 AcpiUtValueExit (
596     UINT32                  LineNumber,
597     const char              *FunctionName,
598     const char              *ModuleName,
599     UINT32                  ComponentId,
600     UINT64                  Value)
601 {
602
603     AcpiDebugPrint (ACPI_LV_FUNCTIONS,
604         LineNumber, FunctionName, ModuleName, ComponentId,
605         "%s %8.8X%8.8X\n", AcpiGbl_FnExitStr,
606         ACPI_FORMAT_UINT64 (Value));
607
608     AcpiGbl_NestingLevel--;
609 }
610
611 ACPI_EXPORT_SYMBOL (AcpiUtValueExit)
612
613
614 /*******************************************************************************
615  *
616  * FUNCTION:    AcpiUtPtrExit
617  *
618  * PARAMETERS:  LineNumber          - Caller's line number
619  *              FunctionName        - Caller's procedure name
620  *              ModuleName          - Caller's module name
621  *              ComponentId         - Caller's component ID
622  *              Ptr                 - Pointer to display
623  *
624  * RETURN:      None
625  *
626  * DESCRIPTION: Function exit trace.  Prints only if TRACE_FUNCTIONS bit is
627  *              set in DebugLevel.  Prints exit value also.
628  *
629  ******************************************************************************/
630
631 void
632 AcpiUtPtrExit (
633     UINT32                  LineNumber,
634     const char              *FunctionName,
635     const char              *ModuleName,
636     UINT32                  ComponentId,
637     UINT8                   *Ptr)
638 {
639
640     AcpiDebugPrint (ACPI_LV_FUNCTIONS,
641         LineNumber, FunctionName, ModuleName, ComponentId,
642         "%s %p\n", AcpiGbl_FnExitStr, Ptr);
643
644     AcpiGbl_NestingLevel--;
645 }
646
647 #endif
648
649
650 /*******************************************************************************
651  *
652  * FUNCTION:    AcpiUtDumpBuffer
653  *
654  * PARAMETERS:  Buffer              - Buffer to dump
655  *              Count               - Amount to dump, in bytes
656  *              Display             - BYTE, WORD, DWORD, or QWORD display
657  *              ComponentID         - Caller's component ID
658  *
659  * RETURN:      None
660  *
661  * DESCRIPTION: Generic dump buffer in both hex and ascii.
662  *
663  ******************************************************************************/
664
665 void
666 AcpiUtDumpBuffer2 (
667     UINT8                   *Buffer,
668     UINT32                  Count,
669     UINT32                  Display)
670 {
671     UINT32                  i = 0;
672     UINT32                  j;
673     UINT32                  Temp32;
674     UINT8                   BufChar;
675
676
677     if (!Buffer)
678     {
679         AcpiOsPrintf ("Null Buffer Pointer in DumpBuffer!\n");
680         return;
681     }
682
683     if ((Count < 4) || (Count & 0x01))
684     {
685         Display = DB_BYTE_DISPLAY;
686     }
687
688     /* Nasty little dump buffer routine! */
689
690     while (i < Count)
691     {
692         /* Print current offset */
693
694         AcpiOsPrintf ("%6.4X: ", i);
695
696         /* Print 16 hex chars */
697
698         for (j = 0; j < 16;)
699         {
700             if (i + j >= Count)
701             {
702                 /* Dump fill spaces */
703
704                 AcpiOsPrintf ("%*s", ((Display * 2) + 1), " ");
705                 j += Display;
706                 continue;
707             }
708
709             switch (Display)
710             {
711             case DB_BYTE_DISPLAY:
712             default:    /* Default is BYTE display */
713
714                 AcpiOsPrintf ("%02X ", Buffer[(ACPI_SIZE) i + j]);
715                 break;
716
717
718             case DB_WORD_DISPLAY:
719
720                 ACPI_MOVE_16_TO_32 (&Temp32, &Buffer[(ACPI_SIZE) i + j]);
721                 AcpiOsPrintf ("%04X ", Temp32);
722                 break;
723
724
725             case DB_DWORD_DISPLAY:
726
727                 ACPI_MOVE_32_TO_32 (&Temp32, &Buffer[(ACPI_SIZE) i + j]);
728                 AcpiOsPrintf ("%08X ", Temp32);
729                 break;
730
731
732             case DB_QWORD_DISPLAY:
733
734                 ACPI_MOVE_32_TO_32 (&Temp32, &Buffer[(ACPI_SIZE) i + j]);
735                 AcpiOsPrintf ("%08X", Temp32);
736
737                 ACPI_MOVE_32_TO_32 (&Temp32, &Buffer[(ACPI_SIZE) i + j + 4]);
738                 AcpiOsPrintf ("%08X ", Temp32);
739                 break;
740             }
741
742             j += Display;
743         }
744
745         /*
746          * Print the ASCII equivalent characters but watch out for the bad
747          * unprintable ones (printable chars are 0x20 through 0x7E)
748          */
749         AcpiOsPrintf (" ");
750         for (j = 0; j < 16; j++)
751         {
752             if (i + j >= Count)
753             {
754                 AcpiOsPrintf ("\n");
755                 return;
756             }
757
758             BufChar = Buffer[(ACPI_SIZE) i + j];
759             if (ACPI_IS_PRINT (BufChar))
760             {
761                 AcpiOsPrintf ("%c", BufChar);
762             }
763             else
764             {
765                 AcpiOsPrintf (".");
766             }
767         }
768
769         /* Done with that line. */
770
771         AcpiOsPrintf ("\n");
772         i += 16;
773     }
774
775     return;
776 }
777
778
779 /*******************************************************************************
780  *
781  * FUNCTION:    AcpiUtDumpBuffer
782  *
783  * PARAMETERS:  Buffer              - Buffer to dump
784  *              Count               - Amount to dump, in bytes
785  *              Display             - BYTE, WORD, DWORD, or QWORD display
786  *              ComponentID         - Caller's component ID
787  *
788  * RETURN:      None
789  *
790  * DESCRIPTION: Generic dump buffer in both hex and ascii.
791  *
792  ******************************************************************************/
793
794 void
795 AcpiUtDumpBuffer (
796     UINT8                   *Buffer,
797     UINT32                  Count,
798     UINT32                  Display,
799     UINT32                  ComponentId)
800 {
801
802     /* Only dump the buffer if tracing is enabled */
803
804     if (!((ACPI_LV_TABLES & AcpiDbgLevel) &&
805         (ComponentId & AcpiDbgLayer)))
806     {
807         return;
808     }
809
810     AcpiUtDumpBuffer2 (Buffer, Count, Display);
811 }
812
813