## @file\r
# process FD generation\r
#\r
-# Copyright (c) 2007, Intel Corporation\r
+# Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>\r
#\r
-# All rights reserved. This program and the accompanying materials\r
+# This program and the accompanying materials\r
# are licensed and made available under the terms and conditions of the BSD License\r
# which accompanies this distribution. The full text of the license may be found at\r
# http://opensource.org/licenses/bsd-license.php\r
GenFdsGlobalVariable.VerboseLogger('################### Gen VTF ####################')\r
self.GenVtfFile()\r
\r
+ TempFdBuffer = StringIO.StringIO('')\r
+ PreviousRegionStart = -1\r
+ PreviousRegionSize = 1\r
+ \r
+ for RegionObj in self.RegionList :\r
+ if RegionObj.RegionType == 'CAPSULE':\r
+ continue\r
+ if RegionObj.Offset + RegionObj.Size <= PreviousRegionStart:\r
+ pass\r
+ elif RegionObj.Offset <= PreviousRegionStart or (RegionObj.Offset >=PreviousRegionStart and RegionObj.Offset < PreviousRegionStart + PreviousRegionSize):\r
+ pass\r
+ elif RegionObj.Offset > PreviousRegionStart + PreviousRegionSize:\r
+ GenFdsGlobalVariable.InfLogger('Padding region starting from offset 0x%X, with size 0x%X' %(PreviousRegionStart + PreviousRegionSize, RegionObj.Offset - (PreviousRegionStart + PreviousRegionSize)))\r
+ PadRegion = Region.Region()\r
+ PadRegion.Offset = PreviousRegionStart + PreviousRegionSize\r
+ PadRegion.Size = RegionObj.Offset - PadRegion.Offset\r
+ PadRegion.AddToBuffer(TempFdBuffer, self.BaseAddress, self.BlockSizeList, self.ErasePolarity, GenFds.ImageBinDict, self.vtfRawDict, self.DefineVarDict)\r
+ PreviousRegionStart = RegionObj.Offset\r
+ PreviousRegionSize = RegionObj.Size\r
+ #\r
+ # Call each region's AddToBuffer function\r
+ #\r
+ if PreviousRegionSize > self.Size:\r
+ pass\r
+ GenFdsGlobalVariable.VerboseLogger('Call each region\'s AddToBuffer function')\r
+ RegionObj.AddToBuffer (TempFdBuffer, self.BaseAddress, self.BlockSizeList, self.ErasePolarity, GenFds.ImageBinDict, self.vtfRawDict, self.DefineVarDict)\r
+ \r
FdBuffer = StringIO.StringIO('')\r
PreviousRegionStart = -1\r
PreviousRegionSize = 1\r
PreviousRegionStart = RegionObj.Offset\r
PreviousRegionSize = RegionObj.Size\r
#\r
+ # Verify current region fits within allocated FD section Size\r
+ #\r
+ if PreviousRegionStart + PreviousRegionSize > self.Size:\r
+ EdkLogger.error("GenFds", GENFDS_ERROR,\r
+ 'FD %s size too small to fit region with offset 0x%X and size 0x%X'\r
+ % (self.FdUiName, PreviousRegionStart, PreviousRegionSize))\r
+ #\r
# Call each region's AddToBuffer function\r
#\r
- if PreviousRegionSize > self.Size:\r
- EdkLogger.error("GenFds", GENFDS_ERROR, 'FD %s size too small' % self.FdUiName)\r
GenFdsGlobalVariable.VerboseLogger('Call each region\'s AddToBuffer function')\r
RegionObj.AddToBuffer (FdBuffer, self.BaseAddress, self.BlockSizeList, self.ErasePolarity, GenFds.ImageBinDict, self.vtfRawDict, self.DefineVarDict)\r
#\r