diff options
author | lgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524> | 2011-09-18 12:17:25 +0000 |
---|---|---|
committer | lgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524> | 2011-09-18 12:17:25 +0000 |
commit | b36d134faf4305247830522b8e2bb255e98c5699 (patch) | |
tree | ec37795cbc86b693528a062030cb516039bcb1c2 /BaseTools/Source/C | |
parent | e7fe4028631b6a7d70e3c02c7c40ff1504321daa (diff) | |
download | edk2-platforms-b36d134faf4305247830522b8e2bb255e98c5699.tar.xz |
Sync BaseTools Branch (version r2321) to EDKII main trunk.
Signed-off-by: lgao4
Reviewed-by: gikidy
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12372 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'BaseTools/Source/C')
26 files changed, 169 insertions, 82 deletions
diff --git a/BaseTools/Source/C/BootSectImage/bootsectimage.c b/BaseTools/Source/C/BootSectImage/bootsectimage.c index 0d0a3cbf77..36e896e5c4 100644 --- a/BaseTools/Source/C/BootSectImage/bootsectimage.c +++ b/BaseTools/Source/C/BootSectImage/bootsectimage.c @@ -56,7 +56,7 @@ Returns: --*/
{
- printf ("%s v%d.%d - Utility to break a file into two pieces at the specified offset.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION);
+ printf ("%s v%d.%d %s - Utility to break a file into two pieces at the specified offset.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION, __BUILD_VERSION);
printf ("Copyright (c) 1999-2010 Intel Corporation. All rights reserved.\n");
}
diff --git a/BaseTools/Source/C/Common/BasePeCoff.c b/BaseTools/Source/C/Common/BasePeCoff.c index 4a3f92fb15..54bd099e1d 100644 --- a/BaseTools/Source/C/Common/BasePeCoff.c +++ b/BaseTools/Source/C/Common/BasePeCoff.c @@ -979,6 +979,14 @@ Returns: ImageContext,
Section->VirtualAddress + Section->Misc.VirtualSize - 1
);
+ //
+ // If the base start or end address resolved to 0, then fail.
+ //
+ if ((Base == NULL) || (End == NULL)) {
+ ImageContext->ImageError = IMAGE_ERROR_SECTION_NOT_LOADED;
+ return RETURN_LOAD_ERROR;
+ }
+
if (ImageContext->IsTeImage) {
Base = (CHAR8 *) ((UINTN) Base + sizeof (EFI_TE_IMAGE_HEADER) - (UINTN) TeHdr->StrippedSize);
End = (CHAR8 *) ((UINTN) End + sizeof (EFI_TE_IMAGE_HEADER) - (UINTN) TeHdr->StrippedSize);
@@ -987,13 +995,6 @@ Returns: if (End > MaxEnd) {
MaxEnd = End;
}
- //
- // If the base start or end address resolved to 0, then fail.
- //
- if ((Base == NULL) || (End == NULL)) {
- ImageContext->ImageError = IMAGE_ERROR_SECTION_NOT_LOADED;
- return RETURN_LOAD_ERROR;
- }
//
// Read the section
diff --git a/BaseTools/Source/C/Common/CommonLib.h b/BaseTools/Source/C/Common/CommonLib.h index f407e6d1e9..0610b21ed0 100644 --- a/BaseTools/Source/C/Common/CommonLib.h +++ b/BaseTools/Source/C/Common/CommonLib.h @@ -23,6 +23,7 @@ Abstract: #define _EFI_COMMON_LIB_H
#include <Common/UefiBaseTypes.h>
+#include <Common/BuildVersion.h>
#define PRINTED_GUID_BUFFER_SIZE 37 // including null-termination
//
// Function declarations
diff --git a/BaseTools/Source/C/EfiLdrImage/EfiLdrImage.c b/BaseTools/Source/C/EfiLdrImage/EfiLdrImage.c index a92f76dbb0..01685964f1 100644 --- a/BaseTools/Source/C/EfiLdrImage/EfiLdrImage.c +++ b/BaseTools/Source/C/EfiLdrImage/EfiLdrImage.c @@ -83,7 +83,7 @@ Returns: --*/
{
- printf ("%s v%d.%d -Utility to break a file into two pieces at the request offset.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION);
+ printf ("%s v%d.%d %s -Utility to break a file into two pieces at the request offset.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION, __BUILD_VERSION);
printf ("Copyright (c) 1999-2010 Intel Corporation. All rights reserved.\n");
}
diff --git a/BaseTools/Source/C/EfiRom/EfiRom.c b/BaseTools/Source/C/EfiRom/EfiRom.c index 4642f441b4..9f71b19323 100644 --- a/BaseTools/Source/C/EfiRom/EfiRom.c +++ b/BaseTools/Source/C/EfiRom/EfiRom.c @@ -1173,7 +1173,7 @@ Returns: Nothing.
--*/
{
- fprintf (stdout, "%s Version %d.%d\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION);
+ fprintf (stdout, "%s Version %d.%d %s \n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION, __BUILD_VERSION);
}
static
diff --git a/BaseTools/Source/C/GenBootSector/GenBootSector.c b/BaseTools/Source/C/GenBootSector/GenBootSector.c index 4a9a0e1b57..169d81e031 100644 --- a/BaseTools/Source/C/GenBootSector/GenBootSector.c +++ b/BaseTools/Source/C/GenBootSector/GenBootSector.c @@ -28,6 +28,7 @@ Abstract: #include "ParseInf.h"
#include "EfiUtilityMsgs.h"
+#include "CommonLib.h"
//
// Utility Name
@@ -541,7 +542,7 @@ Returns: --*/
{
- printf ("%s v%d.%d -Utility to retrieve and update the boot sector or MBR.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION);
+ printf ("%s v%d.%d %s -Utility to retrieve and update the boot sector or MBR.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION, __BUILD_VERSION);
printf ("Copyright (c) 2009 - 2010 Intel Corporation. All rights reserved.\n");
}
diff --git a/BaseTools/Source/C/GenCrc32/GenCrc32.c b/BaseTools/Source/C/GenCrc32/GenCrc32.c index 0a31f54890..681fe4f1e6 100644 --- a/BaseTools/Source/C/GenCrc32/GenCrc32.c +++ b/BaseTools/Source/C/GenCrc32/GenCrc32.c @@ -55,7 +55,7 @@ Returns: --*/
{
- fprintf (stdout, "%s Version %d.%d\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION);
+ fprintf (stdout, "%s Version %d.%d %s \n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION, __BUILD_VERSION);
}
VOID
diff --git a/BaseTools/Source/C/GenFfs/GenFfs.c b/BaseTools/Source/C/GenFfs/GenFfs.c index 2796c86bf5..24081ebfc4 100644 --- a/BaseTools/Source/C/GenFfs/GenFfs.c +++ b/BaseTools/Source/C/GenFfs/GenFfs.c @@ -87,7 +87,7 @@ Returns: --*/
{
- fprintf (stdout, "%s Version %d.%d\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION);
+ fprintf (stdout, "%s Version %d.%d %s \n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION, __BUILD_VERSION);
}
STATIC
diff --git a/BaseTools/Source/C/GenFv/GenFv.c b/BaseTools/Source/C/GenFv/GenFv.c index 2cb8771b31..8f452c7374 100644 --- a/BaseTools/Source/C/GenFv/GenFv.c +++ b/BaseTools/Source/C/GenFv/GenFv.c @@ -40,7 +40,6 @@ Abstract: //
#define UTILITY_MAJOR_VERSION 0
#define UTILITY_MINOR_VERSION 1
-#define GENFV_UPDATE_TIME " updated on 2010/2/1"
EFI_GUID mEfiFirmwareFileSystem2Guid = EFI_FIRMWARE_FILE_SYSTEM2_GUID;
@@ -65,7 +64,7 @@ Returns: --*/
{
- fprintf (stdout, "%s Version %d.%d %s\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION, GENFV_UPDATE_TIME);
+ fprintf (stdout, "%s Version %d.%d %s \n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION, __BUILD_VERSION);
}
STATIC
diff --git a/BaseTools/Source/C/GenFv/GenFvInternalLib.c b/BaseTools/Source/C/GenFv/GenFvInternalLib.c index 189dc431eb..d86909b4df 100644 --- a/BaseTools/Source/C/GenFv/GenFvInternalLib.c +++ b/BaseTools/Source/C/GenFv/GenFvInternalLib.c @@ -1085,7 +1085,11 @@ Returns: // Rebase the PE or TE image in FileBuffer of FFS file for XIP
// Rebase for the debug genfvmap tool
//
- FfsRebase (FvInfo, FvInfo->FvFiles[Index], (EFI_FFS_FILE_HEADER *) FileBuffer, (UINTN) *VtfFileImage - (UINTN) FvImage->FileImage, FvMapFile);
+ Status = FfsRebase (FvInfo, FvInfo->FvFiles[Index], (EFI_FFS_FILE_HEADER *) FileBuffer, (UINTN) *VtfFileImage - (UINTN) FvImage->FileImage, FvMapFile);
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 3000, "Invalid", "Could not rebase %s.", FvInfo->FvFiles[Index]);
+ return Status;
+ }
//
// copy VTF File
//
@@ -1124,7 +1128,11 @@ Returns: // Rebase the PE or TE image in FileBuffer of FFS file for XIP.
// Rebase Bs and Rt drivers for the debug genfvmap tool.
//
- FfsRebase (FvInfo, FvInfo->FvFiles[Index], (EFI_FFS_FILE_HEADER *) FileBuffer, (UINTN) FvImage->CurrentFilePointer - (UINTN) FvImage->FileImage, FvMapFile);
+ Status = FfsRebase (FvInfo, FvInfo->FvFiles[Index], (EFI_FFS_FILE_HEADER *) FileBuffer, (UINTN) FvImage->CurrentFilePointer - (UINTN) FvImage->FileImage, FvMapFile);
+ if (EFI_ERROR (Status)) {
+ Error (NULL, 0, 3000, "Invalid", "Could not rebase %s.", FvInfo->FvFiles[Index]);
+ return Status;
+ }
//
// Copy the file
//
@@ -3020,7 +3028,7 @@ Returns: return EFI_OUT_OF_RESOURCES;
}
memset ((VOID *) MemoryImagePointer, 0, (UINTN) ImageContext.ImageSize + ImageContext.SectionAlignment);
- ImageContext.ImageAddress = ((UINTN) MemoryImagePointer + ImageContext.SectionAlignment - 1) & (~((INT64)ImageContext.SectionAlignment - 1));
+ ImageContext.ImageAddress = ((UINTN) MemoryImagePointer + ImageContext.SectionAlignment - 1) & (~((UINTN) ImageContext.SectionAlignment - 1));
Status = PeCoffLoaderLoadImage (&ImageContext);
if (EFI_ERROR (Status)) {
@@ -3247,7 +3255,7 @@ Returns: return EFI_OUT_OF_RESOURCES;
}
memset ((VOID *) MemoryImagePointer, 0, (UINTN) ImageContext.ImageSize + ImageContext.SectionAlignment);
- ImageContext.ImageAddress = ((UINTN) MemoryImagePointer + ImageContext.SectionAlignment - 1) & (~(ImageContext.SectionAlignment - 1));
+ ImageContext.ImageAddress = ((UINTN) MemoryImagePointer + ImageContext.SectionAlignment - 1) & (~((UINTN) ImageContext.SectionAlignment - 1));
Status = PeCoffLoaderLoadImage (&ImageContext);
if (EFI_ERROR (Status)) {
diff --git a/BaseTools/Source/C/GenFw/GenFw.c b/BaseTools/Source/C/GenFw/GenFw.c index 90ba251102..d511834fc0 100644 --- a/BaseTools/Source/C/GenFw/GenFw.c +++ b/BaseTools/Source/C/GenFw/GenFw.c @@ -147,7 +147,7 @@ Returns: --*/
{
- fprintf (stdout, "%s Version %d.%d\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION);
+ fprintf (stdout, "%s Version %d.%d %s \n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION, __BUILD_VERSION);
}
STATIC
@@ -658,7 +658,10 @@ PeCoffConvertImageToXip ( SectionHeader->SizeOfRawData
);
}
- SectionHeader->SizeOfRawData = SectionHeader->Misc.VirtualSize;
+ //
+ // Make the size of raw data in section header alignment.
+ //
+ SectionHeader->SizeOfRawData = (SectionHeader->Misc.VirtualSize + PeHdr->Pe32.OptionalHeader.FileAlignment - 1) & (~(PeHdr->Pe32.OptionalHeader.FileAlignment - 1));
SectionHeader->PointerToRawData = SectionHeader->VirtualAddress;
}
diff --git a/BaseTools/Source/C/GenPage/GenPage.c b/BaseTools/Source/C/GenPage/GenPage.c index e92bcf5d9e..6c24a2f9ec 100644 --- a/BaseTools/Source/C/GenPage/GenPage.c +++ b/BaseTools/Source/C/GenPage/GenPage.c @@ -91,7 +91,7 @@ Returns: --*/
{
- printf ("%s v%d.%d -Utility to generate the EfiLoader image containing page table.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION);
+ printf ("%s v%d.%d %s -Utility to generate the EfiLoader image containing page table.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION, __BUILD_VERSION);
printf ("Copyright (c) 2008 - 2011 Intel Corporation. All rights reserved.\n");
}
diff --git a/BaseTools/Source/C/GenSec/GenSec.c b/BaseTools/Source/C/GenSec/GenSec.c index ed34ec408e..ffa0ee62fb 100644 --- a/BaseTools/Source/C/GenSec/GenSec.c +++ b/BaseTools/Source/C/GenSec/GenSec.c @@ -118,7 +118,7 @@ Returns: --*/
{
- fprintf (stdout, "%s Version %d.%d\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION);
+ fprintf (stdout, "%s Version %d.%d %s \n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION, __BUILD_VERSION);
}
STATIC
diff --git a/BaseTools/Source/C/GenVtf/GenVtf.c b/BaseTools/Source/C/GenVtf/GenVtf.c index 035c268a2c..e56544e544 100644 --- a/BaseTools/Source/C/GenVtf/GenVtf.c +++ b/BaseTools/Source/C/GenVtf/GenVtf.c @@ -2383,7 +2383,7 @@ Returns: --*/
{
- fprintf (stdout, "%s Version %d.%d\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION);
+ fprintf (stdout, "%s Version %d.%d %s \n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION, __BUILD_VERSION);
}
VOID
diff --git a/BaseTools/Source/C/GnuGenBootSector/GnuGenBootSector.c b/BaseTools/Source/C/GnuGenBootSector/GnuGenBootSector.c index 267eaa332c..1ce22fc8fa 100644 --- a/BaseTools/Source/C/GnuGenBootSector/GnuGenBootSector.c +++ b/BaseTools/Source/C/GnuGenBootSector/GnuGenBootSector.c @@ -275,7 +275,7 @@ Version ( VOID
)
{
- printf ("%s v%d.%d -Utility to retrieve and update the boot sector or MBR.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION);
+ printf ("%s v%d.%d %s-Utility to retrieve and update the boot sector or MBR.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION, __BUILD_VERSION);
printf ("Copyright (c) 2007-2010 Intel Corporation. All rights reserved.\n");
}
diff --git a/BaseTools/Source/C/Include/Common/BuildVersion.h b/BaseTools/Source/C/Include/Common/BuildVersion.h new file mode 100644 index 0000000000..141f70b25a --- /dev/null +++ b/BaseTools/Source/C/Include/Common/BuildVersion.h @@ -0,0 +1,3 @@ +//This file is for build version number auto generation
+//
+#define __BUILD_VERSION "Build 2318"
diff --git a/BaseTools/Source/C/LzmaCompress/LzmaCompress.c b/BaseTools/Source/C/LzmaCompress/LzmaCompress.c index d8e98890fe..7d254ed49a 100644 --- a/BaseTools/Source/C/LzmaCompress/LzmaCompress.c +++ b/BaseTools/Source/C/LzmaCompress/LzmaCompress.c @@ -27,6 +27,7 @@ #include "Sdk/C/7zVersion.h"
#include "Sdk/C/LzmaDec.h"
#include "Sdk/C/LzmaEnc.h"
+#include "CommonLib.h"
const char *kCantReadMessage = "Can not read input file";
const char *kCantWriteMessage = "Can not write output file";
@@ -82,7 +83,7 @@ int PrintUserError(char *buffer) void PrintVersion(char *buffer)
{
- sprintf (buffer, "%s Version %d.%d", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION);
+ sprintf (buffer, "%s Version %d.%d %s ", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION, __BUILD_VERSION);
}
#define IN_BUF_SIZE (1 << 16)
diff --git a/BaseTools/Source/C/Makefiles/app.makefile b/BaseTools/Source/C/Makefiles/app.makefile index bef6f28c06..ed2e2fba08 100644 --- a/BaseTools/Source/C/Makefiles/app.makefile +++ b/BaseTools/Source/C/Makefiles/app.makefile @@ -1,12 +1,12 @@ -## @file
-#
-# Copyright (c) 2007 - 2010, 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
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+## @file +# +# Copyright (c) 2007 - 2010, 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 +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. # @@ -22,4 +22,6 @@ all: $(MAKEROOT)/bin $(APPLICATION) $(APPLICATION): $(OBJECTS) $(LINKER) -o $(APPLICATION) $(LFLAGS) $(OBJECTS) -L$(MAKEROOT)/libs $(LIBS) +$(OBJECTS): ../Include/Common/BuildVersion.h + include $(MAKEROOT)/Makefiles/footer.makefile diff --git a/BaseTools/Source/C/Makefiles/ms.app b/BaseTools/Source/C/Makefiles/ms.app index 13c83f4edf..84173e5da4 100644 --- a/BaseTools/Source/C/Makefiles/ms.app +++ b/BaseTools/Source/C/Makefiles/ms.app @@ -1,12 +1,12 @@ -## @file
-#
-# Copyright (c) 2007 - 2010, 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
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+## @file +# +# Copyright (c) 2007 - 2010, 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 +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. !INCLUDE ..\Makefiles\ms.common @@ -19,6 +19,8 @@ $(APPLICATION) : $(OBJECTS) -@if not exist $(BIN_PATH) mkdir $(BIN_PATH) $(LD) /nologo /debug /incremental:no /nodefaultlib:libc.lib /out:$@ $(LIBS) $** +$(OBJECTS) : ..\Include\Common\BuildVersion.h + .PHONY:clean .PHONY:cleanall diff --git a/BaseTools/Source/C/Split/Split.c b/BaseTools/Source/C/Split/Split.c index 930a2ad734..9b81eeb762 100644 --- a/BaseTools/Source/C/Split/Split.c +++ b/BaseTools/Source/C/Split/Split.c @@ -26,6 +26,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include "ParseInf.h"
#include "CommonLib.h"
#include "EfiUtilityMsgs.h"
+
//
// Utility Name
//
@@ -57,7 +58,7 @@ Returns: --*/
{
- printf ("%s v%d.%d -Utility to break a file into two pieces at the request offset.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION);
+ printf ("%s v%d.%d %s -Utility to break a file into two pieces at the request offset.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION, __BUILD_VERSION);
printf ("Copyright (c) 1999-2010 Intel Corporation. All rights reserved.\n");
}
diff --git a/BaseTools/Source/C/TianoCompress/TianoCompress.c b/BaseTools/Source/C/TianoCompress/TianoCompress.c index 81adcc7876..145288bb80 100644 --- a/BaseTools/Source/C/TianoCompress/TianoCompress.c +++ b/BaseTools/Source/C/TianoCompress/TianoCompress.c @@ -1664,7 +1664,7 @@ Returns: --*/
{
- fprintf (stdout, "%s Version %d.%d\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION);
+ fprintf (stdout, "%s Version %d.%d %s \n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION, __BUILD_VERSION);
}
VOID
diff --git a/BaseTools/Source/C/VfrCompile/GNUmakefile b/BaseTools/Source/C/VfrCompile/GNUmakefile index af04ab104c..7f18e78eb6 100644 --- a/BaseTools/Source/C/VfrCompile/GNUmakefile +++ b/BaseTools/Source/C/VfrCompile/GNUmakefile @@ -30,7 +30,21 @@ LINKER = $(CXX) EXTRA_CLEAN_OBJECTS = EfiVfrParser.cpp EfiVfrParser.h VfrParser.dlg VfrTokens.h VfrLexer.cpp VfrLexer.h VfrSyntax.cpp tokens.h
-include $(MAKEROOT)/Makefiles/app.makefile
+MAKEROOT ?= ../..
+
+include $(MAKEROOT)/Makefiles/header.makefile
+
+APPLICATION = $(MAKEROOT)/bin/$(APPNAME)
+
+.PHONY:all
+all: $(MAKEROOT)/bin $(APPLICATION)
+
+$(APPLICATION): $(OBJECTS)
+ $(LINKER) -o $(APPLICATION) $(LFLAGS) $(OBJECTS) -L$(MAKEROOT)/libs $(LIBS)
+
+VfrCompiler.o: ../Include/Common/BuildVersion.h
+
+include $(MAKEROOT)/Makefiles/footer.makefile
VfrSyntax.cpp EfiVfrParser.cpp EfiVfrParser.h VfrParser.dlg VfrTokens.h: Pccts/antlr/antlr VfrSyntax.g
Pccts/antlr/antlr -CC -e3 -ck 3 -k 2 -fl VfrParser.dlg -ft VfrTokens.h -o . VfrSyntax.g
diff --git a/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp b/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp index 926561760a..58be497230 100644 --- a/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp +++ b/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp @@ -403,7 +403,7 @@ CVfrCompiler::Usage ( UINT32 Index;
CONST CHAR8 *Help[] = {
" ",
- "VfrCompile version " VFR_COMPILER_VERSION VFR_COMPILER_UPDATE_TIME,
+ "VfrCompile version " VFR_COMPILER_VERSION __BUILD_VERSION VFR_COMPILER_UPDATE_TIME,
"Copyright (c) 2004-2011 Intel Corporation. All rights reserved.",
" ",
"Usage: VfrCompile [options] VfrFile",
@@ -728,7 +728,7 @@ CVfrCompiler::GenRecordListFile ( goto Err1;
}
- fprintf (pOutFile, "//\n// VFR compiler version " VFR_COMPILER_VERSION "\n//\n");
+ fprintf (pOutFile, "//\n// VFR compiler version " VFR_COMPILER_VERSION __BUILD_VERSION "\n//\n");
LineNo = 0;
while (!feof (pInFile)) {
if (fgets (LineBuf, MAX_VFR_LINE_LEN, pInFile) != NULL) {
diff --git a/BaseTools/Source/C/VfrCompile/VfrFormPkg.cpp b/BaseTools/Source/C/VfrCompile/VfrFormPkg.cpp index 6401e71f4d..f0678ca3cb 100644 --- a/BaseTools/Source/C/VfrCompile/VfrFormPkg.cpp +++ b/BaseTools/Source/C/VfrCompile/VfrFormPkg.cpp @@ -561,22 +561,24 @@ CFormPkg::DeclarePendingQuestion ( CHAR8 *VarStr;
UINT32 ArrayIdx;
CHAR8 FName[MAX_NAME_LEN];
+ CHAR8 *SName;
+ CHAR8 *NewStr;
EFI_VFR_RETURN_CODE ReturnCode;
EFI_VFR_VARSTORE_TYPE VarStoreType = EFI_VFR_VARSTORE_INVALID;
+ //
+ // Declare all questions as Numeric in DisableIf True
+ //
+ // DisableIf
+ CIfrDisableIf DIObj;
+ DIObj.SetLineNo (LineNo);
+
+ //TrueOpcode
+ CIfrTrue TObj (LineNo);
+
+ // Declare Numeric qeustion for each undefined question.
for (pNode = PendingAssignList; pNode != NULL; pNode = pNode->mNext) {
if (pNode->mFlag == PENDING) {
- //
- // declare this question as Numeric in SuppressIf True
- //
- // SuppressIf
- CIfrSuppressIf SIObj;
- SIObj.SetLineNo (LineNo);
-
- //TrueOpcode
- CIfrTrue TObj (LineNo);
-
- //Numeric qeustion
CIfrNumeric CNObj;
EFI_VARSTORE_INFO Info;
EFI_QUESTION_ID QId = EFI_QUESTION_ID_INVALID;
@@ -639,7 +641,16 @@ CFormPkg::DeclarePendingQuestion ( ReturnCode = lCVfrDataStorage.GetEfiVarStoreInfo (&Info);
} else if (VarStoreType == EFI_VFR_VARSTORE_BUFFER) {
VarStr = pNode->mKey;
- ReturnCode = lCVfrVarDataTypeDB.GetDataFieldInfo (VarStr, Info.mInfo.mVarOffset, Info.mVarType, Info.mVarTotalSize);
+ //convert VarStr with store name to VarStr with structure name
+ ReturnCode = lCVfrDataStorage.GetBufferVarStoreDataTypeName (FName, &SName);
+ if (ReturnCode == VFR_RETURN_SUCCESS) {
+ NewStr = new CHAR8[strlen (VarStr) + strlen (SName) + 1];
+ NewStr[0] = '\0';
+ strcpy (NewStr, SName);
+ strcat (NewStr, VarStr + strlen (FName));
+ ReturnCode = lCVfrVarDataTypeDB.GetDataFieldInfo (NewStr, Info.mInfo.mVarOffset, Info.mVarType, Info.mVarTotalSize);
+ delete NewStr;
+ }
} else {
ReturnCode = VFR_RETURN_UNSUPPORTED;
}
@@ -657,7 +668,7 @@ CFormPkg::DeclarePendingQuestion ( // For undefined Efi VarStore type question
// Append the extended guided opcode to contain VarName
//
- if (VarStoreType == EFI_VFR_VARSTORE_EFI) {
+ if (VarStoreType == EFI_VFR_VARSTORE_EFI || VfrCompatibleMode) {
CIfrVarEqName CVNObj (QId, Info.mInfo.mVarName);
CVNObj.SetLineNo (LineNo);
}
@@ -667,13 +678,15 @@ CFormPkg::DeclarePendingQuestion ( //
CIfrEnd CEObj;
CEObj.SetLineNo (LineNo);
- //
- // End for SuppressIf
- //
- CIfrEnd SEObj;
- SEObj.SetLineNo (LineNo);
}
}
+
+ //
+ // End for DisableIf
+ //
+ CIfrEnd SEObj;
+ SEObj.SetLineNo (LineNo);
+
return VFR_RETURN_SUCCESS;
}
diff --git a/BaseTools/Source/C/VfrCompile/VfrSyntax.g b/BaseTools/Source/C/VfrCompile/VfrSyntax.g index 081c67d715..0cd87bb5e8 100644 --- a/BaseTools/Source/C/VfrCompile/VfrSyntax.g +++ b/BaseTools/Source/C/VfrCompile/VfrSyntax.g @@ -1387,19 +1387,21 @@ vfrFormDefinition : CIfrLabel LObj3;
LObj3.SetLineNo(E->getLine());
LObj3.SetNumber (0xffff); //add end label for UEFI, label number hardcode 0xffff
- //
- // Declare undefined Question
- //
- if (gCFormPkg.HavePendingUnassigned()) {
- gCFormPkg.DeclarePendingQuestion (
- gCVfrVarDataTypeDB,
- mCVfrDataStorage,
- mCVfrQuestionDB,
- &mFormsetGuid,
- E->getLine()
- );
- }
}
+
+ //
+ // Declare undefined Question so that they can be used in expression.
+ //
+ if (gCFormPkg.HavePendingUnassigned()) {
+ gCFormPkg.DeclarePendingQuestion (
+ gCVfrVarDataTypeDB,
+ mCVfrDataStorage,
+ mCVfrQuestionDB,
+ &mFormsetGuid,
+ E->getLine()
+ );
+ }
+
//
// mCVfrQuestionDB.PrintAllQuestion();
//
@@ -2110,6 +2112,7 @@ vfrStatementNumeric : <<
CIfrNumeric NObj;
UINT32 DataTypeSize;
+ BOOLEAN IsSupported;
>>
L:Numeric << NObj.SetLineNo(L->getLine()); >>
vfrQuestionHeader[NObj] "," << // check data type
@@ -2125,7 +2128,23 @@ vfrStatementNumeric : }
vfrSetMinMaxStep[NObj]
vfrStatementQuestionOptionList
- E:EndNumeric << CRT_END_OP (E); >>
+ E:EndNumeric <<
+ IsSupported = FALSE;
+ switch (_GET_CURRQEST_DATATYPE()) {
+ case EFI_IFR_TYPE_NUM_SIZE_8:
+ case EFI_IFR_TYPE_NUM_SIZE_16:
+ case EFI_IFR_TYPE_NUM_SIZE_32:
+ case EFI_IFR_TYPE_NUM_SIZE_64:
+ IsSupported = TRUE;
+ break;
+ default:
+ break;
+ }
+ if (!IsSupported) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, L->getLine(), "Numeric question only support UINT8, UINT16, UINT32 and UINT64 data type.");
+ }
+ CRT_END_OP (E);
+ >>
";"
;
@@ -2170,6 +2189,7 @@ vfrStatementOneOf : <<
CIfrOneOf OObj;
UINT32 DataTypeSize;
+ BOOLEAN IsSupported;
>>
L:OneOf << OObj.SetLineNo(L->getLine()); >>
vfrQuestionHeader[OObj] "," << //check data type
@@ -2184,7 +2204,23 @@ vfrStatementOneOf : vfrSetMinMaxStep[OObj]
}
vfrStatementQuestionOptionList
- E:EndOneOf << CRT_END_OP (E); >>
+ E:EndOneOf <<
+ IsSupported = FALSE;
+ switch (_GET_CURRQEST_DATATYPE()) {
+ case EFI_IFR_TYPE_NUM_SIZE_8:
+ case EFI_IFR_TYPE_NUM_SIZE_16:
+ case EFI_IFR_TYPE_NUM_SIZE_32:
+ case EFI_IFR_TYPE_NUM_SIZE_64:
+ IsSupported = TRUE;
+ break;
+ default:
+ break;
+ }
+ if (!IsSupported) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, L->getLine(), "OneOf question only support UINT8, UINT16, UINT32 and UINT64 data type.");
+ }
+ CRT_END_OP (E);
+ >>
";"
;
diff --git a/BaseTools/Source/C/VolInfo/VolInfo.c b/BaseTools/Source/C/VolInfo/VolInfo.c index 70d4589e80..78c6cf6561 100644 --- a/BaseTools/Source/C/VolInfo/VolInfo.c +++ b/BaseTools/Source/C/VolInfo/VolInfo.c @@ -30,6 +30,7 @@ Abstract: #include <Common/UefiCapsule.h> #include <Common/PiFirmwareFile.h> #include <Common/PiFirmwareVolume.h> + #include <Guid/PiFirmwareFileSystem.h> #include <IndustryStandard/PeImage.h> #include <Protocol/GuidedSectionExtraction.h> @@ -172,10 +173,11 @@ Returns: // // Print utility header // - printf ("%s Tiano Firmware Volume FFS image info. Version %d.%d, %s\n", + printf ("%s Tiano Firmware Volume FFS image info. Version %d.%d %s, %s\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION, + __BUILD_VERSION, __DATE__ ); |