From 09af9bd9be2d3e31bba979f8cf6446017b0b863e Mon Sep 17 00:00:00 2001 From: Bob Feng Date: Wed, 4 Nov 2020 11:01:39 +0800 Subject: BaseTools: Enable Module Scope Structure Pcd REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2648 This patch is to enable the Module scoped Structure Pcd usage. User can set structure pcd field value in module scope. For example, under the [components] section of a dsc file, user can override some field value for a specific module. Package/Module.inf{ gUefiTokenSpaceGuid.StructurePcdModule.FieldName | 5 } Signed-off-by: Bob Feng Cc: Liming Gao Cc: Yuwei Chen Tested-by: Liming Gao Acked-by: Liming Gao --- BaseTools/Source/Python/AutoGen/ModuleAutoGenHelper.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'BaseTools/Source/Python/AutoGen/ModuleAutoGenHelper.py') diff --git a/BaseTools/Source/Python/AutoGen/ModuleAutoGenHelper.py b/BaseTools/Source/Python/AutoGen/ModuleAutoGenHelper.py index 9dd93b9beb..8e60643d1f 100644 --- a/BaseTools/Source/Python/AutoGen/ModuleAutoGenHelper.py +++ b/BaseTools/Source/Python/AutoGen/ModuleAutoGenHelper.py @@ -479,8 +479,9 @@ class PlatformInfo(AutoGenInfo): SkuName : SkuInfoClass(SkuName, self.Platform.SkuIds[SkuName][0], '', '', '', '', '', ToPcd.DefaultValue) } - def ApplyPcdSetting(self, Module, Pcds, Library=""): + def ApplyPcdSetting(self, Ma, Pcds, Library=""): # for each PCD in module + Module=Ma.Module for Name, Guid in Pcds: PcdInModule = Pcds[Name, Guid] # find out the PCD setting in platform @@ -507,9 +508,12 @@ class PlatformInfo(AutoGenInfo): ) # override PCD settings with module specific setting + ModuleScopePcds = self.DataPipe.Get("MOL_PCDS") if Module in self.Platform.Modules: PlatformModule = self.Platform.Modules[str(Module)] - for Key in PlatformModule.Pcds: + PCD_DATA = ModuleScopePcds.get(Ma.Guid,{}) + mPcds = {(pcd.TokenCName,pcd.TokenSpaceGuidCName): pcd for pcd in PCD_DATA} + for Key in mPcds: if self.BuildOptionPcd: for pcd in self.BuildOptionPcd: (TokenSpaceGuidCName, TokenCName, FieldName, pcdvalue, _) = pcd @@ -528,7 +532,7 @@ class PlatformInfo(AutoGenInfo): Flag = True break if Flag: - self._OverridePcd(ToPcd, PlatformModule.Pcds[Key], Module, Msg="DSC Components Module scoped PCD section", Library=Library) + self._OverridePcd(ToPcd, mPcds[Key], Module, Msg="DSC Components Module scoped PCD section", Library=Library) # use PCD value to calculate the MaxDatumSize when it is not specified for Name, Guid in Pcds: Pcd = Pcds[Name, Guid] -- cgit v1.2.3