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