diff options
author | Carsey, Jaben <jaben.carsey@intel.com> | 2018-09-06 05:50:46 +0800 |
---|---|---|
committer | Yonghong Zhu <yonghong.zhu@intel.com> | 2018-09-07 08:44:57 +0800 |
commit | 7bf1eb6ef8ae6ccffca6fc8f36b132be704c0b1b (patch) | |
tree | 49ae309eb22b6c799b3c8d09a81b9b2de3fce500 /BaseTools/Source/Python/GenFds/Region.py | |
parent | b48ec0e8ab1c881ea584ed76d2da0bac09db38ef (diff) | |
download | edk2-7bf1eb6ef8ae6ccffca6fc8f36b132be704c0b1b.tar.gz edk2-7bf1eb6ef8ae6ccffca6fc8f36b132be704c0b1b.tar.bz2 edk2-7bf1eb6ef8ae6ccffca6fc8f36b132be704c0b1b.zip |
BaseTools: refactor to remove duplicate functions
Update GenFdsGlobalVariable GetAlignment to support G.
replace use of local function in Region with updated shared function.
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Bob C Feng <bob.c.feng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
Diffstat (limited to 'BaseTools/Source/Python/GenFds/Region.py')
-rw-r--r-- | BaseTools/Source/Python/GenFds/Region.py | 21 |
1 files changed, 1 insertions, 20 deletions
diff --git a/BaseTools/Source/Python/GenFds/Region.py b/BaseTools/Source/Python/GenFds/Region.py index 7f94b3d66b..5242b74c9e 100644 --- a/BaseTools/Source/Python/GenFds/Region.py +++ b/BaseTools/Source/Python/GenFds/Region.py @@ -124,7 +124,7 @@ class Region(RegionClassObject): #
self.BlockInfoOfRegion(BlockSizeList, FvObj)
self.FvAddress = self.FvAddress + FvOffset
- FvAlignValue = self.GetFvAlignValue(FvObj.FvAlignment)
+ FvAlignValue = GenFdsGlobalVariable.GetAlignment(FvObj.FvAlignment)
if self.FvAddress % FvAlignValue != 0:
EdkLogger.error("GenFds", GENFDS_ERROR,
"FV (%s) is NOT %s Aligned!" % (FvObj.UiFvName, FvObj.FvAlignment))
@@ -277,25 +277,6 @@ class Region(RegionClassObject): GenFdsGlobalVariable.InfLogger(' Region Name = None')
self.PadBuffer(Buffer, ErasePolarity, Size)
- def GetFvAlignValue(self, Str):
- AlignValue = 1
- Granu = 1
- Str = Str.strip().upper()
- if Str.endswith('K'):
- Granu = 1024
- Str = Str[:-1]
- elif Str.endswith('M'):
- Granu = 1024 * 1024
- Str = Str[:-1]
- elif Str.endswith('G'):
- Granu = 1024 * 1024 * 1024
- Str = Str[:-1]
- else:
- pass
-
- AlignValue = int(Str) * Granu
- return AlignValue
-
## BlockSizeOfRegion()
#
# @param BlockSizeList List of block information
|