Sync BaseTool trunk (version r2670) into EDKII BaseTools.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Gao, Liming <liming.gao@intel.com>
Reviewed-by: Liu, Yingke D (yingke.d.liu@intel.com)


git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15605 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Gao, Liming
2014-07-01 07:10:10 +00:00
committed by lgao4
parent 148af38722
commit e4ac870fe9
53 changed files with 792 additions and 435 deletions

View File

@@ -1,6 +1,6 @@
/** @file
Copyright (c) 1999 - 2008, Intel Corporation. All rights reserved.<BR>
Copyright (c) 1999 - 2014, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -32,6 +32,37 @@ Abstract:
) \
)
STATIC
UINT32
FvBufGetSecHdrLen(
IN EFI_COMMON_SECTION_HEADER *SectionHeader
)
{
if (SectionHeader == NULL) {
return 0;
}
if (FvBufExpand3ByteSize(SectionHeader->Size) == 0xffffff) {
return sizeof(EFI_COMMON_SECTION_HEADER2);
}
return sizeof(EFI_COMMON_SECTION_HEADER);
}
STATIC
UINT32
FvBufGetSecFileLen (
IN EFI_COMMON_SECTION_HEADER *SectionHeader
)
{
UINT32 Length;
if (SectionHeader == NULL) {
return 0;
}
Length = FvBufExpand3ByteSize(SectionHeader->Size);
if (Length == 0xffffff) {
Length = ((EFI_COMMON_SECTION_HEADER2 *)SectionHeader)->ExtendedSize;
}
return Length;
}
//
// Local prototypes
@@ -92,7 +123,7 @@ Returns:
return Status;
}
FileToRmLength = FvBufExpand3ByteSize (FileToRm->Size);
FileToRmLength = FvBufGetFfsFileSize (FileToRm);
CommonLibBinderSetMem (
FileToRm,
@@ -218,7 +249,7 @@ Returns:
EFI_FFS_FILE_STATE StateBackup;
UINT32 FileSize;
FileSize = FvBufExpand3ByteSize (File->Size);
FileSize = FvBufGetFfsFileSize (File);
//
// Fill in checksums and state, they must be 0 for checksumming.
@@ -231,13 +262,13 @@ Returns:
File->IntegrityCheck.Checksum.Header =
FvBufCalculateChecksum8 (
(UINT8 *) File,
sizeof (EFI_FFS_FILE_HEADER)
FvBufGetFfsHeaderSize (File)
);
if (File->Attributes & FFS_ATTRIB_CHECKSUM) {
File->IntegrityCheck.Checksum.File = FvBufCalculateChecksum8 (
(VOID*)(File + 1),
FileSize - sizeof (EFI_FFS_FILE_HEADER)
(VOID*)((UINT8 *)File + FvBufGetFfsHeaderSize (File)),
FileSize - FvBufGetFfsHeaderSize (File)
);
} else {
File->IntegrityCheck.Checksum.File = FFS_FIXED_CHECKSUM;
@@ -568,7 +599,7 @@ Returns:
}
FvbAttributes = hdr->Attributes;
newSize = FvBufExpand3ByteSize (((EFI_FFS_FILE_HEADER*)File)->Size);
newSize = FvBufGetFfsFileSize ((EFI_FFS_FILE_HEADER*)File);
for(
offset = (UINTN)ALIGN_POINTER (hdr->HeaderLength, 8);
@@ -587,7 +618,7 @@ Returns:
// BUGBUG: Need to make sure that the new file does not already
// exist.
fsize = FvBufExpand3ByteSize (fhdr->Size);
fsize = FvBufGetFfsFileSize (fhdr);
if (fsize == 0 || (offset + fsize > fvSize)) {
return EFI_VOLUME_CORRUPTED;
}
@@ -725,7 +756,7 @@ Returns:
}
erasedUint8 = (UINT8)((hdr->Attributes & EFI_FVB2_ERASE_POLARITY) ? 0xFF : 0);
NewFileSize = FvBufExpand3ByteSize (((EFI_FFS_FILE_HEADER*)File)->Size);
NewFileSize = FvBufGetFfsFileSize ((EFI_FFS_FILE_HEADER*)File);
if (NewFileSize != (UINTN)ALIGN_POINTER (NewFileSize, 8)) {
return EFI_INVALID_PARAMETER;
@@ -739,7 +770,7 @@ Returns:
LastFileSize = 0;
do {
Status = FvBufFindNextFile (Fv, &Key, (VOID **)&LastFile);
LastFileSize = FvBufExpand3ByteSize (((EFI_FFS_FILE_HEADER*)File)->Size);
LastFileSize = FvBufGetFfsFileSize ((EFI_FFS_FILE_HEADER*)File);
} while (!EFI_ERROR (Status));
//
@@ -811,6 +842,64 @@ Returns:
((UINT8*)SizeDest)[2] = (UINT8)(Size >> 16);
}
UINT32
FvBufGetFfsFileSize (
IN EFI_FFS_FILE_HEADER *Ffs
)
/*++
Routine Description:
Get the FFS file size.
Arguments:
Ffs - Pointer to FFS header
Returns:
UINT32
--*/
{
if (Ffs == NULL) {
return 0;
}
if (Ffs->Attributes & FFS_ATTRIB_LARGE_FILE) {
return ((EFI_FFS_FILE_HEADER2 *)Ffs)->ExtendedSize;
}
return FvBufExpand3ByteSize(Ffs->Size);
}
UINT32
FvBufGetFfsHeaderSize (
IN EFI_FFS_FILE_HEADER *Ffs
)
/*++
Routine Description:
Get the FFS header size.
Arguments:
Ffs - Pointer to FFS header
Returns:
UINT32
--*/
{
if (Ffs == NULL) {
return 0;
}
if (Ffs->Attributes & FFS_ATTRIB_LARGE_FILE) {
return sizeof(EFI_FFS_FILE_HEADER2);
}
return sizeof(EFI_FFS_FILE_HEADER);
}
UINT32
FvBufExpand3ByteSize (
IN VOID* Size
@@ -897,7 +986,7 @@ Returns:
) {
fhdr = (EFI_FFS_FILE_HEADER*) ((UINT8*)hdr + *Key);
fsize = FvBufExpand3ByteSize (fhdr->Size);
fsize = FvBufGetFfsFileSize (fhdr);
if (!EFI_TEST_FFS_ATTRIBUTES_BIT(
FvbAttributes,
@@ -1089,8 +1178,8 @@ Returns:
//
// Raw filetypes don't have sections, so we just return the raw data
//
*RawData = (VOID*)(File + 1);
*RawDataSize = FvBufExpand3ByteSize (File->Size) - sizeof (*File);
*RawData = (VOID*)((UINT8 *)File + FvBufGetFfsHeaderSize (File));
*RawDataSize = FvBufGetFfsFileSize (File) - FvBufGetFfsHeaderSize (File);
return EFI_SUCCESS;
}
@@ -1102,9 +1191,9 @@ Returns:
return Status;
}
*RawData = (VOID*)(Section + 1);
*RawData = (VOID*)((UINT8 *)Section + FvBufGetSecHdrLen(Section));
*RawDataSize =
FvBufExpand3ByteSize (Section->Size) - sizeof (*Section);
FvBufGetSecFileLen (Section) - FvBufGetSecHdrLen(Section);
return EFI_SUCCESS;
@@ -1144,16 +1233,28 @@ Returns:
UINT32 NewFileSize;
EFI_RAW_SECTION* NewSection;
UINT32 NewSectionSize;
UINT32 FfsHdrLen;
UINT32 SecHdrLen;
//
// The section size is the DataSize + the size of the section header
//
NewSectionSize = (UINT32)sizeof (EFI_RAW_SECTION) + (UINT32)RawDataSize;
SecHdrLen = sizeof (EFI_RAW_SECTION);
if (NewSectionSize >= MAX_SECTION_SIZE) {
NewSectionSize = (UINT32)sizeof (EFI_RAW_SECTION2) + (UINT32)RawDataSize;
SecHdrLen = sizeof (EFI_RAW_SECTION2);
}
//
// The file size is the size of the file header + the section size
//
NewFileSize = sizeof (EFI_FFS_FILE_HEADER) + NewSectionSize;
FfsHdrLen = sizeof (EFI_FFS_FILE_HEADER);
if (NewFileSize >= MAX_FFS_SIZE) {
NewFileSize = sizeof (EFI_FFS_FILE_HEADER2) + NewSectionSize;
FfsHdrLen = sizeof (EFI_FFS_FILE_HEADER2);
}
//
// Try to allocate a buffer to build the new FFS file in
@@ -1167,24 +1268,35 @@ Returns:
//
// The NewSection follow right after the FFS file header
//
NewSection = (EFI_RAW_SECTION*)(NewFile + 1);
FvBufCompact3ByteSize (NewSection->Size, NewSectionSize);
NewSection = (EFI_RAW_SECTION*)((UINT8*)NewFile + FfsHdrLen);
if (NewSectionSize >= MAX_SECTION_SIZE) {
FvBufCompact3ByteSize (NewSection->Size, 0xffffff);
((EFI_RAW_SECTION2 *)NewSection)->ExtendedSize = NewSectionSize;
} else {
FvBufCompact3ByteSize (NewSection->Size, NewSectionSize);
}
NewSection->Type = EFI_SECTION_RAW;
//
// Copy the actual file data into the buffer
//
CommonLibBinderCopyMem (NewSection + 1, RawData, RawDataSize);
CommonLibBinderCopyMem ((UINT8 *)NewSection + SecHdrLen, RawData, RawDataSize);
//
// Initialize the FFS file header
//
CommonLibBinderCopyMem (&NewFile->Name, Filename, sizeof (EFI_GUID));
FvBufCompact3ByteSize (NewFile->Size, NewFileSize);
NewFile->Type = EFI_FV_FILETYPE_FREEFORM;
NewFile->Attributes = 0;
if (NewFileSize >= MAX_FFS_SIZE) {
FvBufCompact3ByteSize (NewFile->Size, 0x0);
((EFI_FFS_FILE_HEADER2 *)NewFile)->ExtendedSize = NewFileSize;
NewFile->Attributes |= FFS_ATTRIB_LARGE_FILE;
} else {
FvBufCompact3ByteSize (NewFile->Size, NewFileSize);
}
NewFile->Type = EFI_FV_FILETYPE_FREEFORM;
NewFile->IntegrityCheck.Checksum.Header =
FvBufCalculateChecksum8 ((UINT8*)NewFile, sizeof (*NewFile));
FvBufCalculateChecksum8 ((UINT8*)NewFile, FfsHdrLen);
NewFile->IntegrityCheck.Checksum.File = FFS_FIXED_CHECKSUM;
NewFile->State = (UINT8)~( EFI_FILE_HEADER_CONSTRUCTION |
EFI_FILE_HEADER_VALID |
@@ -1239,7 +1351,7 @@ Returns:
}
sectionHdr = (EFI_COMMON_SECTION_HEADER*)((UINT8*)SectionsStart + *Key);
sectionSize = FvBufExpand3ByteSize (sectionHdr->Size);
sectionSize = FvBufGetSecFileLen (sectionHdr);
if (sectionSize < sizeof (EFI_COMMON_SECTION_HEADER)) {
return EFI_NOT_FOUND;
@@ -1287,10 +1399,10 @@ Returns:
UINTN TotalSectionsSize;
EFI_COMMON_SECTION_HEADER* NextSection;
SectionStart = (VOID*)((UINTN)FfsFile + sizeof (EFI_FFS_FILE_HEADER));
SectionStart = (VOID*)((UINTN)FfsFile + FvBufGetFfsHeaderSize(FfsFile));
TotalSectionsSize =
FvBufExpand3ByteSize (((EFI_FFS_FILE_HEADER*)FfsFile)->Size) -
sizeof (EFI_FFS_FILE_HEADER);
FvBufGetFfsFileSize ((EFI_FFS_FILE_HEADER*)FfsFile) -
FvBufGetFfsHeaderSize(FfsFile);
Key = 0;
*Count = 0;
while (TRUE) {
@@ -1352,10 +1464,10 @@ Returns:
UINTN TotalSectionsSize;
EFI_COMMON_SECTION_HEADER* NextSection;
SectionStart = (VOID*)((UINTN)FfsFile + sizeof (EFI_FFS_FILE_HEADER));
SectionStart = (VOID*)((UINTN)FfsFile + FvBufGetFfsHeaderSize(FfsFile));
TotalSectionsSize =
FvBufExpand3ByteSize (((EFI_FFS_FILE_HEADER*)FfsFile)->Size) -
sizeof (EFI_FFS_FILE_HEADER);
FvBufGetFfsFileSize ((EFI_FFS_FILE_HEADER*)FfsFile) -
FvBufGetFfsHeaderSize(FfsFile);
Key = 0;
while (TRUE) {
Status = FvBufFindNextSection (
@@ -1436,7 +1548,7 @@ Returns:
EndOfLastFile = (UINT8*)FvHdr + FvHdr->FvLength;
while (!EFI_ERROR (FvBufFindNextFile (Fv, &Key, (VOID **)&FileIt))) {
EndOfLastFile =
(VOID*)((UINT8*)FileIt + FvBufExpand3ByteSize (FileIt->Size));
(VOID*)((UINT8*)FileIt + FvBufGetFfsFileSize (FileIt));
}
//

View File

@@ -1,6 +1,6 @@
/** @file
Copyright (c) 1999 - 2008, Intel Corporation. All rights reserved.<BR>
Copyright (c) 1999 - 2014, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -82,6 +82,16 @@ FvBufExpand3ByteSize (
IN VOID* Size
);
UINT32
FvBufGetFfsFileSize (
IN EFI_FFS_FILE_HEADER *Ffs
);
UINT32
FvBufGetFfsHeaderSize (
IN EFI_FFS_FILE_HEADER *Ffs
);
EFI_STATUS
FvBufExtend (
IN VOID **Fv,

View File

@@ -19,7 +19,7 @@ ifndef ARCH
#
uname_m = $(shell uname -m)
$(info Attempting to detect ARCH from 'uname -m': $(uname_m))
ifeq ($(uname_m),x86_64)
ifneq (,$(strip $(filter $(uname_m), x86_64 amd64)))
ARCH=X64
endif
ifeq ($(patsubst i%86,IA32,$(uname_m)),IA32)

View File

@@ -14,4 +14,4 @@
**/
#define __BUILD_VERSION "Build 2649"
#define __BUILD_VERSION "Build 2670"

View File

@@ -53,10 +53,10 @@ VfrLexer.cpp VfrLexer.h: Pccts/dlg/dlg VfrParser.dlg
Pccts/dlg/dlg -C2 -i -CC -cl VfrLexer -o . VfrParser.dlg
Pccts/antlr/antlr:
BIN_DIR='.' make -C Pccts/antlr
BIN_DIR='.' $(MAKE) -C Pccts/antlr
Pccts/dlg/dlg:
BIN_DIR='.' make -C Pccts/dlg
BIN_DIR='.' $(MAKE) -C Pccts/dlg
ATokenBuffer.o: Pccts/h/ATokenBuffer.cpp
$(CXX) -c $(VFR_CPPFLAGS) $(INC) $? -o $@
@@ -73,7 +73,7 @@ VfrSyntax.o: VfrSyntax.cpp
clean: localClean
localClean:
BIN_DIR='.' make -C Pccts/antlr clean
BIN_DIR='.' make -C Pccts/dlg clean
BIN_DIR='.' $(MAKE) -C Pccts/antlr clean
BIN_DIR='.' $(MAKE) -C Pccts/dlg clean
rm -f $(EXTRA_CLEAN_OBJECTS)

View File

@@ -372,6 +372,8 @@ CVfrCompiler::CVfrCompiler (
mPreProcessCmd = (CHAR8 *) PREPROCESSOR_COMMAND;
mPreProcessOpt = (CHAR8 *) PREPROCESSOR_OPTIONS;
SET_RUN_STATUS (STATUS_STARTED);
OptionInitialization(Argc, Argv);
if ((IS_RUN_STATUS(STATUS_FAILED)) || (IS_RUN_STATUS(STATUS_DEAD))) {

View File

@@ -60,7 +60,8 @@ typedef struct {
} OPTIONS;
typedef enum {
STATUS_INITIALIZED = 1,
STATUS_STARTED = 0,
STATUS_INITIALIZED,
STATUS_PREPROCESSED,
STATUS_COMPILEED,
STATUS_GENBINARY,

View File

@@ -51,6 +51,7 @@ static SVFR_ERROR_HANDLE VFR_ERROR_HANDLE_TABLE [] = {
static SVFR_WARNING_HANDLE VFR_WARNING_HANDLE_TABLE [] = {
{ VFR_WARNING_DEFAULT_VALUE_REDEFINED, ": default value re-defined with different value"},
{ VFR_WARNING_STRING_TO_UINT_OVERFLOW, ": String to UINT* Overflow"},
{ VFR_WARNING_CODEUNDEFINED, ": undefined Warning Code" }
};

View File

@@ -49,6 +49,7 @@ typedef enum {
typedef enum {
VFR_WARNING_DEFAULT_VALUE_REDEFINED = 0,
VFR_WARNING_STRING_TO_UINT_OVERFLOW,
VFR_WARNING_CODEUNDEFINED
} EFI_VFR_WARNING_CODE;

View File

@@ -2,7 +2,7 @@
The definition of CFormPkg's member function
Copyright (c) 2004 - 2013, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -1343,7 +1343,7 @@ public:
UpdateCIfrMinMaxStepData(&mNumeric->data);
}
EFI_VFR_RETURN_CODE SetFlags (IN UINT8 HFlags, IN UINT8 LFlags) {
EFI_VFR_RETURN_CODE SetFlags (IN UINT8 HFlags, IN UINT8 LFlags, BOOLEAN DisplaySettingsSpecified = FALSE) {
EFI_VFR_RETURN_CODE Ret;
Ret = CIfrQuestionHeader::SetFlags (HFlags);
@@ -1351,10 +1351,10 @@ public:
return Ret;
}
if (LFlags & EFI_IFR_DISPLAY) {
mNumeric->Flags = LFlags;
} else {
if (DisplaySettingsSpecified == FALSE) {
mNumeric->Flags = LFlags | EFI_IFR_DISPLAY_UINT_DEC;
} else {
mNumeric->Flags = LFlags;
}
return VFR_RETURN_SUCCESS;
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
/** @file
Copyright (c) 1999 - 2011, Intel Corporation. All rights reserved.<BR>
Copyright (c) 1999 - 2014, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -975,22 +975,24 @@ Returns:
UINT32 FileLength;
UINT8 FileState;
UINT8 Checksum;
EFI_FFS_FILE_HEADER BlankHeader;
EFI_FFS_FILE_HEADER2 BlankHeader;
EFI_STATUS Status;
UINT8 GuidBuffer[PRINTED_GUID_BUFFER_SIZE];
UINT32 HeaderSize;
#if (PI_SPECIFICATION_VERSION < 0x00010000)
UINT16 *Tail;
#endif
//
// Check if we have free space
//
HeaderSize = FvBufGetFfsHeaderSize(FileHeader);
if (ErasePolarity) {
memset (&BlankHeader, -1, sizeof (EFI_FFS_FILE_HEADER));
memset (&BlankHeader, -1, HeaderSize);
} else {
memset (&BlankHeader, 0, sizeof (EFI_FFS_FILE_HEADER));
memset (&BlankHeader, 0, HeaderSize);
}
if (memcmp (&BlankHeader, FileHeader, sizeof (EFI_FFS_FILE_HEADER)) == 0) {
if (memcmp (&BlankHeader, FileHeader, HeaderSize) == 0) {
return EFI_SUCCESS;
}
//
@@ -1008,7 +1010,7 @@ Returns:
// PrintGuid (&FileHeader->Name);
// printf ("\n");
//
FileLength = GetLength (FileHeader->Size);
FileLength = FvBufGetFfsFileSize (FileHeader);
printf ("File Offset: 0x%08X\n", (unsigned) ((UINTN) FileHeader - (UINTN) FvImage));
printf ("File Length: 0x%08X\n", (unsigned) FileLength);
printf ("File Attributes: 0x%02X\n", FileHeader->Attributes);
@@ -1031,7 +1033,7 @@ Returns:
case EFI_FILE_HEADER_VALID:
printf (" EFI_FILE_HEADER_VALID\n");
Checksum = CalculateSum8 ((UINT8 *) FileHeader, sizeof (EFI_FFS_FILE_HEADER));
Checksum = CalculateSum8 ((UINT8 *) FileHeader, HeaderSize);
Checksum = (UINT8) (Checksum - FileHeader->IntegrityCheck.Checksum.File);
Checksum = (UINT8) (Checksum - FileHeader->State);
if (Checksum != 0) {
@@ -1053,7 +1055,7 @@ Returns:
//
// Calculate header checksum
//
Checksum = CalculateSum8 ((UINT8 *) FileHeader, sizeof (EFI_FFS_FILE_HEADER));
Checksum = CalculateSum8 ((UINT8 *) FileHeader, HeaderSize);
Checksum = (UINT8) (Checksum - FileHeader->IntegrityCheck.Checksum.File);
Checksum = (UINT8) (Checksum - FileHeader->State);
if (Checksum != 0) {
@@ -1061,13 +1063,13 @@ Returns:
return EFI_ABORTED;
}
FileLength = GetLength (FileHeader->Size);
FileLength = FvBufGetFfsFileSize (FileHeader);
if (FileHeader->Attributes & FFS_ATTRIB_CHECKSUM) {
//
// Calculate file checksum
//
Checksum = CalculateSum8 ((UINT8 *) (FileHeader + 1), FileLength - sizeof (EFI_FFS_FILE_HEADER));
Checksum = CalculateSum8 ((UINT8 *)FileHeader + HeaderSize, FileLength - HeaderSize);
Checksum = Checksum + FileHeader->IntegrityCheck.Checksum.File;
if (Checksum != 0) {
Error (NULL, 0, 0003, "error parsing FFS file", "FFS file with Guid %s has invalid file checksum", GuidBuffer);
@@ -1180,8 +1182,8 @@ Returns:
// All other files have sections
//
Status = ParseSection (
(UINT8 *) ((UINTN) FileHeader + sizeof (EFI_FFS_FILE_HEADER)),
GetLength (FileHeader->Size) - sizeof (EFI_FFS_FILE_HEADER)
(UINT8 *) ((UINTN) FileHeader + HeaderSize),
FvBufGetFfsFileSize (FileHeader) - HeaderSize
);
if (EFI_ERROR (Status)) {
//
@@ -1225,6 +1227,7 @@ Returns:
EFI_SECTION_TYPE Type;
UINT8 *Ptr;
UINT32 SectionLength;
UINT32 SectionHeaderLen;
CHAR8 *SectionName;
EFI_STATUS Status;
UINT32 ParsedLength;
@@ -1246,6 +1249,10 @@ Returns:
CHAR8 *ToolOutputFile;
CHAR8 *SystemCommandFormatString;
CHAR8 *SystemCommand;
EFI_GUID *EfiGuid;
UINT16 DataOffset;
UINT16 Attributes;
UINT32 RealHdrLen;
ParsedLength = 0;
while (ParsedLength < BufferLength) {
@@ -1264,6 +1271,12 @@ Returns:
continue;
}
//
// Get real section file size
//
SectionLength = GetSectionFileLength ((EFI_COMMON_SECTION_HEADER *) Ptr);
SectionHeaderLen = GetSectionHeaderLength((EFI_COMMON_SECTION_HEADER *)Ptr);
SectionName = SectionNameToStr (Type);
printf ("------------------------------------------------------------\n");
printf (" Type: %s\n Size: 0x%08X\n", SectionName, (unsigned) SectionLength);
@@ -1283,7 +1296,7 @@ Returns:
break;
case EFI_SECTION_FIRMWARE_VOLUME_IMAGE:
Status = PrintFvInfo (((EFI_FIRMWARE_VOLUME_IMAGE_SECTION*)Ptr) + 1, TRUE);
Status = PrintFvInfo (Ptr + SectionHeaderLen, TRUE);
if (EFI_ERROR (Status)) {
Error (NULL, 0, 0003, "printing of FV section contents failed", NULL);
return EFI_SECTION_ERROR;
@@ -1304,15 +1317,22 @@ Returns:
break;
case EFI_SECTION_VERSION:
printf (" Build Number: 0x%02X\n", ((EFI_VERSION_SECTION *) Ptr)->BuildNumber);
printf (" Version Strg: %s\n", (char*) ((EFI_VERSION_SECTION *) Ptr)->VersionString);
printf (" Build Number: 0x%02X\n", *(UINT16 *)(Ptr + SectionHeaderLen));
printf (" Version Strg: %s\n", (char*) (Ptr + SectionHeaderLen + sizeof (UINT16)));
break;
case EFI_SECTION_COMPRESSION:
UncompressedBuffer = NULL;
CompressedLength = SectionLength - sizeof (EFI_COMPRESSION_SECTION);
UncompressedLength = ((EFI_COMPRESSION_SECTION *) Ptr)->UncompressedLength;
CompressionType = ((EFI_COMPRESSION_SECTION *) Ptr)->CompressionType;
if (SectionHeaderLen == sizeof (EFI_COMMON_SECTION_HEADER)) {
RealHdrLen = sizeof(EFI_COMPRESSION_SECTION);
UncompressedLength = ((EFI_COMPRESSION_SECTION *)Ptr)->UncompressedLength;
CompressionType = ((EFI_COMPRESSION_SECTION *)Ptr)->CompressionType;
} else {
RealHdrLen = sizeof(EFI_COMPRESSION_SECTION2);
UncompressedLength = ((EFI_COMPRESSION_SECTION2 *)Ptr)->UncompressedLength;
CompressionType = ((EFI_COMPRESSION_SECTION2 *)Ptr)->CompressionType;
}
CompressedLength = SectionLength - RealHdrLen;
printf (" Uncompressed Length: 0x%08X\n", (unsigned) UncompressedLength);
if (CompressionType == EFI_NOT_COMPRESSED) {
@@ -1328,13 +1348,13 @@ Returns:
return EFI_SECTION_ERROR;
}
UncompressedBuffer = Ptr + sizeof (EFI_COMPRESSION_SECTION);
UncompressedBuffer = Ptr + RealHdrLen;
} else if (CompressionType == EFI_STANDARD_COMPRESSION) {
GetInfoFunction = EfiGetInfo;
DecompressFunction = EfiDecompress;
printf (" Compression Type: EFI_STANDARD_COMPRESSION\n");
CompressedBuffer = Ptr + sizeof (EFI_COMPRESSION_SECTION);
CompressedBuffer = Ptr + RealHdrLen;
Status = GetInfoFunction (CompressedBuffer, CompressedLength, &DstSize, &ScratchSize);
if (EFI_ERROR (Status)) {
@@ -1387,16 +1407,25 @@ Returns:
break;
case EFI_SECTION_GUID_DEFINED:
if (SectionHeaderLen == sizeof(EFI_COMMON_SECTION_HEADER)) {
EfiGuid = &((EFI_GUID_DEFINED_SECTION *) Ptr)->SectionDefinitionGuid;
DataOffset = ((EFI_GUID_DEFINED_SECTION *) Ptr)->DataOffset;
Attributes = ((EFI_GUID_DEFINED_SECTION *) Ptr)->Attributes;
} else {
EfiGuid = &((EFI_GUID_DEFINED_SECTION2 *) Ptr)->SectionDefinitionGuid;
DataOffset = ((EFI_GUID_DEFINED_SECTION2 *) Ptr)->DataOffset;
Attributes = ((EFI_GUID_DEFINED_SECTION2 *) Ptr)->Attributes;
}
printf (" SectionDefinitionGuid: ");
PrintGuid (&((EFI_GUID_DEFINED_SECTION *) Ptr)->SectionDefinitionGuid);
PrintGuid (EfiGuid);
printf ("\n");
printf (" DataOffset: 0x%04X\n", (unsigned) ((EFI_GUID_DEFINED_SECTION *) Ptr)->DataOffset);
printf (" Attributes: 0x%04X\n", (unsigned) ((EFI_GUID_DEFINED_SECTION *) Ptr)->Attributes);
printf (" DataOffset: 0x%04X\n", (unsigned) DataOffset);
printf (" Attributes: 0x%04X\n", (unsigned) Attributes);
ExtractionTool =
LookupGuidedSectionToolPath (
mParsedGuidedSectionTools,
&((EFI_GUID_DEFINED_SECTION *) Ptr)->SectionDefinitionGuid
EfiGuid
);
if (ExtractionTool != NULL) {
@@ -1427,8 +1456,8 @@ Returns:
Status =
PutFileImage (
ToolInputFile,
(CHAR8*) SectionBuffer + ((EFI_GUID_DEFINED_SECTION *) Ptr)->DataOffset,
BufferLength - ((EFI_GUID_DEFINED_SECTION *) Ptr)->DataOffset
(CHAR8*) SectionBuffer + DataOffset,
BufferLength - DataOffset
);
system (SystemCommand);
@@ -1461,7 +1490,7 @@ Returns:
// Check for CRC32 sections which we can handle internally if needed.
//
} else if (!CompareGuid (
&((EFI_GUID_DEFINED_SECTION *) Ptr)->SectionDefinitionGuid,
EfiGuid,
&gEfiCrc32GuidedSectionExtractionProtocolGuid
)
) {
@@ -1469,8 +1498,8 @@ Returns:
// CRC32 guided section
//
Status = ParseSection (
SectionBuffer + ((EFI_GUID_DEFINED_SECTION *) Ptr)->DataOffset,
BufferLength - ((EFI_GUID_DEFINED_SECTION *) Ptr)->DataOffset
SectionBuffer + DataOffset,
BufferLength - DataOffset
);
if (EFI_ERROR (Status)) {
Error (NULL, 0, 0003, "parse of CRC32 GUIDED section failed", NULL);
@@ -1540,8 +1569,8 @@ Returns:
return EFI_SUCCESS;
}
Ptr += sizeof (EFI_COMMON_SECTION_HEADER);
SectionLength -= sizeof (EFI_COMMON_SECTION_HEADER);
Ptr += GetSectionHeaderLength((EFI_COMMON_SECTION_HEADER *)Ptr);
SectionLength -= GetSectionHeaderLength((EFI_COMMON_SECTION_HEADER *)Ptr);
while (SectionLength > 0) {
printf (" ");
switch (*Ptr) {
@@ -1809,7 +1838,7 @@ Returns:
//
// Copyright declaration
//
fprintf (stdout, "Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.\n\n");
fprintf (stdout, "Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.\n\n");
//
// Details Option

View File

@@ -13,4 +13,4 @@
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#
gBUILD_VERSION = "Build 2649"
gBUILD_VERSION = "Build 2670"

View File

@@ -1,7 +1,7 @@
## @file
# This file is used to define common parsing related functions used in parsing INF/DEC/DSC process
#
# Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.<BR>
# Copyright (c) 2008 - 2014, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
@@ -877,3 +877,38 @@ def GenMetaDatSectionItem(Key, Value, List):
List[Key] = [Value]
else:
List[Key].append(Value)
## IsValidWord
#
# Check whether the word is valid.
# <Word> ::= (a-zA-Z0-9_)(a-zA-Z0-9_-){0,} Alphanumeric characters with
# optional
# dash "-" and/or underscore "_" characters. No whitespace
# characters are permitted.
#
# @param Word: The word string need to be checked.
#
def IsValidWord(Word):
if not Word:
return False
#
# The first char should be alpha, _ or Digit.
#
if not Word[0].isalnum() and \
not Word[0] == '_' and \
not Word[0].isdigit():
return False
LastChar = ''
for Char in Word[1:]:
if (not Char.isalpha()) and \
(not Char.isdigit()) and \
Char != '-' and \
Char != '_' and \
Char != '.':
return False
if Char == '.' and LastChar == '.':
return False
LastChar = Char
return True

View File

@@ -1,7 +1,7 @@
## @file
# This file is used to define class Configuration
#
# Copyright (c) 2008, Intel Corporation. All rights reserved.<BR>
# Copyright (c) 2008 - 2014, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
@@ -247,6 +247,9 @@ class Configuration(object):
# A list for binary file ext name
self.BinaryExtList = []
# A list for only scanned folders
self.ScanOnlyDirList = []
self.ParseConfig()

View File

@@ -1,7 +1,7 @@
## @file
# This file is used to be the main entrance of ECC tool
#
# Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
# Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
@@ -59,6 +59,7 @@ class Ecc(object):
self.ScanSourceCode = True
self.ScanMetaData = True
self.MetaFile = ''
self.OnlyScan = None
# Parse the options and args
self.ParseOption()
@@ -113,8 +114,9 @@ class Ecc(object):
GlobalData.gAllFiles = DirCache(GlobalData.gWorkspace)
# Build ECC database
self.BuildDatabase()
# self.BuildDatabase()
self.DetectOnlyScanDirs()
# Start to check
self.Check()
@@ -133,11 +135,30 @@ class Ecc(object):
return
self.ConfigFile = 'config.ini'
## DetectOnlyScan
#
# Detect whether only scanned folders have been enabled
#
def DetectOnlyScanDirs(self):
if self.OnlyScan == True:
OnlyScanDirs = []
# Use regex here if multiple spaces or TAB exists in ScanOnlyDirList in config.ini file
for folder in re.finditer(r'\S+', EccGlobalData.gConfig.ScanOnlyDirList):
OnlyScanDirs.append(folder.group())
if len(OnlyScanDirs) != 0:
self.BuildDatabase(OnlyScanDirs)
else:
EdkLogger.error("ECC", BuildToolError.OPTION_VALUE_INVALID, ExtraData="Use -f option need to fill specific folders in config.ini file")
else:
self.BuildDatabase()
## BuildDatabase
#
# Build the database for target
#
def BuildDatabase(self):
def BuildDatabase(self, SpeciDirs = None):
# Clean report table
EccGlobalData.gDb.TblReport.Drop()
EccGlobalData.gDb.TblReport.Create()
@@ -146,10 +167,14 @@ class Ecc(object):
if self.IsInit:
if self.ScanMetaData:
EdkLogger.quiet("Building database for Meta Data File ...")
self.BuildMetaDataFileDatabase()
self.BuildMetaDataFileDatabase(SpeciDirs)
if self.ScanSourceCode:
EdkLogger.quiet("Building database for Meta Data File Done!")
c.CollectSourceCodeDataIntoDB(EccGlobalData.gTarget)
if SpeciDirs == None:
c.CollectSourceCodeDataIntoDB(EccGlobalData.gTarget)
else:
for specificDir in SpeciDirs:
c.CollectSourceCodeDataIntoDB(os.path.join(EccGlobalData.gTarget, specificDir))
EccGlobalData.gIdentifierTableList = GetTableList((MODEL_FILE_C, MODEL_FILE_H), 'Identifier', EccGlobalData.gDb)
EccGlobalData.gCFileList = GetFileList(MODEL_FILE_C, EccGlobalData.gDb)
@@ -159,59 +184,67 @@ class Ecc(object):
#
# Build the database for meta data files
#
def BuildMetaDataFileDatabase(self):
def BuildMetaDataFileDatabase(self, SpecificDirs = None):
ScanFolders = []
if SpecificDirs == None:
ScanFolders.append(EccGlobalData.gTarget)
else:
for specificDir in SpecificDirs:
ScanFolders.append(os.path.join(EccGlobalData.gTarget, specificDir))
EdkLogger.quiet("Building database for meta data files ...")
Op = open(EccGlobalData.gConfig.MetaDataFileCheckPathOfGenerateFileList, 'w+')
#SkipDirs = Read from config file
SkipDirs = EccGlobalData.gConfig.SkipDirList
SkipDirString = string.join(SkipDirs, '|')
p = re.compile(r'.*[\\/](?:%s)[\\/]?.*' % SkipDirString)
for Root, Dirs, Files in os.walk(EccGlobalData.gTarget):
if p.match(Root.upper()):
continue
for Dir in Dirs:
Dirname = os.path.join(Root, Dir)
if os.path.islink(Dirname):
Dirname = os.path.realpath(Dirname)
if os.path.isdir(Dirname):
# symlinks to directories are treated as directories
Dirs.remove(Dir)
Dirs.append(Dirname)
for File in Files:
if len(File) > 4 and File[-4:].upper() == ".DEC":
Filename = os.path.normpath(os.path.join(Root, File))
EdkLogger.quiet("Parsing %s" % Filename)
Op.write("%s\r" % Filename)
#Dec(Filename, True, True, EccGlobalData.gWorkspace, EccGlobalData.gDb)
self.MetaFile = DecParser(Filename, MODEL_FILE_DEC, EccGlobalData.gDb.TblDec)
self.MetaFile.Start()
continue
if len(File) > 4 and File[-4:].upper() == ".DSC":
Filename = os.path.normpath(os.path.join(Root, File))
EdkLogger.quiet("Parsing %s" % Filename)
Op.write("%s\r" % Filename)
#Dsc(Filename, True, True, EccGlobalData.gWorkspace, EccGlobalData.gDb)
self.MetaFile = DscParser(PathClass(Filename, Root), MODEL_FILE_DSC, MetaFileStorage(EccGlobalData.gDb.TblDsc.Cur, Filename, MODEL_FILE_DSC, True))
# alwasy do post-process, in case of macros change
self.MetaFile.DoPostProcess()
self.MetaFile.Start()
self.MetaFile._PostProcess()
continue
if len(File) > 4 and File[-4:].upper() == ".INF":
Filename = os.path.normpath(os.path.join(Root, File))
EdkLogger.quiet("Parsing %s" % Filename)
Op.write("%s\r" % Filename)
#Inf(Filename, True, True, EccGlobalData.gWorkspace, EccGlobalData.gDb)
self.MetaFile = InfParser(Filename, MODEL_FILE_INF, EccGlobalData.gDb.TblInf)
self.MetaFile.Start()
continue
if len(File) > 4 and File[-4:].upper() == ".FDF":
Filename = os.path.normpath(os.path.join(Root, File))
EdkLogger.quiet("Parsing %s" % Filename)
Op.write("%s\r" % Filename)
Fdf(Filename, True, EccGlobalData.gWorkspace, EccGlobalData.gDb)
# p = re.compile(r'.*[\\/](?:%s)[\\/]?.*' % SkipDirString)
p = re.compile(r'.*[\\/](?:%s^\S)[\\/]?.*' % SkipDirString)
for scanFolder in ScanFolders:
for Root, Dirs, Files in os.walk(scanFolder):
if p.match(Root.upper()):
continue
for Dir in Dirs:
Dirname = os.path.join(Root, Dir)
if os.path.islink(Dirname):
Dirname = os.path.realpath(Dirname)
if os.path.isdir(Dirname):
# symlinks to directories are treated as directories
Dirs.remove(Dir)
Dirs.append(Dirname)
for File in Files:
if len(File) > 4 and File[-4:].upper() == ".DEC":
Filename = os.path.normpath(os.path.join(Root, File))
EdkLogger.quiet("Parsing %s" % Filename)
Op.write("%s\r" % Filename)
#Dec(Filename, True, True, EccGlobalData.gWorkspace, EccGlobalData.gDb)
self.MetaFile = DecParser(Filename, MODEL_FILE_DEC, EccGlobalData.gDb.TblDec)
self.MetaFile.Start()
continue
if len(File) > 4 and File[-4:].upper() == ".DSC":
Filename = os.path.normpath(os.path.join(Root, File))
EdkLogger.quiet("Parsing %s" % Filename)
Op.write("%s\r" % Filename)
#Dsc(Filename, True, True, EccGlobalData.gWorkspace, EccGlobalData.gDb)
self.MetaFile = DscParser(PathClass(Filename, Root), MODEL_FILE_DSC, MetaFileStorage(EccGlobalData.gDb.TblDsc.Cur, Filename, MODEL_FILE_DSC, True))
# alwasy do post-process, in case of macros change
self.MetaFile.DoPostProcess()
self.MetaFile.Start()
self.MetaFile._PostProcess()
continue
if len(File) > 4 and File[-4:].upper() == ".INF":
Filename = os.path.normpath(os.path.join(Root, File))
EdkLogger.quiet("Parsing %s" % Filename)
Op.write("%s\r" % Filename)
#Inf(Filename, True, True, EccGlobalData.gWorkspace, EccGlobalData.gDb)
self.MetaFile = InfParser(Filename, MODEL_FILE_INF, EccGlobalData.gDb.TblInf)
self.MetaFile.Start()
continue
if len(File) > 4 and File[-4:].upper() == ".FDF":
Filename = os.path.normpath(os.path.join(Root, File))
EdkLogger.quiet("Parsing %s" % Filename)
Op.write("%s\r" % Filename)
Fdf(Filename, True, EccGlobalData.gWorkspace, EccGlobalData.gDb)
continue
Op.close()
# Commit to database
@@ -321,6 +354,8 @@ class Ecc(object):
self.ScanSourceCode = False
if Options.sourcecode != None:
self.ScanMetaData = False
if Options.folders != None:
self.OnlyScan = True
## SetLogLevel
#
@@ -371,6 +406,7 @@ class Ecc(object):
"and warning messages, etc.")
Parser.add_option("-d", "--debug", action="store", type="int", help="Enable debug messages at specified level.")
Parser.add_option("-w", "--workspace", action="store", type="string", dest='Workspace', help="Specify workspace.")
Parser.add_option("-f", "--folders", action="store_true", type=None, help="Only scanning specified folders which are recorded in config.ini file.")
(Opt, Args)=Parser.parse_args()

View File

@@ -1,7 +1,7 @@
## @file
# This file is used to parse meta files
#
# Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.<BR>
# Copyright (c) 2008 - 2014, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
@@ -1054,7 +1054,7 @@ class DscParser(MetaFileParser):
## Override parent's method since we'll do all macro replacements in parser
def _GetMacros(self):
Macros = {}
Macros = dict( [('ARCH','IA32'), ('FAMILY','MSFT'),('TOOL_CHAIN_TAG','VS2008x86'),('TARGET','DEBUG')])
Macros.update(self._FileLocalMacros)
Macros.update(self._GetApplicableSectionMacro())
Macros.update(GlobalData.gEdkGlobal)

View File

@@ -2,7 +2,7 @@
# This file is used to set configuration of ECC tool
# For the items listed below, 1 means valid, 0 means invalid
#
# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
@@ -255,3 +255,5 @@ MetaDataFileCheckModuleFileGuidDuplication = 1
# A list for binary file ext name
BinaryExtList = EXE, EFI, FV, ROM, DLL, COM, BMP, GIF, PYD, CMP, BIN, JPG, UNI, RAW, COM2, LIB, DEPEX, SYS, DB
# A list for only scanning dirs, the dirs should be the top folder(s) under workspace
ScanOnlyDirList = ScanFolder1 ScanFolder2

View File

@@ -36,6 +36,7 @@ from Common import EdkLogger
from Common.String import *
from Common.Misc import DirCache,PathClass
from Common.Misc import SaveFileOnChange
from Common.Misc import GuidStructureStringToGuidString
from Common.BuildVersion import gBUILD_VERSION
## Version and Copyright
@@ -511,11 +512,23 @@ class GenFds :
def GenerateGuidXRefFile(BuildDb, ArchList):
GuidXRefFileName = os.path.join(GenFdsGlobalVariable.FvDir, "Guid.xref")
GuidXRefFile = StringIO.StringIO('')
GuidDict = {}
for Arch in ArchList:
PlatformDataBase = BuildDb.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
for ModuleFile in PlatformDataBase.Modules:
Module = BuildDb.BuildObject[ModuleFile, Arch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
GuidXRefFile.write("%s %s\n" % (Module.Guid, Module.BaseName))
for key, item in Module.Protocols.items():
GuidDict[key] = item
for key, item in Module.Guids.items():
GuidDict[key] = item
for key, item in Module.Ppis.items():
GuidDict[key] = item
# Append GUIDs, Protocols, and PPIs to the Xref file
GuidXRefFile.write("\n")
for key, item in GuidDict.items():
GuidXRefFile.write("%s %s\n" % (GuidStructureStringToGuidString(item).upper(), key))
if GuidXRefFile.getvalue():
SaveFileOnChange(GuidXRefFileName, GuidXRefFile.getvalue(), False)
GenFdsGlobalVariable.InfLogger("\nGUID cross reference file can be found at %s" % GuidXRefFileName)

View File

@@ -53,7 +53,9 @@ def parsePcdInfoFromMapFile(mapfilepath, efifilepath):
return None
if len(lines) == 0: return None
if lines[0].strip().find("Archive member included because of file (symbol)") != -1:
firstline = lines[0].strip()
if (firstline.startswith("Archive member included ") and
firstline.endswith(" file (symbol)")):
return _parseForGCC(lines, efifilepath)
return _parseGeneral(lines, efifilepath)

View File

@@ -17,4 +17,4 @@
Build version information
'''
gBUILD_VERSION = "Build 2649"
gBUILD_VERSION = "Build 2670"

View File

@@ -2,7 +2,7 @@
# This file is used to define common string related functions used in parsing
# process
#
# Copyright (c) 2011 - 2012, Intel Corporation. All rights reserved.<BR>
# Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>
#
# This program and the accompanying materials are licensed and made available
# under the terms and conditions of the BSD License which accompanies this
@@ -937,3 +937,29 @@ def SplitPcdEntry(String):
return ['', '', ''], False
return ['', '', ''], False
## Check if two arches matched?
#
# @param Arch1
# @param Arch2
#
def IsMatchArch(Arch1, Arch2):
if 'COMMON' in Arch1 or 'COMMON' in Arch2:
return True
if isinstance(Arch1, basestring) and isinstance(Arch2, basestring):
if Arch1 == Arch2:
return True
if isinstance(Arch1, basestring) and isinstance(Arch2, list):
return Arch1 in Arch2
if isinstance(Arch2, basestring) and isinstance(Arch1, list):
return Arch2 in Arch1
if isinstance(Arch1, list) and isinstance(Arch2, list):
for Item1 in Arch1:
for Item2 in Arch2:
if Item1 == Item2:
return True
return False

View File

@@ -1,7 +1,7 @@
## @file
# This file is used to parse a Module file of .PKG file
#
# Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
# Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>
#
# This program and the accompanying materials are licensed and made available
# under the terms and conditions of the BSD License which accompanies this
@@ -20,6 +20,7 @@ from xml.dom import minidom
from Library.String import ConvertNEToNOTEQ
from Library.String import ConvertNOTEQToNE
from Library.String import GetStringOfList
from Library.String import IsMatchArch
from Library.Xml.XmlRoutines import XmlElement
from Library.Xml.XmlRoutines import XmlAttribute
from Library.Xml.XmlRoutines import XmlNode
@@ -128,9 +129,11 @@ class BinaryFileXml(object):
pass
NodeList = []
FilenameList = BinaryFile.GetFileNameList()
SupportArch = None
for Filename in FilenameList:
Tmp = FilenameXml()
NodeList.append(Tmp.ToXml(Filename, 'Filename'))
SupportArch = Filename.SupArchList
if GlobalData.gIS_BINARY_INF:
AsBuildList = BinaryFile.GetAsBuiltList()
@@ -142,12 +145,14 @@ class BinaryFileXml(object):
AsBuiltNodeList = []
for Pcd in PatchPcdValueList:
Tmp = PcdEntryXml()
AsBuiltNodeList.append(Tmp.ToXml4(Pcd, 'PatchPcdValue'))
if IsMatchArch(Pcd.SupArchList, SupportArch):
Tmp = PcdEntryXml()
AsBuiltNodeList.append(Tmp.ToXml4(Pcd, 'PatchPcdValue'))
for Pcd in PcdExList:
Tmp = PcdEntryXml()
AsBuiltNodeList.append(Tmp.ToXml4(Pcd, 'PcdExValue'))
if IsMatchArch(Pcd.SupArchList, SupportArch):
Tmp = PcdEntryXml()
AsBuiltNodeList.append(Tmp.ToXml4(Pcd, 'PcdExValue'))
GuiVerElemList = []
for LibGuidVer in LibGuidVerList:

View File

@@ -37,6 +37,7 @@ from BuildClassObject import *
from WorkspaceCommon import GetDeclaredPcd
from Common.Misc import AnalyzeDscPcd
import re
from Common.Parsing import IsValidWord
## Platform build information from DSC file
#
@@ -893,13 +894,23 @@ class DscBuildData(PlatformBuildClassObject):
VariableName, VariableGuid, VariableOffset, DefaultValue = self._ValidatePcd(PcdCName, TokenSpaceGuid, Setting, Type, Dummy4)
ExceedMax = False
FormatCorrect = True
if VariableOffset.isdigit():
if int(VariableOffset,10) > 0xFFFF:
ExceedMax = True
elif re.match(r'[\t\s]*0[xX][a-fA-F0-9]+$',VariableOffset):
if int(VariableOffset,16) > 0xFFFF:
ExceedMax = True
# For Offset written in "A.B"
elif VariableOffset.find('.') > -1:
VariableOffsetList = VariableOffset.split(".")
if not (len(VariableOffsetList) == 2
and IsValidWord(VariableOffsetList[0])
and IsValidWord(VariableOffsetList[1])):
FormatCorrect = False
else:
FormatCorrect = False
if not FormatCorrect:
EdkLogger.error('Build', FORMAT_INVALID, "Invalid syntax or format of the variable offset value is incorrect for %s." % ".".join((TokenSpaceGuid,PcdCName)))
if ExceedMax: