iASL: DTC/Disassembler: Standardize buffer format.

Make all buffer values have the same format, rather than three
different formats.
This commit is contained in:
Robert Moore 2010-06-18 10:33:18 -07:00
parent 42cf3e7371
commit 65652115cc
4 changed files with 77 additions and 75 deletions

View File

@ -813,7 +813,11 @@ AcpiDmDumpTable (
for (Temp8 = 0; Temp8 < 16; Temp8++)
{
AcpiOsPrintf ("%2.2X,", Target[Temp8]);
AcpiOsPrintf ("%2.2X", Target[Temp8]);
if ((Temp8 + 1) < 16)
{
AcpiOsPrintf (",");
}
}
AcpiOsPrintf ("\n");
break;

View File

@ -619,7 +619,7 @@ AcpiDmDumpDmar (
while (PathOffset < ScopeTable->Length)
{
AcpiDmLineHeader ((PathOffset + ScopeOffset + Offset), 2, "PCI Path");
AcpiOsPrintf ("[%2.2X, %2.2X]\n", PciPath[0], PciPath[1]);
AcpiOsPrintf ("%2.2X,%2.2X\n", PciPath[0], PciPath[1]);
/* Point to next PCI Path entry */
@ -1325,15 +1325,20 @@ AcpiDmDumpSlit (
return;
}
AcpiOsPrintf ("%2.2X ", Row[j]);
AcpiOsPrintf ("%2.2X", Row[j]);
Offset++;
/* Display up to 16 bytes per output row */
if (j && (((j+1) % 16) == 0) && ((j+1) < Localities))
if ((j+1) < Localities)
{
AcpiOsPrintf ("\n");
AcpiDmLineHeader (Offset, 0, "");
AcpiOsPrintf (",");
if (j && (((j+1) % 16) == 0))
{
AcpiOsPrintf ("\n");
AcpiDmLineHeader (Offset, 0, "");
}
}
}

View File

@ -131,15 +131,9 @@ DtCompileString (
UINT32 ByteLength);
static char *
DtPciPathToBuffer (
char *PciPath);
static void
DtCompilePciPath (
UINT8 *Buffer,
char *StringValue,
DT_FIELD *Field,
UINT32 ByteLength);
DtNormalizeBuffer (
char *Buffer,
UINT32 *Count);
/******************************************************************************
@ -180,10 +174,6 @@ DtCompileOneField (
DtCompileBuffer (Buffer, Field->Value, Field, ByteLength);
break;
case DT_FIELD_TYPE_PCI_PATH:
DtCompilePciPath (Buffer, Field->Value, Field, ByteLength);
break;
default:
DtFatal (ASL_MSG_COMPILER_INTERNAL, Field, "Invalid field type");
break;
@ -344,33 +334,68 @@ Exit:
/******************************************************************************
*
* FUNCTION: DtPciPathToBuffer
* FUNCTION: DtNormalizeBuffer
*
* PARAMETERS: PciPath - DMAR "PCI Path" field
* PARAMETERS: Buffer - Input buffer
* Count - Output the count of hex number in
* the Buffer
*
* RETURN: Strings of PCI path
* RETURN: The normalized buffer, freed by caller
*
* DESCRIPTION: Remove brackets and comma from DMAR "PCI Path" string, for
* example: [1D, 01] ==> 1D 01
* DESCRIPTION: [1A,2B,3C,4D] or 1A, 2B, 3C, 4D will be normalized
* to 1A 2B 3C 4D
*
*****************************************************************************/
static char *
DtPciPathToBuffer (
char *PciPath)
DtNormalizeBuffer (
char *Buffer,
UINT32 *Count)
{
char *Buffer;
char *NewBuffer;
char *TmpBuffer;
UINT32 BufferCount = 0;
BOOLEAN Separator = TRUE;
char c;
Buffer = UtLocalCalloc (6);
NewBuffer = UtLocalCalloc (ACPI_STRLEN (Buffer) + 1);
TmpBuffer = NewBuffer;
Buffer[0] = PciPath[1];
Buffer[1] = PciPath[2];
Buffer[2] = ' ';
Buffer[3] = PciPath[5];
Buffer[4] = PciPath[6];
while ((c = *Buffer++))
{
switch (c)
{
/* Valid separators */
return (Buffer);
case '[':
case ']':
case ' ':
case ',':
Separator = TRUE;
break;
default:
if (Separator)
{
/* Insert blank as the standard separator */
if (NewBuffer[0])
{
*TmpBuffer++ = ' ';
BufferCount++;
}
Separator = FALSE;
}
*TmpBuffer++ = c;
break;
}
}
*Count = BufferCount + 1;
return (NewBuffer);
}
@ -404,13 +429,17 @@ DtCompileBuffer (
UINT32 Count;
Count = ACPI_STRLEN (StringValue) / 3 + 1;
/* Allow several different types of value separators */
StringValue = DtNormalizeBuffer (StringValue, &Count);
Hex[2] = 0;
for (i = 0; i < Count; i++)
{
Hex[0] = StringValue[0];
Hex[1] = StringValue[1];
/* Each element of StringValue is three chars */
Hex[0] = StringValue[(3 * i)];
Hex[1] = StringValue[(3 * i) + 1];
/* Convert one hex byte */
@ -423,46 +452,13 @@ DtCompileBuffer (
}
Buffer[i] = (UINT8) Value;
StringValue += 3;
}
ACPI_FREE (StringValue);
return (ByteLength - Count);
}
/******************************************************************************
*
* FUNCTION: DtCompilePciPath
*
* PARAMETERS: Buffer - Output buffer
* StringValue - DMAR pci path string
* ByteLength - Byte length of DMAR pci path string, 2
*
* RETURN: None
*
* DESCRIPTION: Compile DMAR PCI path string to binary
*
*****************************************************************************/
static void
DtCompilePciPath (
UINT8 *Buffer,
char *StringValue,
DT_FIELD *Field,
UINT32 ByteLength)
{
char *PciPathBuffer;
/* Parse path to simple hex digits, then convert to binary */
PciPathBuffer = DtPciPathToBuffer (StringValue);
DtCompileBuffer (Buffer, PciPathBuffer, Field, ByteLength);
ACPI_FREE (PciPathBuffer);
}
/******************************************************************************
*
* FUNCTION: DtCompileFlag

View File

@ -472,11 +472,8 @@ DtGetFieldType (
case ACPI_DMT_BUFFER:
case ACPI_DMT_BUF16:
Type = DT_FIELD_TYPE_BUFFER;
break;
case ACPI_DMT_PCI_PATH:
Type = DT_FIELD_TYPE_PCI_PATH;
Type = DT_FIELD_TYPE_BUFFER;
break;
case ACPI_DMT_GAS: