summaryrefslogtreecommitdiff
path: root/BaseTools/Source/C
diff options
context:
space:
mode:
authorGao, Liming <liming.gao@intel.com>2014-01-10 05:25:50 +0000
committerlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2014-01-10 05:25:50 +0000
commit2bc3256ca6d439ebf5d85d5e74e5f3e68df14130 (patch)
treecc9a35c905bea5dae72b9758b19f642fc3013e17 /BaseTools/Source/C
parent8d9e16963ee86478776e2f504a776ec712fb0c77 (diff)
downloadedk2-platforms-2bc3256ca6d439ebf5d85d5e74e5f3e68df14130.tar.xz
Sync BaseTool trunk (version r2640) into EDKII BaseTools.
Signed-off-by: Gao, Liming <liming.gao@intel.com> Reviewed-by: Liu, Jiang A <jiang.a.liu@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15089 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'BaseTools/Source/C')
-rw-r--r--BaseTools/Source/C/EfiRom/EfiRom.c57
-rw-r--r--BaseTools/Source/C/GenFv/GenFvInternalLib.c7
-rw-r--r--BaseTools/Source/C/GenFv/GenFvInternalLib.h2
-rw-r--r--BaseTools/Source/C/Include/Common/BuildVersion.h2
-rw-r--r--BaseTools/Source/C/Include/Common/PiFirmwareVolume.h2
-rw-r--r--BaseTools/Source/C/Include/Common/UefiBaseTypes.h10
-rw-r--r--BaseTools/Source/C/Include/IndustryStandard/PeImage.h4
-rw-r--r--BaseTools/Source/C/Include/IndustryStandard/pci22.h4
-rw-r--r--BaseTools/Source/C/VfrCompile/VfrCompiler.cpp6
-rw-r--r--BaseTools/Source/C/VfrCompile/VfrCompiler.h3
-rw-r--r--BaseTools/Source/C/VfrCompile/VfrFormPkg.cpp11
11 files changed, 61 insertions, 47 deletions
diff --git a/BaseTools/Source/C/EfiRom/EfiRom.c b/BaseTools/Source/C/EfiRom/EfiRom.c
index 5152f38ba0..9f7da8017c 100644
--- a/BaseTools/Source/C/EfiRom/EfiRom.c
+++ b/BaseTools/Source/C/EfiRom/EfiRom.c
@@ -1,6 +1,6 @@
/** @file
-Copyright (c) 1999 - 2011, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 1999 - 2013, 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
@@ -237,6 +237,7 @@ Returns:
PCI_3_0_DATA_STRUCTURE *PciDs30;
UINT32 Index;
UINT8 ByteCheckSum;
+ UINT16 CodeType;
PciDs23 = NULL;
PciDs30 = NULL;
@@ -337,8 +338,10 @@ Returns:
//
if (mOptions.Pci23 == 1) {
PciDs23->ImageLength = (UINT16) (TotalSize / 512);
+ CodeType = PciDs23->CodeType;
} else {
PciDs30->ImageLength = (UINT16) (TotalSize / 512);
+ CodeType = PciDs30->CodeType;
}
//
@@ -359,14 +362,16 @@ Returns:
}
}
- ByteCheckSum = 0;
- for (Index = 0; Index < FileSize - 1; Index++) {
- ByteCheckSum = (UINT8) (ByteCheckSum + Buffer[Index]);
- }
+ if (CodeType != PCI_CODE_TYPE_EFI_IMAGE) {
+ ByteCheckSum = 0;
+ for (Index = 0; Index < FileSize - 1; Index++) {
+ ByteCheckSum = (UINT8) (ByteCheckSum + Buffer[Index]);
+ }
- Buffer[FileSize - 1] = (UINT8) ((~ByteCheckSum) + 1);
- if (mOptions.Verbose) {
- VerboseMsg(" Checksum = %02x\n\n", Buffer[FileSize - 1]);
+ Buffer[FileSize - 1] = (UINT8) ((~ByteCheckSum) + 1);
+ if (mOptions.Verbose) {
+ VerboseMsg(" Checksum = %02x\n\n", Buffer[FileSize - 1]);
+ }
}
//
@@ -449,6 +454,8 @@ Returns:
UINT16 MachineType;
UINT16 SubSystem;
UINT32 HeaderPadBytes;
+ UINT32 PadBytesBeforeImage;
+ UINT32 PadBytesAfterImage;
//
// Try to open the input file
@@ -559,6 +566,18 @@ Returns:
TotalSize = (TotalSize + 0x200) &~0x1ff;
}
//
+ // Workaround:
+ // If compressed, put the pad bytes after the image,
+ // else put the pad bytes before the image.
+ //
+ if ((InFile->FileFlags & FILE_FLAG_COMPRESS) != 0) {
+ PadBytesBeforeImage = 0;
+ PadBytesAfterImage = TotalSize - (FileSize + HeaderSize);
+ } else {
+ PadBytesBeforeImage = TotalSize - (FileSize + HeaderSize);
+ PadBytesAfterImage = 0;
+ }
+ //
// Check size
//
if (TotalSize > MAX_OPTION_ROM_SIZE) {
@@ -581,7 +600,7 @@ Returns:
RomHdr.EfiSignature = EFI_PCI_EXPANSION_ROM_HEADER_EFISIGNATURE;
RomHdr.EfiSubsystem = SubSystem;
RomHdr.EfiMachineType = MachineType;
- RomHdr.EfiImageHeaderOffset = (UINT16) HeaderSize;
+ RomHdr.EfiImageHeaderOffset = (UINT16) (HeaderSize + PadBytesBeforeImage);
RomHdr.PcirOffset = (UINT16) (sizeof (RomHdr) + HeaderPadBytes);
//
// Set image as compressed or not
@@ -686,11 +705,18 @@ Returns:
goto BailOut;
}
}
+
//
- // Keep track of how many bytes left to write
+ // Pad head to make it a multiple of 512 bytes
//
- TotalSize -= HeaderSize;
-
+ while (PadBytesBeforeImage > 0) {
+ if (putc (~0, OutFptr) == EOF) {
+ Error (NULL, 0, 2000, "Failed to write trailing pad bytes output file!", NULL);
+ Status = STATUS_ERROR;
+ goto BailOut;
+ }
+ PadBytesBeforeImage--;
+ }
//
// Now dump the input file's contents to the output file
//
@@ -700,18 +726,17 @@ Returns:
goto BailOut;
}
- TotalSize -= FileSize;
//
// Pad the rest of the image to make it a multiple of 512 bytes
//
- while (TotalSize > 0) {
+ while (PadBytesAfterImage > 0) {
if (putc (~0, OutFptr) == EOF) {
Error (NULL, 0, 2000, "Failed to write trailing pad bytes output file!", NULL);
Status = STATUS_ERROR;
goto BailOut;
}
- TotalSize--;
+ PadBytesAfterImage--;
}
BailOut:
@@ -1205,7 +1230,7 @@ Returns:
//
// Copyright declaration
//
- fprintf (stdout, "Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.\n\n");
+ fprintf (stdout, "Copyright (c) 2007 - 2013, Intel Corporation. All rights reserved.\n\n");
//
// Details Option
diff --git a/BaseTools/Source/C/GenFv/GenFvInternalLib.c b/BaseTools/Source/C/GenFv/GenFvInternalLib.c
index d0df4ac13d..0522cf4254 100644
--- a/BaseTools/Source/C/GenFv/GenFvInternalLib.c
+++ b/BaseTools/Source/C/GenFv/GenFvInternalLib.c
@@ -458,9 +458,9 @@ Returns:
case 0:
//
- // 8 byte alignment, mini alignment requirement for FFS file.
+ // 1 byte alignment
//
- *Alignment = 3;
+ *Alignment = 0;
break;
case 1:
@@ -2212,7 +2212,8 @@ Returns:
mFvDataInfo.FvNameGuid.Data4[7]);
}
- if (CompareGuid (&mFvDataInfo.FvFileSystemGuid, &mEfiFirmwareFileSystem2Guid) == 0) {
+ if (CompareGuid (&mFvDataInfo.FvFileSystemGuid, &mEfiFirmwareFileSystem2Guid) == 0 ||
+ CompareGuid (&mFvDataInfo.FvFileSystemGuid, &mEfiFirmwareFileSystem3Guid) == 0) {
mFvDataInfo.IsPiFvImage = TRUE;
}
diff --git a/BaseTools/Source/C/GenFv/GenFvInternalLib.h b/BaseTools/Source/C/GenFv/GenFvInternalLib.h
index 21993b5e7b..a9a00ec028 100644
--- a/BaseTools/Source/C/GenFv/GenFvInternalLib.h
+++ b/BaseTools/Source/C/GenFv/GenFvInternalLib.h
@@ -168,7 +168,7 @@ Abstract:
// VTF (Firmware Volume Top File) signatures
//
#define IA32_X64_VTF_SIGNATURE_OFFSET 0x14
-#define IA32_X64_VTF0_SIGNATURE EFI_SIGNATURE_32('V','T','F',0)
+#define IA32_X64_VTF0_SIGNATURE SIGNATURE_32('V','T','F',0)
//
// Defines to calculate the offset for PEI CORE entry points
diff --git a/BaseTools/Source/C/Include/Common/BuildVersion.h b/BaseTools/Source/C/Include/Common/BuildVersion.h
index b84bd05714..dd9852bad3 100644
--- a/BaseTools/Source/C/Include/Common/BuildVersion.h
+++ b/BaseTools/Source/C/Include/Common/BuildVersion.h
@@ -14,4 +14,4 @@
**/
-#define __BUILD_VERSION "Build 2610"
+#define __BUILD_VERSION "Build 2640"
diff --git a/BaseTools/Source/C/Include/Common/PiFirmwareVolume.h b/BaseTools/Source/C/Include/Common/PiFirmwareVolume.h
index ea06eee695..9d62a9bc3d 100644
--- a/BaseTools/Source/C/Include/Common/PiFirmwareVolume.h
+++ b/BaseTools/Source/C/Include/Common/PiFirmwareVolume.h
@@ -111,7 +111,7 @@ typedef struct {
EFI_FV_BLOCK_MAP_ENTRY BlockMap[1];
} EFI_FIRMWARE_VOLUME_HEADER;
-#define EFI_FVH_SIGNATURE EFI_SIGNATURE_32 ('_', 'F', 'V', 'H')
+#define EFI_FVH_SIGNATURE SIGNATURE_32 ('_', 'F', 'V', 'H')
///
/// Firmware Volume Header Revision definition
diff --git a/BaseTools/Source/C/Include/Common/UefiBaseTypes.h b/BaseTools/Source/C/Include/Common/UefiBaseTypes.h
index 43f585491c..8f27ed7bc6 100644
--- a/BaseTools/Source/C/Include/Common/UefiBaseTypes.h
+++ b/BaseTools/Source/C/Include/Common/UefiBaseTypes.h
@@ -1,7 +1,7 @@
/** @file
Defines data types and constants introduced in UEFI.
- Copyright (c) 2006 - 2007, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2006 - 2013, 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
@@ -146,10 +146,10 @@ typedef union {
//
// Define macros to build data structure signatures from characters.
//
-#define EFI_SIGNATURE_16(A, B) ((A) | (B << 8))
-#define EFI_SIGNATURE_32(A, B, C, D) (EFI_SIGNATURE_16 (A, B) | (EFI_SIGNATURE_16 (C, D) << 16))
-#define EFI_SIGNATURE_64(A, B, C, D, E, F, G, H) \
- (EFI_SIGNATURE_32 (A, B, C, D) | ((UINT64) (EFI_SIGNATURE_32 (E, F, G, H)) << 32))
+#define SIGNATURE_16(A, B) ((A) | (B << 8))
+#define SIGNATURE_32(A, B, C, D) (SIGNATURE_16 (A, B) | (SIGNATURE_16 (C, D) << 16))
+#define SIGNATURE_64(A, B, C, D, E, F, G, H) \
+ (SIGNATURE_32 (A, B, C, D) | ((UINT64) (SIGNATURE_32 (E, F, G, H)) << 32))
//
diff --git a/BaseTools/Source/C/Include/IndustryStandard/PeImage.h b/BaseTools/Source/C/Include/IndustryStandard/PeImage.h
index 7e7c0ea46a..5d55f4d663 100644
--- a/BaseTools/Source/C/Include/IndustryStandard/PeImage.h
+++ b/BaseTools/Source/C/Include/IndustryStandard/PeImage.h
@@ -4,7 +4,7 @@
@bug Fix text - doc as defined in MSFT EFI specification.
- Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
Portions copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.<BR>
This program and the accompanying materials are licensed and made available
@@ -648,7 +648,7 @@ typedef struct {
///
/// Debug Data Structure defined by Apple Mach-O to Coff utility
///
-#define CODEVIEW_SIGNATURE_MTOC EFI_SIGNATURE_32('M', 'T', 'O', 'C')
+#define CODEVIEW_SIGNATURE_MTOC SIGNATURE_32('M', 'T', 'O', 'C')
typedef struct {
UINT32 Signature; ///< "MTOC"
EFI_GUID MachOUuid;
diff --git a/BaseTools/Source/C/Include/IndustryStandard/pci22.h b/BaseTools/Source/C/Include/IndustryStandard/pci22.h
index e1d347afbb..e07aa88cae 100644
--- a/BaseTools/Source/C/Include/IndustryStandard/pci22.h
+++ b/BaseTools/Source/C/Include/IndustryStandard/pci22.h
@@ -1,7 +1,7 @@
/** @file
Support for PCI 2.2 standard.
- Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2006 - 2013, 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
@@ -335,7 +335,7 @@ typedef union {
#pragma pack()
#define PCI_EXPANSION_ROM_HEADER_SIGNATURE 0xaa55
-#define PCI_DATA_STRUCTURE_SIGNATURE EFI_SIGNATURE_32 ('P', 'C', 'I', 'R')
+#define PCI_DATA_STRUCTURE_SIGNATURE SIGNATURE_32 ('P', 'C', 'I', 'R')
#define PCI_CODE_TYPE_PCAT_IMAGE 0x00
#define PCI_CODE_TYPE_EFI_IMAGE 0x03
#define EFI_PCI_EXPANSION_ROM_HEADER_COMPRESSED 0x0001
diff --git a/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp b/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp
index da8c529894..dd34a1b533 100644
--- a/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp
+++ b/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp
@@ -2,7 +2,7 @@
VfrCompiler main class and main function.
-Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2013, 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
@@ -406,8 +406,8 @@ CVfrCompiler::Usage (
UINT32 Index;
CONST CHAR8 *Help[] = {
" ",
- "VfrCompile version " VFR_COMPILER_VERSION __BUILD_VERSION VFR_COMPILER_UPDATE_TIME,
- "Copyright (c) 2004-2011 Intel Corporation. All rights reserved.",
+ "VfrCompile version " VFR_COMPILER_VERSION __BUILD_VERSION,
+ "Copyright (c) 2004-2013 Intel Corporation. All rights reserved.",
" ",
"Usage: VfrCompile [options] VfrFile",
" ",
diff --git a/BaseTools/Source/C/VfrCompile/VfrCompiler.h b/BaseTools/Source/C/VfrCompile/VfrCompiler.h
index fe29f7e3af..ea20bbc5d9 100644
--- a/BaseTools/Source/C/VfrCompile/VfrCompiler.h
+++ b/BaseTools/Source/C/VfrCompile/VfrCompiler.h
@@ -23,8 +23,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include "ParseInf.h"
#define PROGRAM_NAME "VfrCompile"
-#define VFR_COMPILER_VERSION " 2.00 (UEFI 2.3.1)"
-#define VFR_COMPILER_UPDATE_TIME " updated on 2011/07/15"
+#define VFR_COMPILER_VERSION " 2.00 (UEFI 2.4) "
//
// This is how we invoke the C preprocessor on the VFR source file
// to resolve #defines, #includes, etc. To make C source files
diff --git a/BaseTools/Source/C/VfrCompile/VfrFormPkg.cpp b/BaseTools/Source/C/VfrCompile/VfrFormPkg.cpp
index 363ca82a24..addff24cf6 100644
--- a/BaseTools/Source/C/VfrCompile/VfrFormPkg.cpp
+++ b/BaseTools/Source/C/VfrCompile/VfrFormPkg.cpp
@@ -855,17 +855,6 @@ CFormPkg::DeclarePendingQuestion (
// Get VarStoreType
//
ReturnCode = lCVfrDataStorage.GetVarStoreId (FName, &Info.mVarStoreId);
- if (ReturnCode == VFR_RETURN_UNDEFINED) {
- lCVfrDataStorage.DeclareBufferVarStore (
- FName,
- LocalFormSetGuid,
- &lCVfrVarDataTypeDB,
- FName,
- EFI_VARSTORE_ID_INVALID,
- FALSE
- );
- ReturnCode = lCVfrDataStorage.GetVarStoreId (FName, &Info.mVarStoreId, LocalFormSetGuid);
- }
if (ReturnCode != VFR_RETURN_SUCCESS) {
gCVfrErrorHandle.PrintMsg (pNode->mLineNo, FName, "Error", "Var Store Type is not defined");
return ReturnCode;