xref: /titanic_41/usr/src/uts/intel/io/acpica/utilities/utdebug.c (revision d2b5b2d357ee3172eacb6860be1891259902203d)
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 - 2009, 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 %p to TID %p ****\n\n",
283                 ACPI_CAST_PTR (void, AcpiGbl_PrevThreadId),
284                 ACPI_CAST_PTR (void, ThreadId));
285         }
286 
287         AcpiGbl_PrevThreadId = ThreadId;
288     }
289 
290     /*
291      * Display the module name, current line number, thread ID (if requested),
292      * current procedure nesting level, and the current procedure name
293      */
294     AcpiOsPrintf ("%8s-%04ld ", ModuleName, LineNumber);
295 
296     if (ACPI_LV_THREADS & AcpiDbgLevel)
297     {
298         AcpiOsPrintf ("[%p] ", ACPI_CAST_PTR (void, ThreadId));
299     }
300 
301     AcpiOsPrintf ("[%02ld] %-22.22s: ",
302         AcpiGbl_NestingLevel, AcpiUtTrimFunctionName (FunctionName));
303 
304     va_start (args, Format);
305     AcpiOsVprintf (Format, args);
306     va_end (args);
307 }
308 
309 ACPI_EXPORT_SYMBOL (AcpiDebugPrint)
310 
311 
312 /*******************************************************************************
313  *
314  * FUNCTION:    AcpiDebugPrintRaw
315  *
316  * PARAMETERS:  RequestedDebugLevel - Requested debug print level
317  *              LineNumber          - Caller's line number
318  *              FunctionName        - Caller's procedure name
319  *              ModuleName          - Caller's module name
320  *              ComponentId         - Caller's component ID
321  *              Format              - Printf format field
322  *              ...                 - Optional printf arguments
323  *
324  * RETURN:      None
325  *
326  * DESCRIPTION: Print message with no headers.  Has same interface as
327  *              DebugPrint so that the same macros can be used.
328  *
329  ******************************************************************************/
330 
331 void  ACPI_INTERNAL_VAR_XFACE
332 AcpiDebugPrintRaw (
333     UINT32                  RequestedDebugLevel,
334     UINT32                  LineNumber,
335     const char              *FunctionName,
336     const char              *ModuleName,
337     UINT32                  ComponentId,
338     const char              *Format,
339     ...)
340 {
341     va_list                 args;
342 
343 
344     if (!(RequestedDebugLevel & AcpiDbgLevel) ||
345         !(ComponentId & AcpiDbgLayer))
346     {
347         return;
348     }
349 
350     va_start (args, Format);
351     AcpiOsVprintf (Format, args);
352     va_end (args);
353 }
354 
355 ACPI_EXPORT_SYMBOL (AcpiDebugPrintRaw)
356 
357 
358 /*******************************************************************************
359  *
360  * FUNCTION:    AcpiUtTrace
361  *
362  * PARAMETERS:  LineNumber          - Caller's line number
363  *              FunctionName        - Caller's procedure name
364  *              ModuleName          - Caller's module name
365  *              ComponentId         - Caller's component ID
366  *
367  * RETURN:      None
368  *
369  * DESCRIPTION: Function entry trace.  Prints only if TRACE_FUNCTIONS bit is
370  *              set in DebugLevel
371  *
372  ******************************************************************************/
373 
374 void
375 AcpiUtTrace (
376     UINT32                  LineNumber,
377     const char              *FunctionName,
378     const char              *ModuleName,
379     UINT32                  ComponentId)
380 {
381 
382     AcpiGbl_NestingLevel++;
383     AcpiUtTrackStackPtr ();
384 
385     AcpiDebugPrint (ACPI_LV_FUNCTIONS,
386         LineNumber, FunctionName, ModuleName, ComponentId,
387         "%s\n", AcpiGbl_FnEntryStr);
388 }
389 
390 ACPI_EXPORT_SYMBOL (AcpiUtTrace)
391 
392 
393 /*******************************************************************************
394  *
395  * FUNCTION:    AcpiUtTracePtr
396  *
397  * PARAMETERS:  LineNumber          - Caller's line number
398  *              FunctionName        - Caller's procedure name
399  *              ModuleName          - Caller's module name
400  *              ComponentId         - Caller's component ID
401  *              Pointer             - Pointer to display
402  *
403  * RETURN:      None
404  *
405  * DESCRIPTION: Function entry trace.  Prints only if TRACE_FUNCTIONS bit is
406  *              set in DebugLevel
407  *
408  ******************************************************************************/
409 
410 void
411 AcpiUtTracePtr (
412     UINT32                  LineNumber,
413     const char              *FunctionName,
414     const char              *ModuleName,
415     UINT32                  ComponentId,
416     void                    *Pointer)
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     ACPI_INTEGER            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  *              ComponentID         - Caller's component ID
659  *
660  * RETURN:      None
661  *
662  * DESCRIPTION: Generic dump buffer in both hex and ascii.
663  *
664  ******************************************************************************/
665 
666 void
667 AcpiUtDumpBuffer2 (
668     UINT8                   *Buffer,
669     UINT32                  Count,
670     UINT32                  Display)
671 {
672     UINT32                  i = 0;
673     UINT32                  j;
674     UINT32                  Temp32;
675     UINT8                   BufChar;
676 
677 
678     if (!Buffer)
679     {
680         AcpiOsPrintf ("Null Buffer Pointer in DumpBuffer!\n");
681         return;
682     }
683 
684     if ((Count < 4) || (Count & 0x01))
685     {
686         Display = DB_BYTE_DISPLAY;
687     }
688 
689     /* Nasty little dump buffer routine! */
690 
691     while (i < Count)
692     {
693         /* Print current offset */
694 
695         AcpiOsPrintf ("%6.4X: ", i);
696 
697         /* Print 16 hex chars */
698 
699         for (j = 0; j < 16;)
700         {
701             if (i + j >= Count)
702             {
703                 /* Dump fill spaces */
704 
705                 AcpiOsPrintf ("%*s", ((Display * 2) + 1), " ");
706                 j += Display;
707                 continue;
708             }
709 
710             switch (Display)
711             {
712             case DB_BYTE_DISPLAY:
713             default:    /* Default is BYTE display */
714 
715                 AcpiOsPrintf ("%02X ", Buffer[(ACPI_SIZE) i + j]);
716                 break;
717 
718 
719             case DB_WORD_DISPLAY:
720 
721                 ACPI_MOVE_16_TO_32 (&Temp32, &Buffer[(ACPI_SIZE) i + j]);
722                 AcpiOsPrintf ("%04X ", Temp32);
723                 break;
724 
725 
726             case DB_DWORD_DISPLAY:
727 
728                 ACPI_MOVE_32_TO_32 (&Temp32, &Buffer[(ACPI_SIZE) i + j]);
729                 AcpiOsPrintf ("%08X ", Temp32);
730                 break;
731 
732 
733             case DB_QWORD_DISPLAY:
734 
735                 ACPI_MOVE_32_TO_32 (&Temp32, &Buffer[(ACPI_SIZE) i + j]);
736                 AcpiOsPrintf ("%08X", Temp32);
737 
738                 ACPI_MOVE_32_TO_32 (&Temp32, &Buffer[(ACPI_SIZE) i + j + 4]);
739                 AcpiOsPrintf ("%08X ", Temp32);
740                 break;
741             }
742 
743             j += Display;
744         }
745 
746         /*
747          * Print the ASCII equivalent characters but watch out for the bad
748          * unprintable ones (printable chars are 0x20 through 0x7E)
749          */
750         AcpiOsPrintf (" ");
751         for (j = 0; j < 16; j++)
752         {
753             if (i + j >= Count)
754             {
755                 AcpiOsPrintf ("\n");
756                 return;
757             }
758 
759             BufChar = Buffer[(ACPI_SIZE) i + j];
760             if (ACPI_IS_PRINT (BufChar))
761             {
762                 AcpiOsPrintf ("%c", BufChar);
763             }
764             else
765             {
766                 AcpiOsPrintf (".");
767             }
768         }
769 
770         /* Done with that line. */
771 
772         AcpiOsPrintf ("\n");
773         i += 16;
774     }
775 
776     return;
777 }
778 
779 
780 /*******************************************************************************
781  *
782  * FUNCTION:    AcpiUtDumpBuffer
783  *
784  * PARAMETERS:  Buffer              - Buffer to dump
785  *              Count               - Amount to dump, in bytes
786  *              Display             - BYTE, WORD, DWORD, or QWORD display
787  *              ComponentID         - Caller's component ID
788  *
789  * RETURN:      None
790  *
791  * DESCRIPTION: Generic dump buffer in both hex and ascii.
792  *
793  ******************************************************************************/
794 
795 void
796 AcpiUtDumpBuffer (
797     UINT8                   *Buffer,
798     UINT32                  Count,
799     UINT32                  Display,
800     UINT32                  ComponentId)
801 {
802 
803     /* Only dump the buffer if tracing is enabled */
804 
805     if (!((ACPI_LV_TABLES & AcpiDbgLevel) &&
806         (ComponentId & AcpiDbgLayer)))
807     {
808         return;
809     }
810 
811     AcpiUtDumpBuffer2 (Buffer, Count, Display);
812 }
813 
814 
815