summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source/Python/AutoGen
diff options
context:
space:
mode:
authorBob Feng <bob.c.feng@intel.com>2020-11-04 11:01:39 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2020-11-05 04:27:28 +0000
commit09af9bd9be2d3e31bba979f8cf6446017b0b863e (patch)
treed7031d0a55ba1586f3cadffc42fc6a19db6c25e7 /BaseTools/Source/Python/AutoGen
parent978b9d511f5b9cb7bc5b09749f86c39bec51525d (diff)
downloadedk2-09af9bd9be2d3e31bba979f8cf6446017b0b863e.tar.gz
edk2-09af9bd9be2d3e31bba979f8cf6446017b0b863e.tar.bz2
edk2-09af9bd9be2d3e31bba979f8cf6446017b0b863e.zip
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{ <PcdsFixedAtBuild> gUefiTokenSpaceGuid.StructurePcdModule.FieldName | 5 } Signed-off-by: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Yuwei Chen <yuwei.chen@intel.com> Tested-by: Liming Gao <gaoliming@byosoft.com.cn> Acked-by: Liming Gao <gaoliming@byosoft.com.cn>
Diffstat (limited to 'BaseTools/Source/Python/AutoGen')
-rwxr-xr-xBaseTools/Source/Python/AutoGen/DataPipe.py5
-rwxr-xr-xBaseTools/Source/Python/AutoGen/ModuleAutoGen.py4
-rw-r--r--BaseTools/Source/Python/AutoGen/ModuleAutoGenHelper.py10
-rw-r--r--BaseTools/Source/Python/AutoGen/PlatformAutoGen.py8
4 files changed, 19 insertions, 8 deletions
diff --git a/BaseTools/Source/Python/AutoGen/DataPipe.py b/BaseTools/Source/Python/AutoGen/DataPipe.py
index 50403fbfb5..86ac2b928d 100755
--- a/BaseTools/Source/Python/AutoGen/DataPipe.py
+++ b/BaseTools/Source/Python/AutoGen/DataPipe.py
@@ -72,9 +72,10 @@ class MemoryDataPipe(DataPipe):
#Platform Module Pcds
ModulePcds = {}
for m in PlatformInfo.Platform.Modules:
- m_pcds = PlatformInfo.Platform.Modules[m].Pcds
+ module = PlatformInfo.Platform.Modules[m]
+ m_pcds = module.Pcds
if m_pcds:
- ModulePcds[(m.File,m.Root,m.Arch)] = [PCD_DATA(
+ ModulePcds[module.Guid] = [PCD_DATA(
pcd.TokenCName,pcd.TokenSpaceGuidCName,pcd.Type,
pcd.DatumType,pcd.SkuInfoList,pcd.DefaultValue,
pcd.MaxDatumSize,pcd.UserDefinedDefaultStoresFlag,pcd.validateranges,
diff --git a/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py b/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py
index eebf6e87f5..d70b0d7ae8 100755
--- a/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py
@@ -1032,7 +1032,7 @@ class ModuleAutoGen(AutoGen):
@cached_property
def ModulePcdList(self):
# apply PCD settings from platform
- RetVal = self.PlatformInfo.ApplyPcdSetting(self.Module, self.Module.Pcds)
+ RetVal = self.PlatformInfo.ApplyPcdSetting(self, self.Module.Pcds)
return RetVal
@cached_property
@@ -1063,7 +1063,7 @@ class ModuleAutoGen(AutoGen):
continue
Pcds.add(Key)
PcdsInLibrary[Key] = copy.copy(Library.Pcds[Key])
- RetVal.extend(self.PlatformInfo.ApplyPcdSetting(self.Module, PcdsInLibrary, Library=Library))
+ RetVal.extend(self.PlatformInfo.ApplyPcdSetting(self, PcdsInLibrary, Library=Library))
return RetVal
## Get the GUID value mapping
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]
diff --git a/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py b/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py
index 26ab8e7f36..c001828937 100644
--- a/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py
@@ -1043,7 +1043,13 @@ class PlatformAutoGen(AutoGen):
@cached_property
def _MbList(self):
- return [self.BuildDatabase[m, self.Arch, self.BuildTarget, self.ToolChain] for m in self.Platform.Modules]
+ ModuleList = []
+ for m in self.Platform.Modules:
+ component = self.Platform.Modules[m]
+ module = self.BuildDatabase[m, self.Arch, self.BuildTarget, self.ToolChain]
+ module.Guid = component.Guid
+ ModuleList.append(module)
+ return ModuleList
@cached_property
def _MaList(self):