xref: /haiku/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utdebug.c (revision 820dca4df6c7bf955c46e8f6521b9408f50b2900)
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 - 2012, 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 "acpi.h"
119 #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 
418     AcpiGbl_NestingLevel++;
419     AcpiUtTrackStackPtr ();
420 
421     AcpiDebugPrint (ACPI_LV_FUNCTIONS,
422         LineNumber, FunctionName, ModuleName, ComponentId,
423         "%s %p\n", AcpiGbl_FnEntryStr, Pointer);
424 }
425 
426 
427 /*******************************************************************************
428  *
429  * FUNCTION:    AcpiUtTraceStr
430  *
431  * PARAMETERS:  LineNumber          - Caller's line number
432  *              FunctionName        - Caller's procedure name
433  *              ModuleName          - Caller's module name
434  *              ComponentId         - Caller's component ID
435  *              String              - Additional string to display
436  *
437  * RETURN:      None
438  *
439  * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is
440  *              set in DebugLevel
441  *
442  ******************************************************************************/
443 
444 void
445 AcpiUtTraceStr (
446     UINT32                  LineNumber,
447     const char              *FunctionName,
448     const char              *ModuleName,
449     UINT32                  ComponentId,
450     char                    *String)
451 {
452 
453     AcpiGbl_NestingLevel++;
454     AcpiUtTrackStackPtr ();
455 
456     AcpiDebugPrint (ACPI_LV_FUNCTIONS,
457         LineNumber, FunctionName, ModuleName, ComponentId,
458         "%s %s\n", AcpiGbl_FnEntryStr, String);
459 }
460 
461 
462 /*******************************************************************************
463  *
464  * FUNCTION:    AcpiUtTraceU32
465  *
466  * PARAMETERS:  LineNumber          - Caller's line number
467  *              FunctionName        - Caller's procedure name
468  *              ModuleName          - Caller's module name
469  *              ComponentId         - Caller's component ID
470  *              Integer             - Integer to display
471  *
472  * RETURN:      None
473  *
474  * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is
475  *              set in DebugLevel
476  *
477  ******************************************************************************/
478 
479 void
480 AcpiUtTraceU32 (
481     UINT32                  LineNumber,
482     const char              *FunctionName,
483     const char              *ModuleName,
484     UINT32                  ComponentId,
485     UINT32                  Integer)
486 {
487 
488     AcpiGbl_NestingLevel++;
489     AcpiUtTrackStackPtr ();
490 
491     AcpiDebugPrint (ACPI_LV_FUNCTIONS,
492         LineNumber, FunctionName, ModuleName, ComponentId,
493         "%s %08X\n", AcpiGbl_FnEntryStr, Integer);
494 }
495 
496 
497 /*******************************************************************************
498  *
499  * FUNCTION:    AcpiUtExit
500  *
501  * PARAMETERS:  LineNumber          - Caller's line number
502  *              FunctionName        - Caller's procedure name
503  *              ModuleName          - Caller's module name
504  *              ComponentId         - Caller's component ID
505  *
506  * RETURN:      None
507  *
508  * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is
509  *              set in DebugLevel
510  *
511  ******************************************************************************/
512 
513 void
514 AcpiUtExit (
515     UINT32                  LineNumber,
516     const char              *FunctionName,
517     const char              *ModuleName,
518     UINT32                  ComponentId)
519 {
520 
521     AcpiDebugPrint (ACPI_LV_FUNCTIONS,
522         LineNumber, FunctionName, ModuleName, ComponentId,
523         "%s\n", AcpiGbl_FnExitStr);
524 
525     AcpiGbl_NestingLevel--;
526 }
527 
528 ACPI_EXPORT_SYMBOL (AcpiUtExit)
529 
530 
531 /*******************************************************************************
532  *
533  * FUNCTION:    AcpiUtStatusExit
534  *
535  * PARAMETERS:  LineNumber          - Caller's line number
536  *              FunctionName        - Caller's procedure name
537  *              ModuleName          - Caller's module name
538  *              ComponentId         - Caller's component ID
539  *              Status              - Exit status code
540  *
541  * RETURN:      None
542  *
543  * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is
544  *              set in DebugLevel. Prints exit status also.
545  *
546  ******************************************************************************/
547 
548 void
549 AcpiUtStatusExit (
550     UINT32                  LineNumber,
551     const char              *FunctionName,
552     const char              *ModuleName,
553     UINT32                  ComponentId,
554     ACPI_STATUS             Status)
555 {
556 
557     if (ACPI_SUCCESS (Status))
558     {
559         AcpiDebugPrint (ACPI_LV_FUNCTIONS,
560             LineNumber, FunctionName, ModuleName, ComponentId,
561             "%s %s\n", AcpiGbl_FnExitStr,
562             AcpiFormatException (Status));
563     }
564     else
565     {
566         AcpiDebugPrint (ACPI_LV_FUNCTIONS,
567             LineNumber, FunctionName, ModuleName, ComponentId,
568             "%s ****Exception****: %s\n", AcpiGbl_FnExitStr,
569             AcpiFormatException (Status));
570     }
571 
572     AcpiGbl_NestingLevel--;
573 }
574 
575 ACPI_EXPORT_SYMBOL (AcpiUtStatusExit)
576 
577 
578 /*******************************************************************************
579  *
580  * FUNCTION:    AcpiUtValueExit
581  *
582  * PARAMETERS:  LineNumber          - Caller's line number
583  *              FunctionName        - Caller's procedure name
584  *              ModuleName          - Caller's module name
585  *              ComponentId         - Caller's component ID
586  *              Value               - Value to be printed with exit msg
587  *
588  * RETURN:      None
589  *
590  * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is
591  *              set in DebugLevel. Prints exit value also.
592  *
593  ******************************************************************************/
594 
595 void
596 AcpiUtValueExit (
597     UINT32                  LineNumber,
598     const char              *FunctionName,
599     const char              *ModuleName,
600     UINT32                  ComponentId,
601     UINT64                  Value)
602 {
603 
604     AcpiDebugPrint (ACPI_LV_FUNCTIONS,
605         LineNumber, FunctionName, ModuleName, ComponentId,
606         "%s %8.8X%8.8X\n", AcpiGbl_FnExitStr,
607         ACPI_FORMAT_UINT64 (Value));
608 
609     AcpiGbl_NestingLevel--;
610 }
611 
612 ACPI_EXPORT_SYMBOL (AcpiUtValueExit)
613 
614 
615 /*******************************************************************************
616  *
617  * FUNCTION:    AcpiUtPtrExit
618  *
619  * PARAMETERS:  LineNumber          - Caller's line number
620  *              FunctionName        - Caller's procedure name
621  *              ModuleName          - Caller's module name
622  *              ComponentId         - Caller's component ID
623  *              Ptr                 - Pointer to display
624  *
625  * RETURN:      None
626  *
627  * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is
628  *              set in DebugLevel. Prints exit value also.
629  *
630  ******************************************************************************/
631 
632 void
633 AcpiUtPtrExit (
634     UINT32                  LineNumber,
635     const char              *FunctionName,
636     const char              *ModuleName,
637     UINT32                  ComponentId,
638     UINT8                   *Ptr)
639 {
640 
641     AcpiDebugPrint (ACPI_LV_FUNCTIONS,
642         LineNumber, FunctionName, ModuleName, ComponentId,
643         "%s %p\n", AcpiGbl_FnExitStr, Ptr);
644 
645     AcpiGbl_NestingLevel--;
646 }
647 
648 #endif
649 
650 
651 /*******************************************************************************
652  *
653  * FUNCTION:    AcpiUtDumpBuffer
654  *
655  * PARAMETERS:  Buffer              - Buffer to dump
656  *              Count               - Amount to dump, in bytes
657  *              Display             - BYTE, WORD, DWORD, or QWORD display
658  *              Offset              - Beginning buffer offset (display only)
659  *
660  * RETURN:      None
661  *
662  * DESCRIPTION: Generic dump buffer in both hex and ascii.
663  *
664  ******************************************************************************/
665 
666 void
667 AcpiUtDumpBuffer (
668     UINT8                   *Buffer,
669     UINT32                  Count,
670     UINT32                  Display,
671     UINT32                  BaseOffset)
672 {
673     UINT32                  i = 0;
674     UINT32                  j;
675     UINT32                  Temp32;
676     UINT8                   BufChar;
677 
678 
679     if (!Buffer)
680     {
681         AcpiOsPrintf ("Null Buffer Pointer in DumpBuffer!\n");
682         return;
683     }
684 
685     if ((Count < 4) || (Count & 0x01))
686     {
687         Display = DB_BYTE_DISPLAY;
688     }
689 
690     /* Nasty little dump buffer routine! */
691 
692     while (i < Count)
693     {
694         /* Print current offset */
695 
696         AcpiOsPrintf ("%6.4X: ", (BaseOffset + i));
697 
698         /* Print 16 hex chars */
699 
700         for (j = 0; j < 16;)
701         {
702             if (i + j >= Count)
703             {
704                 /* Dump fill spaces */
705 
706                 AcpiOsPrintf ("%*s", ((Display * 2) + 1), " ");
707                 j += Display;
708                 continue;
709             }
710 
711             switch (Display)
712             {
713             case DB_BYTE_DISPLAY:
714             default:    /* Default is BYTE display */
715 
716                 AcpiOsPrintf ("%02X ", Buffer[(ACPI_SIZE) i + j]);
717                 break;
718 
719 
720             case DB_WORD_DISPLAY:
721 
722                 ACPI_MOVE_16_TO_32 (&Temp32, &Buffer[(ACPI_SIZE) i + j]);
723                 AcpiOsPrintf ("%04X ", Temp32);
724                 break;
725 
726 
727             case DB_DWORD_DISPLAY:
728 
729                 ACPI_MOVE_32_TO_32 (&Temp32, &Buffer[(ACPI_SIZE) i + j]);
730                 AcpiOsPrintf ("%08X ", Temp32);
731                 break;
732 
733 
734             case DB_QWORD_DISPLAY:
735 
736                 ACPI_MOVE_32_TO_32 (&Temp32, &Buffer[(ACPI_SIZE) i + j]);
737                 AcpiOsPrintf ("%08X", Temp32);
738 
739                 ACPI_MOVE_32_TO_32 (&Temp32, &Buffer[(ACPI_SIZE) i + j + 4]);
740                 AcpiOsPrintf ("%08X ", Temp32);
741                 break;
742             }
743 
744             j += Display;
745         }
746 
747         /*
748          * Print the ASCII equivalent characters but watch out for the bad
749          * unprintable ones (printable chars are 0x20 through 0x7E)
750          */
751         AcpiOsPrintf (" ");
752         for (j = 0; j < 16; j++)
753         {
754             if (i + j >= Count)
755             {
756                 AcpiOsPrintf ("\n");
757                 return;
758             }
759 
760             BufChar = Buffer[(ACPI_SIZE) i + j];
761             if (ACPI_IS_PRINT (BufChar))
762             {
763                 AcpiOsPrintf ("%c", BufChar);
764             }
765             else
766             {
767                 AcpiOsPrintf (".");
768             }
769         }
770 
771         /* Done with that line. */
772 
773         AcpiOsPrintf ("\n");
774         i += 16;
775     }
776 
777     return;
778 }
779 
780 
781 /*******************************************************************************
782  *
783  * FUNCTION:    AcpiUtDebugDumpBuffer
784  *
785  * PARAMETERS:  Buffer              - Buffer to dump
786  *              Count               - Amount to dump, in bytes
787  *              Display             - BYTE, WORD, DWORD, or QWORD display
788  *              ComponentID         - Caller's component ID
789  *
790  * RETURN:      None
791  *
792  * DESCRIPTION: Generic dump buffer in both hex and ascii.
793  *
794  ******************************************************************************/
795 
796 void
797 AcpiUtDebugDumpBuffer (
798     UINT8                   *Buffer,
799     UINT32                  Count,
800     UINT32                  Display,
801     UINT32                  ComponentId)
802 {
803 
804     /* Only dump the buffer if tracing is enabled */
805 
806     if (!((ACPI_LV_TABLES & AcpiDbgLevel) &&
807         (ComponentId & AcpiDbgLayer)))
808     {
809         return;
810     }
811 
812     AcpiUtDumpBuffer (Buffer, Count, Display, 0);
813 }
814