From 45b2e97735a244f4099f423533087e65ded41a42 Mon Sep 17 00:00:00 2001 From: Robert Moore Date: Wed, 2 Jun 2010 14:00:22 -0700 Subject: [PATCH] iASL: Fix several issues with Data Table Compiler. Eliminate duplicate field names in the same table. Do not unnecessarily pad strings with blanks. Fix a problem when compile Flag fields. --- source/common/dmtbinfo.c | 18 +++++++++--------- source/compiler/dtcompile.c | 5 +---- source/compiler/dtcompiler.h | 5 ++--- source/compiler/dtfield.c | 27 +++++++++++++-------------- 4 files changed, 25 insertions(+), 30 deletions(-) diff --git a/source/common/dmtbinfo.c b/source/common/dmtbinfo.c index d7f75fbd3..a82b27b92 100644 --- a/source/common/dmtbinfo.c +++ b/source/common/dmtbinfo.c @@ -810,7 +810,7 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoHest[] = ACPI_DMTABLE_INFO AcpiDmTableInfoHest0[] = { ACPI_DM_HEST_HEADER, - {ACPI_DMT_UINT16, ACPI_HEST0_OFFSET (Reserved1), "Reserved", 0}, + {ACPI_DMT_UINT16, ACPI_HEST0_OFFSET (Reserved1), "Reserved1", 0}, {ACPI_DMT_UINT8, ACPI_HEST0_OFFSET (Flags), "Flags", 0}, {ACPI_DMT_UINT8, ACPI_HEST0_OFFSET (Enabled), "Enabled", 0}, {ACPI_DMT_UINT32, ACPI_HEST0_OFFSET (RecordsToPreallocate), "Records To Preallocate", 0}, @@ -818,7 +818,7 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoHest0[] = {ACPI_DMT_UINT64, ACPI_HEST0_OFFSET (GlobalCapabilityData), "Global Capability Data", 0}, {ACPI_DMT_UINT64, ACPI_HEST0_OFFSET (GlobalControlData), "Global Control Data", 0}, {ACPI_DMT_UINT8, ACPI_HEST0_OFFSET (NumHardwareBanks), "Num Hardware Banks", 0}, - {ACPI_DMT_UINT56, ACPI_HEST0_OFFSET (Reserved3[0]), "Reserved", 0}, + {ACPI_DMT_UINT56, ACPI_HEST0_OFFSET (Reserved3[0]), "Reserved2", 0}, ACPI_DMT_TERMINATOR }; @@ -827,14 +827,14 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoHest0[] = ACPI_DMTABLE_INFO AcpiDmTableInfoHest1[] = { ACPI_DM_HEST_HEADER, - {ACPI_DMT_UINT16, ACPI_HEST1_OFFSET (Reserved1), "Reserved", 0}, + {ACPI_DMT_UINT16, ACPI_HEST1_OFFSET (Reserved1), "Reserved1", 0}, {ACPI_DMT_UINT8, ACPI_HEST1_OFFSET (Flags), "Flags", 0}, {ACPI_DMT_UINT8, ACPI_HEST1_OFFSET (Enabled), "Enabled", 0}, {ACPI_DMT_UINT32, ACPI_HEST1_OFFSET (RecordsToPreallocate), "Records To Preallocate", 0}, {ACPI_DMT_UINT32, ACPI_HEST1_OFFSET (MaxSectionsPerRecord), "Max Sections Per Record", 0}, {ACPI_DMT_HESTNTFY, ACPI_HEST1_OFFSET (Notify), "Notify", 0}, {ACPI_DMT_UINT8, ACPI_HEST1_OFFSET (NumHardwareBanks), "Num Hardware Banks", 0}, - {ACPI_DMT_UINT24, ACPI_HEST1_OFFSET (Reserved2[0]), "Reserved", 0}, + {ACPI_DMT_UINT24, ACPI_HEST1_OFFSET (Reserved2[0]), "Reserved2", 0}, ACPI_DMT_TERMINATOR }; @@ -1427,15 +1427,15 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoSrat0[] = ACPI_DMTABLE_INFO AcpiDmTableInfoSrat1[] = { {ACPI_DMT_UINT32, ACPI_SRAT1_OFFSET (ProximityDomain), "Proximity Domain", 0}, - {ACPI_DMT_UINT16, ACPI_SRAT1_OFFSET (Reserved), "Reserved", 0}, + {ACPI_DMT_UINT16, ACPI_SRAT1_OFFSET (Reserved), "Reserved1", 0}, {ACPI_DMT_UINT64, ACPI_SRAT1_OFFSET (BaseAddress), "Base Address", 0}, {ACPI_DMT_UINT64, ACPI_SRAT1_OFFSET (Length), "Address Length", 0}, - {ACPI_DMT_UINT32, ACPI_SRAT1_OFFSET (Reserved1), "Reserved", 0}, + {ACPI_DMT_UINT32, ACPI_SRAT1_OFFSET (Reserved1), "Reserved2", 0}, {ACPI_DMT_UINT32, ACPI_SRAT1_OFFSET (Flags), "Flags (decoded below)", DT_FLAG}, {ACPI_DMT_FLAG0, ACPI_SRAT1_FLAG_OFFSET (Flags,0), "Enabled", 0}, {ACPI_DMT_FLAG1, ACPI_SRAT1_FLAG_OFFSET (Flags,0), "Hot Pluggable", 0}, {ACPI_DMT_FLAG2, ACPI_SRAT1_FLAG_OFFSET (Flags,0), "Non-Volatile", 0}, - {ACPI_DMT_UINT64, ACPI_SRAT1_OFFSET (Reserved2), "Reserved", 0}, + {ACPI_DMT_UINT64, ACPI_SRAT1_OFFSET (Reserved2), "Reserved3", 0}, ACPI_DMT_TERMINATOR }; @@ -1443,13 +1443,13 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoSrat1[] = ACPI_DMTABLE_INFO AcpiDmTableInfoSrat2[] = { - {ACPI_DMT_UINT16, ACPI_SRAT2_OFFSET (Reserved), "Reserved", 0}, + {ACPI_DMT_UINT16, ACPI_SRAT2_OFFSET (Reserved), "Reserved1", 0}, {ACPI_DMT_UINT32, ACPI_SRAT2_OFFSET (ProximityDomain), "Proximity Domain", 0}, {ACPI_DMT_UINT32, ACPI_SRAT2_OFFSET (ApicId), "Apic ID", 0}, {ACPI_DMT_UINT32, ACPI_SRAT2_OFFSET (Flags), "Flags (decoded below)", DT_FLAG}, {ACPI_DMT_FLAG0, ACPI_SRAT2_FLAG_OFFSET (Flags,0), "Enabled", 0}, {ACPI_DMT_UINT32, ACPI_SRAT2_OFFSET (ClockDomain), "Clock Domain", 0}, - {ACPI_DMT_UINT32, ACPI_SRAT2_OFFSET (Reserved2), "Reserved", 0}, + {ACPI_DMT_UINT32, ACPI_SRAT2_OFFSET (Reserved2), "Reserved2", 0}, ACPI_DMT_TERMINATOR }; diff --git a/source/compiler/dtcompile.c b/source/compiler/dtcompile.c index 351d9cc83..43b48c937 100644 --- a/source/compiler/dtcompile.c +++ b/source/compiler/dtcompile.c @@ -459,7 +459,6 @@ DtCompileTable ( UINT8 FieldType; UINT8 *Buffer; UINT8 *FlagBuffer = NULL; - UINT32 FlagBitPosition = 0; ACPI_STATUS Status; @@ -530,7 +529,6 @@ DtCompileTable ( LocalField = LocalField->Next; *Field = LocalField; - FlagBitPosition = 0; FlagBuffer = Buffer; break; @@ -540,8 +538,7 @@ DtCompileTable ( if (FlagBuffer) { - FlagBitPosition = DtCompileFlag (FlagBuffer, - LocalField, Info, FlagBitPosition); + DtCompileFlag (FlagBuffer, LocalField, Info); } else { diff --git a/source/compiler/dtcompiler.h b/source/compiler/dtcompiler.h index 809d798fd..f2ce61bd5 100644 --- a/source/compiler/dtcompiler.h +++ b/source/compiler/dtcompiler.h @@ -290,12 +290,11 @@ DtCompileBuffer ( DT_FIELD *Field, UINT32 ByteLength); -UINT32 +void DtCompileFlag ( UINT8 *Buffer, DT_FIELD *Field, - ACPI_DMTABLE_INFO *Info, - UINT32 BitPosition); + ACPI_DMTABLE_INFO *Info); /* dtutils - Miscellaneous utilities */ diff --git a/source/compiler/dtfield.c b/source/compiler/dtfield.c index d3f32a441..5bc4e72ef 100644 --- a/source/compiler/dtfield.c +++ b/source/compiler/dtfield.c @@ -225,9 +225,6 @@ DtCompileString ( Length = ByteLength; } - /* If input string is shorter than ByteLength, pad with blanks */ - - ACPI_MEMSET (Buffer, 0x20, ByteLength); ACPI_MEMCPY (Buffer, Field->Value, Length); } @@ -473,23 +470,22 @@ DtCompilePciPath ( * PARAMETERS: Buffer - Output buffer * Field - Field to be compiled * Info - Flag info - * BitPosition - Flag bit position * - * RETURN: Next flag bit position + * RETURN: * * DESCRIPTION: Compile a flag * *****************************************************************************/ -UINT32 +void DtCompileFlag ( UINT8 *Buffer, DT_FIELD *Field, - ACPI_DMTABLE_INFO *Info, - UINT32 BitPosition) + ACPI_DMTABLE_INFO *Info) { UINT64 Value = 0; UINT32 BitLength = 1; + UINT8 BitPosition = 0; ACPI_STATUS Status; @@ -510,12 +506,20 @@ DtCompileFlag ( case ACPI_DMT_FLAG6: case ACPI_DMT_FLAG7: + BitPosition = Info->Opcode; BitLength = 1; break; case ACPI_DMT_FLAGS0: + + BitPosition = 0; + BitLength = 2; + break; + + case ACPI_DMT_FLAGS2: + BitPosition = 2; BitLength = 2; break; @@ -534,10 +538,5 @@ DtCompileFlag ( Value = 0; } - /* Insert the flag, return next flag bit position */ - - Buffer += ACPI_DIV_8 (BitPosition); - *Buffer |= (UINT8) (Value << ACPI_MOD_8 (BitPosition)); - - return (BitPosition + BitLength); + *Buffer |= (UINT8) (Value << BitPosition); }