From f4dfec6ca1ef4354307b8ca8005affe17fc64360 Mon Sep 17 00:00:00 2001 From: "Li, Yi1" Date: Mon, 18 Apr 2022 16:15:21 +0800 Subject: BaseTools: Move gPlatformFinalPcd to Datapipe and optimize size REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3828 This is a bugfix of bf9230a9f3dde065c3c8b4175ccd32e44e8f0362. 1.In the current code, gPlatformFinalPcd will save all PCDs used at whole compile process, which wastes runtime memory and is unnecessary. This patch makes gPlatformFinalPcd save only the PCDes which are assigned in the DSC file, and the PCD that has not been assigned will use the default value in DEC. 2.During the compilation process, gPlatformFinalPcd may be lost, and the current code cannot selectively assign PCD in DSC by specifying ARCH. This patch moves gPlatformFinalPcd into datapipe and modifies the assignment logicto fix this. Cc: Bob Feng Cc: Liming Gao Signed-off-by: yi1 li Reviewed-by: Bob Feng --- BaseTools/Source/Python/Workspace/InfBuildData.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'BaseTools/Source/Python/Workspace/InfBuildData.py') diff --git a/BaseTools/Source/Python/Workspace/InfBuildData.py b/BaseTools/Source/Python/Workspace/InfBuildData.py index cd23065b0c..5b9b3d7b4f 100644 --- a/BaseTools/Source/Python/Workspace/InfBuildData.py +++ b/BaseTools/Source/Python/Workspace/InfBuildData.py @@ -1054,17 +1054,20 @@ class InfBuildData(ModuleBuildClassObject): return True return False def CheckFeatureFlagPcd(self,Instance): - Pcds = {} - if GlobalData.gPlatformFinalPcds.get(self.Arch): - Pcds = GlobalData.gPlatformFinalPcds[self.Arch].copy() + Pcds = GlobalData.gPlatformFinalPcds.copy() if PcdPattern.search(Instance): PcdTuple = tuple(Instance.split('.')[::-1]) if PcdTuple in self.Pcds: - if not (self.Pcds[PcdTuple].Type == 'FeatureFlag' or self.Pcds[PcdTuple].Type == 'FixedAtBuild') and Instance not in Pcds: + if not (self.Pcds[PcdTuple].Type == 'FeatureFlag' or self.Pcds[PcdTuple].Type == 'FixedAtBuild'): EdkLogger.error('build', FORMAT_INVALID, - "\nit must be defined in a [PcdsFeatureFlag] or [PcdsFixedAtBuild] section of Dsc or Dec file or [FeaturePcd] or [FixedPcd] of Inf file", + "\nFeatureFlagPcd must be defined in a [PcdsFeatureFlag] or [PcdsFixedAtBuild] section of Dsc or Dec file", File=str(self), ExtraData=Instance) - Pcds[Instance] = self.Pcds[PcdTuple].DefaultValue + if not Instance in Pcds: + Pcds[Instance] = self.Pcds[PcdTuple].DefaultValue + else: #if PcdTuple not in self.Pcds: + EdkLogger.error('build', FORMAT_INVALID, + "\nFeatureFlagPcd must be defined in [FeaturePcd] or [FixedPcd] of Inf file", + File=str(self), ExtraData=Instance) if Instance in Pcds: if Pcds[Instance] == '0': return False -- cgit v1.2.3