from DepexSection import DepexSection\r
from Common.Misc import SaveFileOnChange\r
from Common.Expression import *\r
+from Common.DataType import *\r
\r
## generate FFS from INF\r
#\r
#\r
class FfsInfStatement(FfsInfStatementClassObject):\r
- ## The mapping dictionary from datum type to its maximum number.\r
- _MAX_SIZE_TYPE = {"BOOLEAN":0x01, "UINT8":0xFF, "UINT16":0xFFFF, "UINT32":0xFFFFFFFF, "UINT64":0xFFFFFFFFFFFFFFFF}\r
## The constructor\r
#\r
# @param self The object pointer\r
self.ShadowFromInfFile = Inf.Shadow\r
\r
else:\r
- Inf = GenFdsGlobalVariable.WorkSpace.BuildObject[PathClassObj, 'COMMON', GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]\r
+ Inf = GenFdsGlobalVariable.WorkSpace.BuildObject[PathClassObj, TAB_COMMON, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]\r
self.BaseName = Inf.BaseName\r
self.ModuleGuid = Inf.Guid\r
self.ModuleType = Inf.ModuleType\r
EdkLogger.error("GenFds", GENFDS_ERROR, 'PCD [%s.%s] Value "%s"' %(Pcd.TokenSpaceGuidCName, Pcd.TokenCName, Pcd.DefaultValue),File=self.InfFileName)\r
\r
# Check value, if value are equal, no need to patch\r
- if Pcd.DatumType == "VOID*":\r
+ if Pcd.DatumType == TAB_VOID:\r
if Pcd.InfDefaultValue == DefaultValue or DefaultValue in [None, '']:\r
continue\r
# Get the string size from FDF or DSC\r
except:\r
continue\r
# Check the Pcd size and data type\r
- if Pcd.DatumType == "VOID*":\r
+ if Pcd.DatumType == TAB_VOID:\r
if int(MaxDatumSize) > int(Pcd.MaxDatumSize):\r
EdkLogger.error("GenFds", GENFDS_ERROR, "The size of VOID* type PCD '%s.%s' exceeds its maximum size %d bytes." \\r
% (Pcd.TokenSpaceGuidCName, Pcd.TokenCName, int(MaxDatumSize) - int(Pcd.MaxDatumSize)))\r
else:\r
- if PcdValueInDscOrFdf > FfsInfStatement._MAX_SIZE_TYPE[Pcd.DatumType] \\r
- or PcdValueInImg > FfsInfStatement._MAX_SIZE_TYPE[Pcd.DatumType]:\r
+ if PcdValueInDscOrFdf > MAX_VAL_TYPE[Pcd.DatumType] \\r
+ or PcdValueInImg > MAX_VAL_TYPE[Pcd.DatumType]:\r
EdkLogger.error("GenFds", GENFDS_ERROR, "The size of %s type PCD '%s.%s' doesn't match its data type." \\r
% (Pcd.DatumType, Pcd.TokenSpaceGuidCName, Pcd.TokenCName))\r
self.PatchPcds.append((Pcd, DefaultValue))\r
\r
RuleName = 'RULE' + \\r
'.' + \\r
- 'COMMON' + \\r
+ TAB_COMMON + \\r
'.' + \\r
self.ModuleType.upper()\r
\r
# the file name FILE_GUIDmodule.inf, then PlatformDataBase.Modules use FILE_GUIDmodule.inf as key,\r
# but the path (self.MetaFile.Path) is the real path\r
#\r
- for key in PlatformDataBase.Modules.keys():\r
+ for key in PlatformDataBase.Modules:\r
if InfFileKey == str((PlatformDataBase.Modules[key]).MetaFile.Path):\r
DscArchList.append (Arch)\r
break\r
)\r
return FfsOutput\r
\r
- ## __GetGenFfsCmdParameter__() method\r
- #\r
- # Create parameter string for GenFfs\r
- #\r
- # @param Rule The rule object used to generate section\r
- # @retval tuple (FileType, Fixed, CheckSum, Alignment)\r
- #\r
- @staticmethod\r
- def __GetGenFfsCmdParameter__(Rule):\r
- result = tuple()\r
- result += ('-t', Ffs.Ffs.FdfFvFileTypeToFileType[Rule.FvFileType])\r
- if Rule.Fixed != False:\r
- result += ('-x',)\r
- if Rule.CheckSum != False:\r
- result += ('-s',)\r
-\r
- if Rule.Alignment is not None and Rule.Alignment != '':\r
- result += ('-a', Rule.Alignment)\r
-\r
- return result\r
- \r
## __GetBuildOutputMapFileVfrUniInfo() method\r
#\r
# Find the offset of UNI/INF object offset in the EFI image file.\r