Account for rebase of FV section containing VTF file on IA32/IA64.
This supports cases where the reset vector may not be set at 0xFFFFFFF0.

For example, FV section defined as:
[FV.FvSecPei]
  FvBaseAddress = $(FV_BOOT_BASE)
  FvForceRebase = TRUE

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Leo Duran <[email protected]>
---
 BaseTools/Source/C/GenFv/GenFvInternalLib.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/BaseTools/Source/C/GenFv/GenFvInternalLib.c 
b/BaseTools/Source/C/GenFv/GenFvInternalLib.c
index 7c839e2..8c2827b 100644
--- a/BaseTools/Source/C/GenFv/GenFvInternalLib.c
+++ b/BaseTools/Source/C/GenFv/GenFvInternalLib.c
@@ -2770,11 +2770,13 @@ Returns:
       //
       // Update reset vector (SALE_ENTRY for IPF)
       // Now for IA32 and IA64 platform, the fv which has bsf file must have 
the 
-      // EndAddress of 0xFFFFFFFF. Thus, only this type fv needs to update the 
  
-      // reset vector. If the PEI Core is found, the VTF file will probably 
get  
-      // corrupted by updating the entry point.                                
  
+      // EndAddress of 0xFFFFFFFF (unless the section was rebased).
+      // Thus, only this type fv needs to update the  reset vector.
+      // If the PEI Core is found, the VTF file will probably get
+      // corrupted by updating the entry point.
       //
-      if ((mFvDataInfo.BaseAddress + mFvDataInfo.Size) == 
FV_IMAGES_TOP_ADDRESS) {       
+      if ((mFvDataInfo.ForceRebase == 1) ||
+        (mFvDataInfo.BaseAddress + mFvDataInfo.Size) == FV_IMAGES_TOP_ADDRESS) 
{
         Status = UpdateResetVector (&FvImageMemoryFile, &mFvDataInfo, 
VtfFileImage);
         if (EFI_ERROR(Status)) {                                               
           Error (NULL, 0, 3000, "Invalid", "Could not update the reset 
vector.");
-- 
1.9.1

_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to