/******************************************************************************
*
* Module Name: utbuffer - Buffer dump routines
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer,
* without modification.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon
* including a substantially similar Disclaimer requirement for further
* binary redistribution.
* 3. Neither the names of the above-listed copyright holders nor the names
* of any contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
* NO WARRANTY
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*/
#include "acpi.h"
#include "accommon.h"
ACPI_MODULE_NAME ("utbuffer")
/*******************************************************************************
*
* FUNCTION: AcpiUtDumpBuffer
*
* PARAMETERS: Buffer - Buffer to dump
* Count - Amount to dump, in bytes
* Display - BYTE, WORD, DWORD, or QWORD display:
* DB_BYTE_DISPLAY
* DB_WORD_DISPLAY
* DB_DWORD_DISPLAY
* DB_QWORD_DISPLAY
* BaseOffset - Beginning buffer offset (display only)
*
* RETURN: None
*
* DESCRIPTION: Generic dump buffer in both hex and ascii.
*
******************************************************************************/
void
{
UINT32 i = 0;
UINT32 j;
if (!Buffer)
{
AcpiOsPrintf ("Null Buffer Pointer in DumpBuffer!\n");
return;
}
{
}
/* Nasty little dump buffer routine! */
while (i < Count)
{
/* Print current offset */
/* Print 16 hex chars */
for (j = 0; j < 16;)
{
if (i + j >= Count)
{
/* Dump fill spaces */
j += Display;
continue;
}
switch (Display)
{
case DB_BYTE_DISPLAY:
default: /* Default is BYTE display */
break;
case DB_WORD_DISPLAY:
break;
case DB_DWORD_DISPLAY:
break;
case DB_QWORD_DISPLAY:
break;
}
j += Display;
}
/*
* Print the ASCII equivalent characters but watch out for the bad
* unprintable ones (printable chars are 0x20 through 0x7E)
*/
AcpiOsPrintf (" ");
for (j = 0; j < 16; j++)
{
if (i + j >= Count)
{
AcpiOsPrintf ("\n");
return;
}
/*
* Add comment characters so rest of line is ignored when
* compiled
*/
if (j == 0)
{
AcpiOsPrintf ("// ");
}
{
}
else
{
AcpiOsPrintf (".");
}
}
/* Done with that line. */
AcpiOsPrintf ("\n");
i += 16;
}
return;
}
/*******************************************************************************
*
* FUNCTION: AcpiUtDebugDumpBuffer
*
* PARAMETERS: Buffer - Buffer to dump
* Count - Amount to dump, in bytes
* Display - BYTE, WORD, DWORD, or QWORD display:
* DB_BYTE_DISPLAY
* DB_WORD_DISPLAY
* DB_DWORD_DISPLAY
* DB_QWORD_DISPLAY
* ComponentID - Caller's component ID
*
* RETURN: None
*
* DESCRIPTION: Generic dump buffer in both hex and ascii.
*
******************************************************************************/
void
{
/* Only dump the buffer if tracing is enabled */
if (!((ACPI_LV_TABLES & AcpiDbgLevel) &&
(ComponentId & AcpiDbgLayer)))
{
return;
}
}
#ifdef ACPI_APPLICATION
/*******************************************************************************
*
* FUNCTION: AcpiUtDumpBufferToFile
*
* PARAMETERS: File - File descriptor
* Buffer - Buffer to dump
* Count - Amount to dump, in bytes
* Display - BYTE, WORD, DWORD, or QWORD display:
* DB_BYTE_DISPLAY
* DB_WORD_DISPLAY
* DB_DWORD_DISPLAY
* DB_QWORD_DISPLAY
* BaseOffset - Beginning buffer offset (display only)
*
* RETURN: None
*
* DESCRIPTION: Generic dump buffer in both hex and ascii to a file.
*
******************************************************************************/
void
{
UINT32 i = 0;
UINT32 j;
if (!Buffer)
{
return;
}
{
}
/* Nasty little dump buffer routine! */
while (i < Count)
{
/* Print current offset */
/* Print 16 hex chars */
for (j = 0; j < 16;)
{
if (i + j >= Count)
{
/* Dump fill spaces */
j += Display;
continue;
}
switch (Display)
{
case DB_BYTE_DISPLAY:
default: /* Default is BYTE display */
break;
case DB_WORD_DISPLAY:
break;
case DB_DWORD_DISPLAY:
break;
case DB_QWORD_DISPLAY:
break;
}
j += Display;
}
/*
* Print the ASCII equivalent characters but watch out for the bad
* unprintable ones (printable chars are 0x20 through 0x7E)
*/
for (j = 0; j < 16; j++)
{
if (i + j >= Count)
{
return;
}
{
}
else
{
}
}
/* Done with that line. */
i += 16;
}
return;
}
#endif