if BuildData.Pcds[key].Pending:\r
if key in Platform.Pcds:\r
PcdInPlatform = Platform.Pcds[key]\r
- if PcdInPlatform.Type not in [None, '']:\r
+ if PcdInPlatform.Type:\r
BuildData.Pcds[key].Type = PcdInPlatform.Type\r
\r
if BuildData.MetaFile in Platform.Modules:\r
PlatformModule = Platform.Modules[str(BuildData.MetaFile)]\r
if key in PlatformModule.Pcds:\r
PcdInPlatform = PlatformModule.Pcds[key]\r
- if PcdInPlatform.Type not in [None, '']:\r
+ if PcdInPlatform.Type:\r
BuildData.Pcds[key].Type = PcdInPlatform.Type\r
\r
if TAB_PCDS_DYNAMIC_EX in BuildData.Pcds[key].Type:\r
if (BuildData.Pcds[key].TokenCName, BuildData.Pcds[key].TokenSpaceGuidCName) == SinglePcd:\r
for item in GlobalData.MixedPcd[SinglePcd]:\r
Pcd_Type = item[0].split('_')[-1]\r
- if (Pcd_Type == BuildData.Pcds[key].Type) or (Pcd_Type == TAB_PCDS_DYNAMIC_EX and BuildData.Pcds[key].Type in GenC.gDynamicExPcd) or \\r
- (Pcd_Type == TAB_PCDS_DYNAMIC and BuildData.Pcds[key].Type in GenC.gDynamicPcd):\r
+ if (Pcd_Type == BuildData.Pcds[key].Type) or (Pcd_Type == TAB_PCDS_DYNAMIC_EX and BuildData.Pcds[key].Type in PCD_DYNAMIC_EX_TYPE_SET) or \\r
+ (Pcd_Type == TAB_PCDS_DYNAMIC and BuildData.Pcds[key].Type in PCD_DYNAMIC_TYPE_SET):\r
Value = BuildData.Pcds[key]\r
Value.TokenCName = BuildData.Pcds[key].TokenCName + '_' + Pcd_Type\r
if len(key) == 2:\r
def _CheckPcdDefineAndType(self):\r
PcdTypeList = [\r
TAB_PCDS_FIXED_AT_BUILD, TAB_PCDS_PATCHABLE_IN_MODULE, TAB_PCDS_FEATURE_FLAG,\r
- TAB_PCDS_DYNAMIC, #"DynamicHii", "DynamicVpd",\r
- TAB_PCDS_DYNAMIC_EX, # "DynamicExHii", "DynamicExVpd"\r
+ TAB_PCDS_DYNAMIC, #TAB_PCDS_DYNAMIC_HII, TAB_PCDS_DYNAMIC_VPD,\r
+ TAB_PCDS_DYNAMIC_EX, # TAB_PCDS_DYNAMIC_EX_HII, TAB_PCDS_DYNAMIC_EX_VPD\r
]\r
\r
# This dict store PCDs which are not used by any modules with specified arches\r
## Return the directory to store FV files\r
def _GetFvDir(self):\r
if self._FvDir is None:\r
- self._FvDir = path.join(self.BuildDir, 'FV')\r
+ self._FvDir = path.join(self.BuildDir, TAB_FV_DIRECTORY)\r
return self._FvDir\r
\r
## Return the directory to store all intermediate and final files built\r
\r
def UpdateNVStoreMaxSize(self,OrgVpdFile):\r
if self.VariableInfo:\r
- VpdMapFilePath = os.path.join(self.BuildDir, "FV", "%s.map" % self.Platform.VpdToolGuid)\r
+ VpdMapFilePath = os.path.join(self.BuildDir, TAB_FV_DIRECTORY, "%s.map" % self.Platform.VpdToolGuid)\r
PcdNvStoreDfBuffer = [item for item in self._DynamicPcdList if item.TokenCName == "PcdNvStoreDefaultValueBuffer" and item.TokenSpaceGuidCName == "gEfiMdeModulePkgTokenSpaceGuid"]\r
\r
if PcdNvStoreDfBuffer:\r
if (self.Platform.Pcds[key].TokenCName, self.Platform.Pcds[key].TokenSpaceGuidCName) == SinglePcd:\r
for item in GlobalData.MixedPcd[SinglePcd]:\r
Pcd_Type = item[0].split('_')[-1]\r
- if (Pcd_Type == self.Platform.Pcds[key].Type) or (Pcd_Type == TAB_PCDS_DYNAMIC_EX and self.Platform.Pcds[key].Type in GenC.gDynamicExPcd) or \\r
- (Pcd_Type == TAB_PCDS_DYNAMIC and self.Platform.Pcds[key].Type in GenC.gDynamicPcd):\r
+ if (Pcd_Type == self.Platform.Pcds[key].Type) or (Pcd_Type == TAB_PCDS_DYNAMIC_EX and self.Platform.Pcds[key].Type in PCD_DYNAMIC_EX_TYPE_SET) or \\r
+ (Pcd_Type == TAB_PCDS_DYNAMIC and self.Platform.Pcds[key].Type in PCD_DYNAMIC_TYPE_SET):\r
Value = self.Platform.Pcds[key]\r
Value.TokenCName = self.Platform.Pcds[key].TokenCName + '_' + Pcd_Type\r
if len(key) == 2:\r
\r
for PcdFromModule in M.ModulePcdList + M.LibraryPcdList:\r
# make sure that the "VOID*" kind of datum has MaxDatumSize set\r
- if PcdFromModule.DatumType == TAB_VOID and PcdFromModule.MaxDatumSize in [None, '']:\r
+ if PcdFromModule.DatumType == TAB_VOID and not PcdFromModule.MaxDatumSize:\r
NoDatumTypePcdList.add("%s.%s [%s]" % (PcdFromModule.TokenSpaceGuidCName, PcdFromModule.TokenCName, F))\r
\r
# Check the PCD from Binary INF or Source INF\r
# Check the PCD from DSC or not \r
PcdFromModule.IsFromDsc = (PcdFromModule.TokenCName, PcdFromModule.TokenSpaceGuidCName) in self.Platform.Pcds\r
\r
- if PcdFromModule.Type in GenC.gDynamicPcd or PcdFromModule.Type in GenC.gDynamicExPcd:\r
+ if PcdFromModule.Type in PCD_DYNAMIC_TYPE_SET or PcdFromModule.Type in PCD_DYNAMIC_EX_TYPE_SET:\r
if F.Path not in FdfModuleList:\r
# If one of the Source built modules listed in the DSC is not listed \r
# in FDF modules, and the INF lists a PCD can only use the PcdsDynamic \r
# be included in a flash image in order to be functional. These Dynamic \r
# PCD will not be added into the Database unless it is used by other \r
# modules that are included in the FDF file.\r
- if PcdFromModule.Type in GenC.gDynamicPcd and \\r
+ if PcdFromModule.Type in PCD_DYNAMIC_TYPE_SET and \\r
PcdFromModule.IsFromBinaryInf == False:\r
# Print warning message to let the developer make a determine.\r
continue\r
# access method (it is only listed in the DEC file that declares the \r
# PCD as PcdsDynamicEx), then DO NOT break the build; DO NOT add the \r
# PCD to the Platform's PCD Database.\r
- if PcdFromModule.Type in GenC.gDynamicExPcd:\r
+ if PcdFromModule.Type in PCD_DYNAMIC_EX_TYPE_SET:\r
continue\r
#\r
# If a dynamic PCD used by a PEM module/PEI module & DXE module,\r
# used by DXE module, it should be stored in DXE PCD database.\r
# The default Phase is DXE\r
#\r
- if M.ModuleType in ["PEIM", "PEI_CORE"]:\r
+ if M.ModuleType in SUP_MODULE_SET_PEI:\r
PcdFromModule.Phase = "PEI"\r
if PcdFromModule not in self._DynaPcdList_:\r
self._DynaPcdList_.append(PcdFromModule)\r
PcdFromModule.IsFromBinaryInf = True\r
PcdFromModule.IsFromDsc = False\r
# Only allow the DynamicEx and Patchable PCD in AsBuild INF\r
- if PcdFromModule.Type not in GenC.gDynamicExPcd and PcdFromModule.Type not in TAB_PCDS_PATCHABLE_IN_MODULE:\r
+ if PcdFromModule.Type not in PCD_DYNAMIC_EX_TYPE_SET and PcdFromModule.Type not in TAB_PCDS_PATCHABLE_IN_MODULE:\r
EdkLogger.error("build", AUTOGEN_ERROR, "PCD setting error",\r
File=self.MetaFile,\r
ExtraData="\n\tExisted %s PCD %s in:\n\t\t%s\n"\r
% (PcdFromModule.Type, PcdFromModule.TokenCName, InfName))\r
# make sure that the "VOID*" kind of datum has MaxDatumSize set\r
- if PcdFromModule.DatumType == TAB_VOID and PcdFromModule.MaxDatumSize in [None, '']:\r
+ if PcdFromModule.DatumType == TAB_VOID and not PcdFromModule.MaxDatumSize:\r
NoDatumTypePcdList.add("%s.%s [%s]" % (PcdFromModule.TokenSpaceGuidCName, PcdFromModule.TokenCName, InfName))\r
- if M.ModuleType in ["PEIM", "PEI_CORE"]:\r
+ if M.ModuleType in SUP_MODULE_SET_PEI:\r
PcdFromModule.Phase = "PEI"\r
- if PcdFromModule not in self._DynaPcdList_ and PcdFromModule.Type in GenC.gDynamicExPcd:\r
+ if PcdFromModule not in self._DynaPcdList_ and PcdFromModule.Type in PCD_DYNAMIC_EX_TYPE_SET:\r
self._DynaPcdList_.append(PcdFromModule)\r
elif PcdFromModule not in self._NonDynaPcdList_ and PcdFromModule.Type in TAB_PCDS_PATCHABLE_IN_MODULE:\r
self._NonDynaPcdList_.append(PcdFromModule)\r
- if PcdFromModule in self._DynaPcdList_ and PcdFromModule.Phase == 'PEI' and PcdFromModule.Type in GenC.gDynamicExPcd:\r
+ if PcdFromModule in self._DynaPcdList_ and PcdFromModule.Phase == 'PEI' and PcdFromModule.Type in PCD_DYNAMIC_EX_TYPE_SET:\r
# Overwrite the phase of any the same PCD existing, if Phase is PEI.\r
# It is to solve the case that a dynamic PCD used by a PEM module/PEI \r
# module & DXE module at a same time.\r
\r
# Process VPD map file generated by third party BPDG tool\r
if NeedProcessVpdMapFile:\r
- VpdMapFilePath = os.path.join(self.BuildDir, "FV", "%s.map" % self.Platform.VpdToolGuid)\r
+ VpdMapFilePath = os.path.join(self.BuildDir, TAB_FV_DIRECTORY, "%s.map" % self.Platform.VpdToolGuid)\r
if os.path.exists(VpdMapFilePath):\r
VpdFile.Read(VpdMapFilePath)\r
\r
self.AllPcdList = self._NonDynamicPcdList + self._DynamicPcdList\r
\r
def FixVpdOffset(self,VpdFile ):\r
- FvPath = os.path.join(self.BuildDir, "FV")\r
+ FvPath = os.path.join(self.BuildDir, TAB_FV_DIRECTORY)\r
if not os.path.exists(FvPath):\r
try:\r
os.makedirs(FvPath)\r
# retrieve BPDG tool's path from tool_def.txt according to VPD_TOOL_GUID defined in DSC file.\r
BPDGToolName = None\r
for ToolDef in self.ToolDefinition.values():\r
- if ToolDef.has_key("GUID") and ToolDef["GUID"] == self.Platform.VpdToolGuid:\r
+ if ToolDef.has_key(TAB_GUID) and ToolDef[TAB_GUID] == self.Platform.VpdToolGuid:\r
if not ToolDef.has_key("PATH"):\r
EdkLogger.error("build", ATTRIBUTE_NOT_AVAILABLE, "PATH attribute was not provided for BPDG guid tool %s in tools_def.txt" % self.Platform.VpdToolGuid)\r
BPDGToolName = ToolDef["PATH"]\r
BuildRuleFile = None\r
if TAB_TAT_DEFINES_BUILD_RULE_CONF in self.Workspace.TargetTxt.TargetTxtDictionary:\r
BuildRuleFile = self.Workspace.TargetTxt.TargetTxtDictionary[TAB_TAT_DEFINES_BUILD_RULE_CONF]\r
- if BuildRuleFile in [None, '']:\r
+ if not BuildRuleFile:\r
BuildRuleFile = gDefaultBuildRuleFile\r
self._BuildRule = BuildRule(BuildRuleFile)\r
if self._BuildRule._FileVersion == "":\r
#\r
for Pcd in self.DynamicPcdList:\r
if Pcd.Phase == "PEI":\r
- if Pcd.Type in [TAB_PCDS_DYNAMIC, "DynamicDefault", "DynamicVpd", "DynamicHii"]:\r
+ if Pcd.Type in PCD_DYNAMIC_TYPE_SET:\r
EdkLogger.debug(EdkLogger.DEBUG_5, "%s %s (%s) -> %d" % (Pcd.TokenCName, Pcd.TokenSpaceGuidCName, Pcd.Phase, TokenNumber))\r
self._PcdTokenNumber[Pcd.TokenCName, Pcd.TokenSpaceGuidCName] = TokenNumber\r
TokenNumber += 1\r
\r
for Pcd in self.DynamicPcdList:\r
if Pcd.Phase == "PEI":\r
- if Pcd.Type in [TAB_PCDS_DYNAMIC_EX, "DynamicExDefault", "DynamicExVpd", "DynamicExHii"]:\r
+ if Pcd.Type in PCD_DYNAMIC_EX_TYPE_SET:\r
EdkLogger.debug(EdkLogger.DEBUG_5, "%s %s (%s) -> %d" % (Pcd.TokenCName, Pcd.TokenSpaceGuidCName, Pcd.Phase, TokenNumber))\r
self._PcdTokenNumber[Pcd.TokenCName, Pcd.TokenSpaceGuidCName] = TokenNumber\r
TokenNumber += 1\r
\r
for Pcd in self.DynamicPcdList:\r
if Pcd.Phase == "DXE":\r
- if Pcd.Type in [TAB_PCDS_DYNAMIC, "DynamicDefault", "DynamicVpd", "DynamicHii"]:\r
+ if Pcd.Type in PCD_DYNAMIC_TYPE_SET:\r
EdkLogger.debug(EdkLogger.DEBUG_5, "%s %s (%s) -> %d" % (Pcd.TokenCName, Pcd.TokenSpaceGuidCName, Pcd.Phase, TokenNumber))\r
self._PcdTokenNumber[Pcd.TokenCName, Pcd.TokenSpaceGuidCName] = TokenNumber\r
TokenNumber += 1\r
\r
for Pcd in self.DynamicPcdList:\r
if Pcd.Phase == "DXE":\r
- if Pcd.Type in [TAB_PCDS_DYNAMIC_EX, "DynamicExDefault", "DynamicExVpd", "DynamicExHii"]:\r
+ if Pcd.Type in PCD_DYNAMIC_EX_TYPE_SET:\r
EdkLogger.debug(EdkLogger.DEBUG_5, "%s %s (%s) -> %d" % (Pcd.TokenCName, Pcd.TokenSpaceGuidCName, Pcd.Phase, TokenNumber))\r
self._PcdTokenNumber[Pcd.TokenCName, Pcd.TokenSpaceGuidCName] = TokenNumber\r
TokenNumber += 1\r
LibraryModule.LibraryClass.append(LibraryClassObject(LibraryClassName, [ModuleType]))\r
elif LibraryModule.LibraryClass is None \\r
or len(LibraryModule.LibraryClass) == 0 \\r
- or (ModuleType != 'USER_DEFINED'\r
+ or (ModuleType != SUP_MODULE_USER_DEFINED\r
and ModuleType not in LibraryModule.LibraryClass[0].SupModList):\r
# only USER_DEFINED can link against any library instance despite of its SupModList\r
EdkLogger.error("build", OPTION_MISSING,\r
TokenCName = PcdItem[0]\r
break\r
if FromPcd is not None:\r
- if ToPcd.Pending and FromPcd.Type not in [None, '']:\r
+ if ToPcd.Pending and FromPcd.Type:\r
ToPcd.Type = FromPcd.Type\r
- elif (ToPcd.Type not in [None, '']) and (FromPcd.Type not in [None, ''])\\r
+ elif (ToPcd.Type) and (FromPcd.Type)\\r
and (ToPcd.Type != FromPcd.Type) and (ToPcd.Type in FromPcd.Type):\r
if ToPcd.Type.strip() == TAB_PCDS_DYNAMIC_EX:\r
ToPcd.Type = FromPcd.Type\r
- elif ToPcd.Type not in [None, ''] and FromPcd.Type not in [None, ''] \\r
+ elif ToPcd.Type and FromPcd.Type \\r
and ToPcd.Type != FromPcd.Type:\r
EdkLogger.error("build", OPTION_CONFLICT, "Mismatched PCD type",\r
ExtraData="%s.%s is defined as [%s] in module %s, but as [%s] in platform."\\r
ToPcd.validlists = FromPcd.validlists\r
ToPcd.expressions = FromPcd.expressions\r
\r
- if FromPcd is not None and ToPcd.DatumType == TAB_VOID and ToPcd.MaxDatumSize in ['', None]:\r
+ if FromPcd is not None and ToPcd.DatumType == TAB_VOID and not ToPcd.MaxDatumSize:\r
EdkLogger.debug(EdkLogger.DEBUG_9, "No MaxDatumSize specified for PCD %s.%s" \\r
% (ToPcd.TokenSpaceGuidCName, TokenCName))\r
Value = ToPcd.DefaultValue\r
- if Value in [None, '']:\r
+ if not Value:\r
ToPcd.MaxDatumSize = '1'\r
elif Value[0] == 'L':\r
ToPcd.MaxDatumSize = str((len(Value) - 2) * 2)\r
ToPcd.MaxDatumSize = str(len(Value) - 1)\r
\r
# apply default SKU for dynamic PCDS if specified one is not available\r
- if (ToPcd.Type in PCD_DYNAMIC_TYPE_LIST or ToPcd.Type in PCD_DYNAMIC_EX_TYPE_LIST) \\r
- and ToPcd.SkuInfoList in [None, {}, '']:\r
+ if (ToPcd.Type in PCD_DYNAMIC_TYPE_SET or ToPcd.Type in PCD_DYNAMIC_EX_TYPE_SET) \\r
+ and not ToPcd.SkuInfoList:\r
if self.Platform.SkuName in self.Platform.SkuIds:\r
SkuName = self.Platform.SkuName\r
else:\r
# use PCD value to calculate the MaxDatumSize when it is not specified\r
for Name, Guid in Pcds:\r
Pcd = Pcds[Name, Guid]\r
- if Pcd.DatumType == TAB_VOID and Pcd.MaxDatumSize in ['', None]:\r
+ if Pcd.DatumType == TAB_VOID and not Pcd.MaxDatumSize:\r
Pcd.MaxSizeUserSet = None\r
Value = Pcd.DefaultValue\r
- if Value in [None, '']:\r
+ if not Value:\r
Pcd.MaxDatumSize = '1'\r
elif Value[0] == 'L':\r
Pcd.MaxDatumSize = str((len(Value) - 2) * 2)\r
def _GetFfsOutputDir(self):\r
if self._FfsOutputDir is None:\r
if GlobalData.gFdfParser is not None:\r
- self._FfsOutputDir = path.join(self.PlatformInfo.BuildDir, "FV", "Ffs", self.Guid + self.Name)\r
+ self._FfsOutputDir = path.join(self.PlatformInfo.BuildDir, TAB_FV_DIRECTORY, "Ffs", self.Guid + self.Name)\r
else:\r
self._FfsOutputDir = ''\r
return self._FfsOutputDir\r
if Pcd.Type == TAB_PCDS_PATCHABLE_IN_MODULE:\r
PatchablePcds += [Pcd]\r
PcdCheckList.append((Pcd.TokenCName, Pcd.TokenSpaceGuidCName, TAB_PCDS_PATCHABLE_IN_MODULE))\r
- elif Pcd.Type in GenC.gDynamicExPcd:\r
+ elif Pcd.Type in PCD_DYNAMIC_EX_TYPE_SET:\r
if Pcd not in Pcds:\r
Pcds += [Pcd]\r
PcdCheckList.append((Pcd.TokenCName, Pcd.TokenSpaceGuidCName, TAB_PCDS_DYNAMIC_EX))\r
break\r
\r
ModuleType = self.ModuleType\r
- if ModuleType == 'UEFI_DRIVER' and self.DepexGenerated:\r
- ModuleType = 'DXE_DRIVER'\r
+ if ModuleType == SUP_MODULE_UEFI_DRIVER and self.DepexGenerated:\r
+ ModuleType = SUP_MODULE_DXE_DRIVER\r
\r
DriverType = ''\r
if self.PcdIsDriver != '':\r
AsBuiltInfDict['binary_item'] += ['BIN|' + File]\r
if self.DepexGenerated:\r
self.OutputFile.add(self.Name + '.depex')\r
- if self.ModuleType in ['PEIM']:\r
+ if self.ModuleType in [SUP_MODULE_PEIM]:\r
AsBuiltInfDict['binary_item'] += ['PEI_DEPEX|' + self.Name + '.depex']\r
- if self.ModuleType in ['DXE_DRIVER', 'DXE_RUNTIME_DRIVER', 'DXE_SAL_DRIVER', 'UEFI_DRIVER']:\r
+ if self.ModuleType in [SUP_MODULE_DXE_DRIVER, SUP_MODULE_DXE_RUNTIME_DRIVER, SUP_MODULE_DXE_SAL_DRIVER, SUP_MODULE_UEFI_DRIVER]:\r
AsBuiltInfDict['binary_item'] += ['DXE_DEPEX|' + self.Name + '.depex']\r
- if self.ModuleType in ['DXE_SMM_DRIVER']:\r
+ if self.ModuleType in [SUP_MODULE_DXE_SMM_DRIVER]:\r
AsBuiltInfDict['binary_item'] += ['SMM_DEPEX|' + self.Name + '.depex']\r
\r
Bin = self._GenOffsetBin()\r
return\r
\r
for ModuleType in self.DepexList:\r
- # Ignore empty [depex] section or [depex] section for "USER_DEFINED" module\r
- if len(self.DepexList[ModuleType]) == 0 or ModuleType == "USER_DEFINED":\r
+ # Ignore empty [depex] section or [depex] section for SUP_MODULE_USER_DEFINED module\r
+ if len(self.DepexList[ModuleType]) == 0 or ModuleType == SUP_MODULE_USER_DEFINED:\r
continue\r
\r
Dpx = GenDepex.DependencyExpression(self.DepexList[ModuleType], ModuleType, True)\r