From 5552b8d1c885b1215cec72b8e21b5816a4511737 Mon Sep 17 00:00:00 2001
From: Olivier Martin <olivier.martin@arm.com>
Date: Wed, 8 Jun 2011 19:30:49 +0100
Subject: [PATCH] Fix GenFv for FV files located at 0x0

Fix GenFv for FV file rebased at 0x0 by using the more appropriate attribute 'BaseAddressSet' already defined in the FV_INFO structure.
---
 BaseTools/Source/C/GenFv/GenFv.c            |    2 +-
 BaseTools/Source/C/GenFv/GenFvInternalLib.c |    3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)
 mode change 100644 => 100755 BaseTools/Source/C/GenFv/GenFv.c

diff --git a/BaseTools/Source/C/GenFv/GenFv.c b/BaseTools/Source/C/GenFv/GenFv.c
old mode 100644
new mode 100755
index 2cb8771..4662461
--- a/BaseTools/Source/C/GenFv/GenFv.c
+++ b/BaseTools/Source/C/GenFv/GenFv.c
@@ -598,7 +598,7 @@ Returns:
               );
   } else {
     VerboseMsg ("Create Fv image and its map file");
-    if (mFvDataInfo.BaseAddress != 0) {
+    if (mFvDataInfo.BaseAddressSet) {
       VerboseMsg ("FvImage Rebase Address is 0x%llX", (unsigned long long) mFvDataInfo.BaseAddress);
     }
     //
diff --git a/BaseTools/Source/C/GenFv/GenFvInternalLib.c b/BaseTools/Source/C/GenFv/GenFvInternalLib.c
index 189dc43..985e4d8 100644
--- a/BaseTools/Source/C/GenFv/GenFvInternalLib.c
+++ b/BaseTools/Source/C/GenFv/GenFvInternalLib.c
@@ -209,6 +209,7 @@ Returns:
       DebugMsg (NULL, 0, 9, "rebase address", "%s = %s", EFI_FV_BASE_ADDRESS_STRING, Value);
 
       FvInfo->BaseAddress = Value64;
+      FvInfo->BaseAddressSet = TRUE;
     }
   }
 
@@ -2820,7 +2821,7 @@ Returns:
   //
   // Don't need to relocate image when BaseAddress is not set.
   //
-  if (FvInfo->BaseAddress == 0) {
+  if (FvInfo->BaseAddressSet == FALSE) {
     return EFI_SUCCESS;
   }
   XipBase = FvInfo->BaseAddress + XipOffset;
-- 
1.6.3.3

