From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.byosoft.com.cn (mail.byosoft.com.cn [58.240.74.242]) by mx.groups.io with SMTP id smtpd.web12.8285.1604028371665675287 for ; Thu, 29 Oct 2020 20:26:13 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=none, err=permanent DNS error (domain: byosoft.com.cn, ip: 58.240.74.242, mailfrom: gaoliming@byosoft.com.cn) Received: from DESKTOPS6D0PVI ([58.246.60.130]) (envelope-sender ) by 192.168.6.13 with ESMTP for ; Fri, 30 Oct 2020 11:26:01 +0800 X-WM-Sender: gaoliming@byosoft.com.cn X-WM-AuthFlag: YES X-WM-AuthUser: gaoliming@byosoft.com.cn From: "gaoliming" To: , Cc: "'Chen, Christine'" , "'Kinney, Michael D'" References: <163E2552F529AEC6.4805@groups.io> <002801d6ac29$26c30540$74490fc0$@byosoft.com.cn> In-Reply-To: Subject: =?UTF-8?B?5Zue5aSNOiBbZWRrMi1kZXZlbF0gW1BhdGNoIFYyXSBCYXNlVG9vbHM6IEVuYWJsZSBNb2R1bGUgU2NvcGUgU3RydWN0dXJlIFBjZA==?= Date: Fri, 30 Oct 2020 11:26:08 +0800 Message-ID: <008b01d6ae6c$68b79110$3a26b330$@byosoft.com.cn> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQHMBonhSJuUOyA/UE/y207gdfnMUgH6JVSvAsFVo1EBfb0o6KmTAFMg Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Language: zh-cn Bob: I review the generated PcdValueInit.c file and Report.txt. I find two is= sues.=20 PcdValueInit.c: Assign_gEfiCryptoPkgTokenSpaceGuid_PcdCryptoServiceFamilyEnable_Default_= Value(Pcd); // SkuName: DEFAULT, DefaultStoreName: STANDARD=20 Assign_gEfiCryptoPkgTokenSpaceGuid_PcdCryptoServiceFamilyEnable_DEFAULT_= STANDARD_Value(Pcd); Assign_gEfiCryptoPkgTokenSpaceGuid_PcdCryptoServiceFamilyEnable_Fdf_Valu= e(Pcd); Assign_gEfiCryptoPkgTokenSpaceGuid_PcdCryptoServiceFamilyEnable_CommandL= ine_Value(Pcd); Assign_gEfiCryptoPkgTokenSpaceGuid_PcdCryptoServiceFamilyEnable_A3542CE8= S77F7S49DCSA834S45D37D2EC1FA_Value(Pcd); Module level PCD values will have higher priority than the global level = PCD setting.=20 But, FDF and Command Line level PCD have higher priority than module lev= el PCD.=20 So, the module level PCD value assignment should be before Assign_gEfiCr= yptoPkgTokenSpaceGuid_PcdCryptoServiceFamilyEnable_Fdf_Value(Pcd); Report.txt: Pcd value in Module section is always zero. It doesn't match its real va= lue. And, module level PCD setting should be displayed in report.=20 gEfiCryptoPkgTokenSpaceGuid PcdCryptoServiceFamilyEnable : FIXED (PCD_CRYPTO_SERVICE_FAMI= LY_ENABLE) =3D { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00= ,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00= ,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00= ,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00= ,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00= ,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00} Thanks Liming > -----=E9=82=AE=E4=BB=B6=E5=8E=9F=E4=BB=B6----- > =E5=8F=91=E4=BB=B6=E4=BA=BA: bounce+27952+66694+4905953+8761045@groups.i= o > =E4=BB=A3=E8=A1=A8 Bob Fe= ng > =E5=8F=91=E9=80=81=E6=97=B6=E9=97=B4: 2020=E5=B9=B410=E6=9C=8828=E6=97= =A5 23:08 > =E6=94=B6=E4=BB=B6=E4=BA=BA: devel@edk2.groups.io; gaoliming@byosoft.com= .cn > =E6=8A=84=E9=80=81: Chen, Christine ; Kinney, Mich= ael D > > =E4=B8=BB=E9=A2=98: Re: [edk2-devel] [Patch V2] BaseTools: Enable Module= Scope Structure > Pcd >=20 > Liming, >=20 > You can verify this patch with Mike's case. >=20 > Clone Mike's edk2 repo, and checkout the branch > Bug_xxx_CryptoPkg_UseModuleScopedPcds > https://github.com/mdkinney/edk2/tree/Bug_xxx_CryptoPkg_UseModuleSco > pedPcds >=20 > Then build the CryptoPkg. >=20 > build -p CryptoPkg\CryptoPkg.dsc -a IA32 -y report.txt >=20 > Thanks, > Bob >=20 > -----Original Message----- > From: devel@edk2.groups.io On Behalf Of gaoliming > Sent: Tuesday, October 27, 2020 2:20 PM > To: Feng, Bob C ; devel@edk2.groups.io > Cc: Chen, Christine ; Kinney, Michael D > > Subject: =E5=9B=9E=E5=A4=8D: [edk2-devel] [Patch V2] BaseTools: Enable M= odule Scope > Structure Pcd >=20 > Bob: > I will review this change this week. Can you share your test case? I al= so > want to check the build output. >=20 > Thanks > Liming > > -----=E9=82=AE=E4=BB=B6=E5=8E=9F=E4=BB=B6----- > > =E5=8F=91=E4=BB=B6=E4=BA=BA: Feng, Bob C > > =E5=8F=91=E9=80=81=E6=97=B6=E9=97=B4: 2020=E5=B9=B410=E6=9C=8826=E6=97= = =A5 12:00 > > =E6=94=B6=E4=BB=B6=E4=BA=BA: devel@edk2.groups.io; Feng, Bob C ; > Liming > > Gao > > =E6=8A=84=E9=80=81: Chen, Christine ; Kinney, Mi= chael D > > > > =E4=B8=BB=E9=A2=98: RE: [edk2-devel] [Patch V2] BaseTools: Enable Modu= le Scope > Structure > > Pcd > > > > Liming, would you review this patch? > > > > Thanks, > > Bob > > > > -----Original Message----- > > From: devel@edk2.groups.io On Behalf Of Bob > Feng > > Sent: Thursday, October 15, 2020 6:59 PM > > To: devel@edk2.groups.io > > Cc: Liming Gao ; Chen, Christine > > > > Subject: [edk2-devel] [Patch V2] BaseTools: Enable Module Scope Struct= ure > > Pcd > > > > 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 > > --- > > V2: Fixed the incorrect format in build report. > > BaseTools/Source/Python/AutoGen/DataPipe.py | 5 +- > > .../Source/Python/AutoGen/ModuleAutoGen.py | 4 +- > > .../Python/AutoGen/ModuleAutoGenHelper.py | 10 +- > > .../Source/Python/AutoGen/PlatformAutoGen.py | 8 +- > > .../Python/Workspace/BuildClassObject.py | 12 + > > .../Source/Python/Workspace/DscBuildData.py | 243 > > ++++++++++++++++-- > > BaseTools/Source/Python/build/BuildReport.py | 109 ++++---- > > 7 files changed, 319 insertions(+), 72 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 > > @@ -70,13 +70,14 @@ class MemoryDataPipe(DataPipe): > > } > > > > #Platform Module Pcds > > ModulePcds =3D {} > > for m in PlatformInfo.Platform.Modules: > > - m_pcds =3D PlatformInfo.Platform.Modules[m].Pcds > > + module =3D PlatformInfo.Platform.Modules[m] > > + m_pcds =3D module.Pcds > > if m_pcds: > > - ModulePcds[(m.File,m.Root,m.Arch)] =3D [PCD_DATA( > > + ModulePcds[module.Guid] =3D [PCD_DATA( > > pcd.TokenCName,pcd.TokenSpaceGuidCName,pcd.Type, > > pcd.DatumType,pcd.SkuInfoList,pcd.DefaultValue, > > > > pcd.MaxDatumSize,pcd.UserDefinedDefaultStoresFlag,pcd.validateranges, > > > > pcd.validlists,pcd.expressions,pcd.CustomAttribute,pcd.TokenValue) > > for pcd in PlatformInfo.Platform.Modules[m].Pcds.values()= ] > > 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 > > @@ -1030,11 +1030,11 @@ class ModuleAutoGen(AutoGen): > > # @retval list The list of PCD > > # > > @cached_property > > def ModulePcdList(self): > > # apply PCD settings from platform > > - RetVal =3D self.PlatformInfo.ApplyPcdSetting(self.Module, > > self.Module.Pcds) > > + RetVal =3D self.PlatformInfo.ApplyPcdSetting(self, > self.Module.Pcds) > > > > return RetVal > > @cached_property > > def _PcdComments(self): > > ReVal =3D OrderedListDict() > > @@ -1061,11 +1061,11 @@ class ModuleAutoGen(AutoGen): > > # skip duplicated PCDs > > if Key in self.Module.Pcds or Key in Pcds: > > continue > > Pcds.add(Key) > > PcdsInLibrary[Key] =3D copy.copy(Library.Pcds[Key]) > > - > RetVal.extend(self.PlatformInfo.ApplyPcdSetting(self.Module, > > PcdsInLibrary, Library=3DLibrary)) > > + RetVal.extend(self.PlatformInfo.ApplyPcdSetting(self, > > PcdsInLibrary, Library=3DLibrary)) > > return RetVal > > > > ## Get the GUID value mapping > > # > > # @retval dict The mapping between GUID cname and > its > > value > > 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 > > @@ -477,12 +477,13 @@ class PlatformInfo(AutoGenInfo): > > SkuName =3D TAB_DEFAULT > > ToPcd.SkuInfoList =3D { > > SkuName : SkuInfoClass(SkuName, > > self.Platform.SkuIds[SkuName][0], '', '', '', '', '', ToPcd.DefaultVal= ue) > > } > > > > - def ApplyPcdSetting(self, Module, Pcds, Library=3D""): > > + def ApplyPcdSetting(self, Ma, Pcds, Library=3D""): > > # for each PCD in module > > + Module=3DMa.Module > > for Name, Guid in Pcds: > > PcdInModule =3D Pcds[Name, Guid] > > # find out the PCD setting in platform > > if (Name, Guid) in self.Pcds: > > PcdInPlatform =3D self.Pcds[Name, Guid] > > @@ -505,13 +506,16 @@ class PlatformInfo(AutoGenInfo): > > % > > (Guid, Name, str(Module)), > > File=3Dself.MetaFile > > ) > > > > # override PCD settings with module specific setting > > + ModuleScopePcds =3D self.DataPipe.Get("MOL_PCDS") > > if Module in self.Platform.Modules: > > PlatformModule =3D self.Platform.Modules[str(Module)] > > - for Key in PlatformModule.Pcds: > > + PCD_DATA =3D ModuleScopePcds.get(Ma.Guid,{}) > > + mPcds =3D {(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, _) =3D pcd > > if (TokenCName, TokenSpaceGuidCName) > =3D=3D > > Key and FieldName =3D=3D"": > > > PlatformModule.Pcds[Key].DefaultValue > > =3D pcdvalue > > @@ -526,11 +530,11 @@ class PlatformInfo(AutoGenInfo): > > if PcdItem in Pcds: > > ToPcd =3D Pcds[PcdItem] > > Flag =3D True > > break > > if Flag: > > - self._OverridePcd(ToPcd, > PlatformModule.Pcds[Key], > > Module, Msg=3D"DSC Components Module scoped PCD section", > > Library=3DLibrary) > > + self._OverridePcd(ToPcd, mPcds[Key], Module, > > Msg=3D"DSC Components Module scoped PCD section", Library=3DLibrary) > > # use PCD value to calculate the MaxDatumSize when it is not > > specified > > for Name, Guid in Pcds: > > Pcd =3D Pcds[Name, Guid] > > if Pcd.DatumType =3D=3D TAB_VOID and not > Pcd.MaxDatumSize: > > Pcd.MaxSizeUserSet =3D None > > diff --git a/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py > > b/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py > > index 26ab8e7f36..c7a4cb9a08 100644 > > --- a/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py > > +++ b/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py > > @@ -1041,11 +1041,17 @@ class PlatformAutoGen(AutoGen): > > TokenNumber +=3D 1 > > return RetVal > > > > @cached_property > > def _MbList(self): > > - return [self.BuildDatabase[m, self.Arch, self.BuildTarget, > > self.ToolChain] for m in self.Platform.Modules] > > + mlist =3D [] > > + for m in self.Platform.Modules: > > + component =3D self.Platform.Modules[m] > > + module =3D self.BuildDatabase[m, self.Arch, self.BuildTar= get, > > self.ToolChain] > > + module.Guid =3D component.Guid > > + mlist.append(module) > > + return mlist > > > > @cached_property > > def _MaList(self): > > for ModuleFile in self.Platform.Modules: > > Ma =3D ModuleAutoGen( > > diff --git a/BaseTools/Source/Python/Workspace/BuildClassObject.py > > b/BaseTools/Source/Python/Workspace/BuildClassObject.py > > index db40e3b10c..ebb65fc2fe 100644 > > --- a/BaseTools/Source/Python/Workspace/BuildClassObject.py > > +++ b/BaseTools/Source/Python/Workspace/BuildClassObject.py > > @@ -68,10 +68,11 @@ class PcdClassObject(object): > > self.DscRawValueInfo =3D {} > > if IsDsc: > > self.DscDefaultValue =3D Value > > self.PcdValueFromComm =3D "" > > self.PcdValueFromFdf =3D "" > > + self.PcdValueFromComponents =3D {} #{ModuleGuid:value, > > file_path,lineNo} > > self.CustomAttribute =3D {} > > self.UserDefinedDefaultStoresFlag =3D > UserDefinedDefaultStoresFlag > > self._Capacity =3D None > > > > @property > > @@ -296,10 +297,11 @@ class StructurePcd(PcdClassObject): > > self.DefaultValueFromDecInfo =3D None > > self.ValueChain =3D set() > > self.PcdFieldValueFromComm =3D OrderedDict() > > self.PcdFieldValueFromFdf =3D OrderedDict() > > self.DefaultFromDSC=3DNone > > + self.PcdFiledValueFromDscComponent =3D OrderedDict() > > def __repr__(self): > > return self.TypeName > > > > def AddDefaultValue (self, FieldName, Value, FileName=3D"", > > LineNo=3D0,DimensionAttr =3D"-1"): > > if DimensionAttr not in self.DefaultValues: > > @@ -322,10 +324,16 @@ class StructurePcd(PcdClassObject): > > if FieldName in > > self.SkuOverrideValues[SkuName][DefaultStoreName][DimensionAttr]: > > del > > > self.SkuOverrideValues[SkuName][DefaultStoreName][DimensionAttr][FieldN > > ame] > > > > > self.SkuOverrideValues[SkuName][DefaultStoreName][DimensionAttr][FieldN > > ame] =3D [Value.strip(), FileName, LineNo] > > return > > > self.SkuOverrideValues[SkuName][DefaultStoreName][DimensionAttr][FieldN > > ame] > > > > + def AddComponentOverrideValue(self,FieldName, Value, ModuleGuid, > > FileName=3D"", LineNo=3D0, DimensionAttr =3D '-1'): > > + self.PcdFiledValueFromDscComponent.setdefault(ModuleGuid, > > OrderedDict()) > > + > > > self.PcdFiledValueFromDscComponent[ModuleGuid].setdefault(DimensionAtt > > r,OrderedDict()) > > + > > > self.PcdFiledValueFromDscComponent[ModuleGuid][DimensionAttr][FieldNa > > me] =3D [Value.strip(), FileName, LineNo] > > + return > > > self.PcdFiledValueFromDscComponent[ModuleGuid][DimensionAttr][FieldNa > > me] > > + > > def SetPcdMode (self, PcdMode): > > self.PcdMode =3D PcdMode > > > > def copy(self, PcdObject): > > self.TokenCName =3D PcdObject.TokenCName if > > PcdObject.TokenCName else self.TokenCName > > @@ -363,10 +371,11 @@ class StructurePcd(PcdClassObject): > > self.PcdDefineLineNo =3D PcdObject.PcdDefineLineNo if > > PcdObject.PcdDefineLineNo else self.PcdDefineLineNo > > self.PkgPath =3D PcdObject.PkgPath if PcdObject.PkgPath e= lse > > self.PkgPath > > self.ValueChain =3D PcdObject.ValueChain if > > PcdObject.ValueChain else self.ValueChain > > self.PcdFieldValueFromComm =3D > > PcdObject.PcdFieldValueFromComm if PcdObject.PcdFieldValueFromComm > > else self.PcdFieldValueFromComm > > self.PcdFieldValueFromFdf =3D > PcdObject.PcdFieldValueFromFdf > > if PcdObject.PcdFieldValueFromFdf else self.PcdFieldValueFromFdf > > + self.PcdFiledValueFromDscComponent =3D > > PcdObject.PcdFiledValueFromDscComponent if > > PcdObject.PcdFiledValueFromDscComponent else > > self.PcdFiledValueFromDscComponent > > > > def __deepcopy__(self,memo): > > new_pcd =3D StructurePcd() > > self.sharedcopy(new_pcd) > > > > @@ -381,10 +390,11 @@ class StructurePcd(PcdClassObject): > > new_pcd.DefaultValues =3D CopyDict(self.DefaultValues) > > new_pcd.DefaultFromDSC=3DCopyDict(self.DefaultFromDSC) > > new_pcd.SkuOverrideValues =3D CopyDict(self.SkuOverrideValues= ) > > new_pcd.PcdFieldValueFromComm =3D > > CopyDict(self.PcdFieldValueFromComm) > > new_pcd.PcdFieldValueFromFdf =3D > > CopyDict(self.PcdFieldValueFromFdf) > > + new_pcd.PcdFiledValueFromDscComponent =3D > > CopyDict(self.PcdFiledValueFromDscComponent) > > new_pcd.ValueChain =3D {item for item in self.ValueChain} > > return new_pcd > > > > LibraryClassObject =3D namedtuple('LibraryClassObject', > > ['LibraryClass','SupModList']) > > > > @@ -461,10 +471,12 @@ class ModuleBuildClassObject(object): > > self.Includes =3D [] > > self.Packages =3D [] > > self.Pcds =3D {} > > self.BuildOptions =3D {} > > self.Depex =3D {} > > + self.StrPcdSet =3D [] > > + self.StrPcdOverallValue =3D {} > > > > ## Convert the class to a string > > # > > # Convert member MetaFile of the class to a string > > # > > diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py > > b/BaseTools/Source/Python/Workspace/DscBuildData.py > > index 1ed3d9b909..1bb4fdc183 100644 > > --- a/BaseTools/Source/Python/Workspace/DscBuildData.py > > +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py > > @@ -753,13 +753,14 @@ class DscBuildData(PlatformBuildClassObject): > > ErrorCode, ErrorInfo =3D ModuleFile.Validate('.inf') > > if ErrorCode !=3D 0: > > EdkLogger.error('build', ErrorCode, File=3Dself.MetaF= ile, > > Line=3DLineNo, > > ExtraData=3DErrorInfo) > > > > + ModuleBuildData =3D self._Bdb[ModuleFile, self._Arch, > > self._Target, self._Toolchain] > > Module =3D ModuleBuildClassObject() > > Module.MetaFile =3D ModuleFile > > - > > + Module.Guid =3D ModuleBuildData.Guid > > # get module private library instance > > RecordList =3D self._RawData[MODEL_EFI_LIBRARY_CLASS, > > self._Arch, None, ModuleId] > > for Record in RecordList: > > LibraryClass =3D Record[0] > > LibraryPath =3D PathClass(NormPath(Record[1], > Macros), > > GlobalData.gWorkspace, Arch=3Dself._Arch) > > @@ -776,11 +777,11 @@ class DscBuildData(PlatformBuildClassObject): > > LibraryClass =3D 'NULL%d' % > self._NullLibraryNumber > > EdkLogger.verbose("Found forced library > > for %s\n\t%s [%s]" % (ModuleFile, LibraryPath, LibraryClass)) > > Module.LibraryClasses[LibraryClass] =3D LibraryPath > > if LibraryPath not in self.LibraryInstances: > > self.LibraryInstances.append(LibraryPath) > > - > > + S_PcdSet =3D [] > > # get module private PCD setting > > for Type in [MODEL_PCD_FIXED_AT_BUILD, > > MODEL_PCD_PATCHABLE_IN_MODULE, \ > > MODEL_PCD_FEATURE_FLAG, > > MODEL_PCD_DYNAMIC, MODEL_PCD_DYNAMIC_EX]: > > RecordList =3D self._RawData[Type, self._Arch, None, > > ModuleId] > > for TokenSpaceGuid, PcdCName, Setting, Dummy1, > > Dummy2, Dummy3, Dummy4, Dummy5 in RecordList: > > @@ -790,24 +791,35 @@ class DscBuildData(PlatformBuildClassObject): > > if len(TokenList) > 2: > > MaxDatumSize =3D TokenList[2] > > else: > > MaxDatumSize =3D '' > > TypeString =3D self._PCD_TYPE_STRING_[Type] > > - Pcd =3D PcdClassObject( > > - PcdCName, > > - TokenSpaceGuid, > > - TypeString, > > - '', > > - DefaultValue, > > - '', > > - MaxDatumSize, > > - {}, > > - False, > > - None > > - ) > > - Module.Pcds[PcdCName, TokenSpaceGuid] =3D Pcd > > > > + TCName,PCName,DimensionAttr,Field =3D > > self.ParsePcdNameStruct(TokenSpaceGuid, PcdCName) > > + > > + if ("." in TokenSpaceGuid or "[" in PcdCName): > > + > > S_PcdSet.append([ TCName,PCName,DimensionAttr,Field, > > ModuleBuildData.Guid, "", Dummy5, AnalyzePcdExpression(Setting)[0]]) > > + DefaultValue =3D '' > > + if ( PCName,TCName) not in Module.Pcds: > > + Pcd =3D PcdClassObject( > > + PCName, > > + TCName, > > + TypeString, > > + '', > > + DefaultValue, > > + '', > > + MaxDatumSize, > > + {}, > > + False, > > + None, > > + IsDsc=3DTrue) > > + Module.Pcds[PCName, TCName] =3D Pcd > > + > > + Module.StrPcdSet =3D S_PcdSet > > + for TCName,PCName, _,_,_,_,_,_ in S_PcdSet: > > + if (PCName,TCName) in Module.Pcds: > > + Module.StrPcdOverallValue[(PCName,TCName)] > =3D > > Module.Pcds[(PCName,TCName)].DefaultValue, self.MetaFile,Dummy5 > > # get module private build options > > RecordList =3D > > self._RawData[MODEL_META_DATA_BUILD_OPTION, self._Arch, None, > > ModuleId] > > for ToolChainFamily, ToolChain, Option, Dummy1, Dummy2, > > Dummy3, Dummy4, Dummy5 in RecordList: > > if (ToolChainFamily, ToolChain) not in > > Module.BuildOptions: > > Module.BuildOptions[ToolChainFamily, ToolChain] > =3D > > Option > > @@ -820,11 +832,13 @@ class DscBuildData(PlatformBuildClassObject): > > if len(RecordList) !=3D 1: > > EdkLogger.error('build', OPTION_UNKNOWN, > 'Only > > FILE_GUID can be listed in section.', > > File=3Dself.MetaFile, > > ExtraData=3Dstr(ModuleFile), Line=3DLineNo) > > ModuleFile =3D ProcessDuplicatedInf(ModuleFile, > > RecordList[0][2], GlobalData.gWorkspace) > > ModuleFile.Arch =3D self._Arch > > - > > + Module.Guid =3D RecordList[0][2] > > + for item in Module.StrPcdSet: > > + item[4] =3D RecordList[0][2] > > self._Modules[ModuleFile] =3D Module > > return self._Modules > > > > ## Retrieve all possible library instances used in this platform > > @property > > @@ -1497,11 +1511,19 @@ class DscBuildData(PlatformBuildClassObject): > > EdkLogger.error('build', PARSER_ERROR, > > "Pcd (%s.%s) is not declared as > > Structure PCD in DEC files. Arch: ['%s']" % (TCName, PCName, self._Arc= h), > > File=3Dself.MetaFile, Line =3D > Dummy5) > > > > > > S_PcdSet.append([ TCName,PCName,DimensionAttr,Field, SkuName, > > default_store, Dummy5, AnalyzePcdExpression(Setting)[0]]) > > - > > + ModuleScopeOverallValue =3D {} > > + for m in self.Modules.values(): > > + mguid =3D m.Guid > > + if m.StrPcdSet: > > + S_PcdSet.extend(m.StrPcdSet) > > + mguid =3D m.StrPcdSet[0][4] > > + for (PCName,TCName) in m.StrPcdOverallValue: > > + Value, dsc_file, lineNo =3D > > m.StrPcdOverallValue[(PCName,TCName)] > > + > > ModuleScopeOverallValue.setdefault((PCName,TCName),{})[mguid] =3D Valu= e, > > dsc_file, lineNo > > # handle pcd value override > > StrPcdSet =3D DscBuildData.GetStructurePcdInfo(S_PcdSet) > > S_pcd_set =3D OrderedDict() > > for str_pcd in StrPcdSet: > > str_pcd_obj =3D Pcds.get((str_pcd[1], str_pcd[0]), None) > > @@ -1515,10 +1537,15 @@ class DscBuildData(PlatformBuildClassObject): > > else: > > str_pcd_obj_str.DefaultFromDSC =3D > > {skuname:{defaultstore: > > str_pcd_obj.SkuInfoList[skuname].DefaultStoreDict.get(defaultstore, > > str_pcd_obj.SkuInfoList[skuname].DefaultValue) for defaultstore in > > DefaultStores} for skuname in str_pcd_obj.SkuInfoList} > > for str_pcd_data in StrPcdSet[str_pcd]: > > if str_pcd_data[4] in SkuIds: > > > str_pcd_obj_str.AddOverrideValue(str_pcd_data[3], > > str(str_pcd_data[7]), TAB_DEFAULT if str_pcd_data[4] =3D=3D TAB_COMMON > else > > str_pcd_data[4], TAB_DEFAULT_STORES_DEFAULT if str_pcd_data[5] =3D=3D > > TAB_COMMON else str_pcd_data[5], self.MetaFile.File if self.WorkspaceD= ir > > not in self.MetaFile.File else self.MetaFile.File[len(self.WorkspaceDi= r) > if > > self.WorkspaceDir.endswith(os.path.sep) else len(self.WorkspaceDir)+1:= ], > > LineNo=3Dstr_pcd_data[6],DimensionAttr =3D str_pcd_data[2]) > > + elif GlobalData.gGuidPattern.match(str_pcd_data[4]): > > + > > str_pcd_obj_str.AddComponentOverrideValue(str_pcd_data[3], > > str(str_pcd_data[7]), str_pcd_data[4].replace("-","S"), self.MetaFile.= File > if > > self.WorkspaceDir not in self.MetaFile.File else > > self.MetaFile.File[len(self.WorkspaceDir) if > > self.WorkspaceDir.endswith(os.path.sep) else len(self.WorkspaceDir)+1:= ], > > LineNo=3Dstr_pcd_data[6],DimensionAttr =3D str_pcd_data[2]) > > + PcdComponentValue =3D > > > ModuleScopeOverallValue.get((str_pcd_obj_str.TokenCName,str_pcd_obj_str. > > TokenSpaceGuidCName)) > > + for module_guid in PcdComponentValue: > > + > > str_pcd_obj_str.PcdValueFromComponents[module_guid.replace("-","S")] = =3D > > PcdComponentValue[module_guid] > > S_pcd_set[str_pcd[1], str_pcd[0]] =3D str_pcd_obj_str > > > > # Add the Structure PCD that only defined in DEC, don't have > > override in DSC file > > for Pcd in self.DecPcds: > > if isinstance(self._DecPcds[Pcd], StructurePcd): > > @@ -1573,11 +1600,14 @@ class DscBuildData(PlatformBuildClassObject): > > if defaultstoreid not in > > stru_pcd.SkuOverrideValues[skuid]: > > > > stru_pcd.SkuOverrideValues[skuid][defaultstoreid] =3D > > CopyDict(stru_pcd.SkuOverrideValues[nextskuid][mindefaultstorename]) > > stru_pcd.ValueChain.add((skuid, > > defaultstoreid)) > > S_pcd_set =3D > > DscBuildData.OverrideByFdf(S_pcd_set,self.WorkspaceDir) > > S_pcd_set =3D DscBuildData.OverrideByComm(S_pcd_set) > > + > > + # Create a tool to caculate structure pcd value > > Str_Pcd_Values =3D self.GenerateByteArrayValue(S_pcd_set) > > + > > if Str_Pcd_Values: > > for (skuname, StoreName, PcdGuid, PcdName, PcdValue) in > > Str_Pcd_Values: > > str_pcd_obj =3D S_pcd_set.get((PcdName, PcdGuid)) > > if str_pcd_obj is None: > > print(PcdName, PcdGuid) > > @@ -1591,10 +1621,18 @@ class DscBuildData(PlatformBuildClassObject): > > > > > str_pcd_obj.SkuInfoList[skuname].DefaultStoreDict.update({StoreName:PcdV > > alue}) > > elif str_pcd_obj.Type in > > [self._PCD_TYPE_STRING_[MODEL_PCD_FIXED_AT_BUILD], > > > > self._PCD_TYPE_STRING_[MODEL_PCD_PATCHABLE_IN_MODULE]]: > > if skuname in (self.SkuIdMgr.SystemSkuId, > > TAB_DEFAULT, TAB_COMMON): > > str_pcd_obj.DefaultValue =3D PcdValue > > + else: > > + #Module Scope Structure Pcd > > + moduleguid =3D skuname.replace("S","-") > > + if > > GlobalData.gGuidPattern.match(moduleguid): > > + for component in self.Modules.values(): > > + if component.Guid =3D=3D moduleguid: > > + component.Pcds[(PcdName, > > PcdGuid)].DefaultValue =3D PcdValue > > + > > else: > > if skuname not in str_pcd_obj.SkuInfoList: > > nextskuid =3D > > self.SkuIdMgr.GetNextSkuId(skuname) > > NoDefault =3D False > > while nextskuid not in > str_pcd_obj.SkuInfoList: > > @@ -2339,10 +2377,79 @@ class DscBuildData(PlatformBuildClassObject): > > else: > > CApp =3D CApp + ' Pcd->%s =3D %d; // > From %s > > Line %d Value %s\n' % (FieldName, Value, FieldList[FieldName][1], > > FieldList[FieldName][2], FieldList[FieldName][0]) > > CApp =3D CApp + "}\n" > > return CApp > > > > + def GenerateModuleScopeValue(self, Pcd): > > + CApp =3D "// Value in Dsc Module scope \n" > > + for ModuleGuid in Pcd.PcdFiledValueFromDscComponent: > > + > > + CApp =3D CApp + "void Assign_%s_%s_%s_Value(%s > *Pcd){\n" % > > (Pcd.TokenSpaceGuidCName, Pcd.TokenCName, > > ModuleGuid,Pcd.BaseDatumType) > > + CApp =3D CApp + ' UINT32 FieldSize;\n' > > + CApp =3D CApp + ' CHAR8 *Value;\n' > > + pcddefaultvalue, file_path,lineNo =3D > > Pcd.PcdValueFromComponents.get(ModuleGuid,(None,None,None)) > > + > > + if pcddefaultvalue: > > + IsArray =3D _IsFieldValueAnArray(pcddefaultvalue) > > + if IsArray: > > + try: > > + FieldList =3D > ValueExpressionEx(pcddefaultvalue, > > TAB_VOID)(True) > > + except BadExpression: > > + EdkLogger.error("Build", FORMAT_INVALID, > > "Invalid value format for %s.%s, from %s Line %s: %s" % > > + > > (Pcd.TokenSpaceGuidCName, Pcd.TokenCName, file_path, lineNo, FieldList= )) > > + Value, ValueSize =3D ParseFieldValue (FieldList) > > + > > + if isinstance(Value, str): > > + CApp =3D CApp + ' Pcd =3D %s; // From %s Line %s > \n' % > > (Value, file_path, lineNo) > > + elif IsArray: > > + # > > + # Use memcpy() to copy value into field > > + # > > + CApp =3D CApp + ' Value =3D %s; // From %s > > Line %s.\n' % (DscBuildData.IntToCString(Value, ValueSize), file_path, > lineNo) > > + CApp =3D CApp + ' memcpy (Pcd, Value, %d);\n' % > > (ValueSize) > > + > > + > > + PcdFiledValue =3D > > Pcd.PcdFiledValueFromDscComponent.get(ModuleGuid) > > + for index in PcdFiledValue: > > + FieldList =3D PcdFiledValue[index] > > + if not FieldList: > > + continue > > + for FieldName in FieldList: > > + IsArray =3D > > _IsFieldValueAnArray(FieldList[FieldName][0]) > > + if IsArray: > > + try: > > + FieldList[FieldName][0] =3D > > ValueExpressionEx(FieldList[FieldName][0], TAB_VOID, self._GuidDict)(T= rue) > > + except BadExpression: > > + EdkLogger.error('Build', > > FORMAT_INVALID, "Invalid value format for %s. From %s Line %d " % > > + > > (".".join((Pcd.TokenSpaceGuidCName, Pcd.TokenCName, FieldName)), > > FieldList[FieldName][1], FieldList[FieldName][2])) > > + except: > > + print("error") > > + try: > > + Value, ValueSize =3D ParseFieldValue > > (FieldList[FieldName][0]) > > + except Exception: > > + EdkLogger.error('Build', FORMAT_INVALID, > > "Invalid value format for %s. From %s Line %d " % > > (".".join((Pcd.TokenSpaceGuidCName, Pcd.TokenCName, FieldName)), > > FieldList[FieldName][1], FieldList[FieldName][2])) > > + if isinstance(Value, str): > > + CApp =3D CApp + ' Pcd->%s =3D %s; // From %s > > Line %d Value %s\n' % (FieldName, Value, FieldList[FieldName][1], > > FieldList[FieldName][2], FieldList[FieldName][0]) > > + elif IsArray: > > + # > > + # Use memcpy() to copy value into field > > + # > > + CApp =3D CApp + ' FieldSize =3D > > __FIELD_SIZE(%s, %s);\n' % (Pcd.BaseDatumType, FieldName) > > + CApp =3D CApp + ' Value =3D %s; // > > From %s Line %d Value %s\n' % (DscBuildData.IntToCString(Value, > ValueSize), > > FieldList[FieldName][1], FieldList[FieldName][2], FieldList[FieldName]= [0]) > > + CApp =3D CApp + ' > > __STATIC_ASSERT((__FIELD_SIZE(%s, %s) >=3D %d) || (__FIELD_SIZE(%s, %s= ) > =3D=3D > > 0), "Input buffer exceeds the buffer array"); // From %s Line %d Value > %s\n' % > > (Pcd.BaseDatumType, FieldName, ValueSize, Pcd.BaseDatumType, > FieldName, > > FieldList[FieldName][1], FieldList[FieldName][2], FieldList[FieldName]= [0]) > > + CApp =3D CApp + ' memcpy (&Pcd->%s, > Value, > > (FieldSize > 0 && FieldSize < %d) ? FieldSize : %d);\n' % (FieldName, > ValueSize, > > ValueSize) > > + else: > > + if '[' in FieldName and ']' in FieldName: > > + Index =3D > > int(FieldName.split('[')[1].split(']')[0]) > > + CApp =3D CApp + ' > __STATIC_ASSERT((%d > > < __ARRAY_SIZE(Pcd->%s)) || (__ARRAY_SIZE(Pcd->%s) =3D=3D 0), "array i= ndex > > exceeds the array number"); // From %s Line %d Index of %s\n' % (Index= , > > FieldName.split('[')[0], FieldName.split('[')[0], FieldList[FieldName]= [1], > > FieldList[FieldName][2], FieldName) > > + if ValueSize > 4: > > + CApp =3D CApp + ' Pcd->%s =3D %dULL; // > > From %s Line %d Value %s\n' % (FieldName, Value, FieldList[FieldName][= 1], > > FieldList[FieldName][2], FieldList[FieldName][0]) > > + else: > > + CApp =3D CApp + ' Pcd->%s =3D %d; // > > From %s Line %d Value %s\n' % (FieldName, Value, FieldList[FieldName][= 1], > > FieldList[FieldName][2], FieldList[FieldName][0]) > > + CApp =3D CApp + "}\n" > > + return CApp > > + > > @staticmethod > > def GenerateCommandLineValueStatement(Pcd): > > CApp =3D ' Assign_%s_%s_CommandLine_Value(Pcd);\n' % > > (Pcd.TokenSpaceGuidCName, Pcd.TokenCName) > > return CApp > > def GenerateFdfValue(self,Pcd): > > @@ -2412,10 +2519,88 @@ class DscBuildData(PlatformBuildClassObject): > > @staticmethod > > def GenerateFdfValueStatement(Pcd): > > CApp =3D ' Assign_%s_%s_Fdf_Value(Pcd);\n' % > > (Pcd.TokenSpaceGuidCName, Pcd.TokenCName) > > return CApp > > > > + @staticmethod > > + def GenerateModuleValueStatement(module_guid, Pcd): > > + CApp =3D " Assign_%s_%s_%s_Value(Pcd);\n" % > > (Pcd.TokenSpaceGuidCName, Pcd.TokenCName, module_guid) > > + return CApp > > + def GenerateModuleScopeInitializeFunc(self,SkuName, Pcd, > > InitByteValue, CApp): > > + for module_guid in Pcd.PcdFiledValueFromDscComponent: > > + CApp =3D CApp + 'void\n' > > + CApp =3D CApp + 'Initialize_%s_%s_%s_%s(\n' % > (module_guid, > > TAB_DEFAULT_STORES_DEFAULT, Pcd.TokenSpaceGuidCName, > > Pcd.TokenCName) > > + CApp =3D CApp + ' void\n' > > + CApp =3D CApp + ' )\n' > > + CApp =3D CApp + '{\n' > > + CApp =3D CApp + ' UINT32 Size;\n' > > + CApp =3D CApp + ' UINT32 FieldSize;\n' > > + CApp =3D CApp + ' CHAR8 *Value;\n' > > + CApp =3D CApp + ' UINT32 OriginalSize;\n' > > + CApp =3D CApp + ' VOID *OriginalPcd;\n' > > + > > + CApp =3D CApp + ' %s *Pcd; // From %s Line %d > \n' % > > (Pcd.BaseDatumType,Pcd.PkgPath, Pcd.PcdDefineLineNo) > > + > > + CApp =3D CApp + '\n' > > + > > + PcdDefaultValue =3D > > StringToArray(Pcd.DefaultValueFromDec.strip()) > > + InitByteValue +=3D '%s.%s.%s.%s|%s|%s\n' % (module_guid, > > TAB_DEFAULT_STORES_DEFAULT, Pcd.TokenSpaceGuidCName, > > Pcd.TokenCName, Pcd.DatumType, PcdDefaultValue) > > + # > > + # Get current PCD value and size > > + # > > + CApp =3D CApp + ' OriginalPcd =3D PcdGetPtr (%s, %s, %s,= %s, > > &OriginalSize);\n' % (module_guid, TAB_DEFAULT_STORES_DEFAULT, > > Pcd.TokenSpaceGuidCName, Pcd.TokenCName) > > + > > + # > > + # Determine the size of the PCD. For simple structures, > > sizeof(TYPE) provides > > + # the correct value. For structures with a flexible arra= y > > member, the flexible > > + # array member is detected, and the size is based on the > > highest index used with > > + # the flexible array member. The flexible array member > > must be the last field > > + # in a structure. The size formula for this case is: > > + # OFFSET_OF(FlexbleArrayField) + sizeof(FlexibleArray[0])= * > > (HighestIndex + 1) > > + # > > + CApp =3D CApp + > > > DscBuildData.GenerateSizeStatments(Pcd,SkuName,TAB_DEFAULT_STORES_D > > EFAULT) > > + if Pcd.IsArray() and Pcd.Capacity[-1] !=3D "-1": > > + CApp =3D CApp + ' OriginalSize =3D OriginalSize < > sizeof(%s) > > * %d? OriginalSize:sizeof(%s) * %d; \n' % > > > (Pcd.BaseDatumType,Pcd.PcdArraySize(),Pcd.BaseDatumType,Pcd.PcdArraySiz > > e()) > > + CApp =3D CApp + ' Size =3D sizeof(%s) * %d; \n' % > > (Pcd.BaseDatumType,Pcd.PcdArraySize()) > > + > > + # > > + # Allocate and zero buffer for the PCD > > + # Must handle cases where current value is smaller, large= r, > or > > same size > > + # Always keep that larger one as the current size > > + # > > + CApp =3D CApp + ' Size =3D (OriginalSize > Size ? Origin= alSize : > > Size);\n' > > + CApp =3D CApp + ' Pcd =3D (%s *)malloc (Size);\n' % > > (Pcd.BaseDatumType,) > > + CApp =3D CApp + ' memset (Pcd, 0, Size);\n' > > + > > + # > > + # Copy current PCD value into allocated buffer. > > + # > > + CApp =3D CApp + ' memcpy (Pcd, OriginalPcd, > OriginalSize);\n' > > + > > + # > > + # Assign field values in PCD > > + # > > + CApp =3D CApp + > > DscBuildData.GenerateDefaultValueAssignStatement(Pcd) > > + > > + CApp =3D CApp + "// SkuName: %s, DefaultStoreName: > > STANDARD \n" % self.SkuIdMgr.SystemSkuId > > + CApp =3D CApp + > > DscBuildData.GenerateInitValueStatement(Pcd, self.SkuIdMgr.SystemSkuId= , > > TAB_DEFAULT_STORES_DEFAULT) > > + CApp =3D CApp + > > DscBuildData.GenerateFdfValueStatement(Pcd) > > + CApp =3D CApp + > > DscBuildData.GenerateCommandLineValueStatement(Pcd) > > + CApp =3D CApp + > > DscBuildData.GenerateModuleValueStatement(module_guid,Pcd) > > + # > > + # Set new PCD value and size > > + # > > + CApp =3D CApp + ' PcdSetPtr (%s, %s, %s, %s, Size, (void > > *)Pcd);\n' % (module_guid, TAB_DEFAULT_STORES_DEFAULT, > > Pcd.TokenSpaceGuidCName, Pcd.TokenCName) > > + > > + # > > + # Free PCD > > + # > > + CApp =3D CApp + ' free (Pcd);\n' > > + CApp =3D CApp + '}\n' > > + CApp =3D CApp + '\n' > > + return InitByteValue,CApp > > + > > def GenerateInitializeFunc(self, SkuName, DefaultStore, Pcd, > > InitByteValue, CApp): > > OverrideValues =3D {DefaultStore:{}} > > if Pcd.SkuOverrideValues: > > OverrideValues =3D Pcd.SkuOverrideValues[SkuName] > > if not OverrideValues: > > @@ -2584,26 +2769,42 @@ class DscBuildData(PlatformBuildClassObject): > > CApp =3D CApp + '\n' > > for Pcd in StructuredPcds.values(): > > CApp =3D CApp + self.GenerateArrayAssignment(Pcd) > > for PcdName in sorted(StructuredPcds.keys()): > > Pcd =3D StructuredPcds[PcdName] > > + > > + #create void void Cal_tocken_cname_Size functions > > CApp =3D CApp + self.GenerateSizeFunction(Pcd) > > + > > + #create void Assign_ functions > > + > > + # From DEC > > CApp =3D CApp + > self.GenerateDefaultValueAssignFunction(Pcd) > > + # From Fdf > > CApp =3D CApp + self.GenerateFdfValue(Pcd) > > + # From CommandLine > > CApp =3D CApp + self.GenerateCommandLineValue(Pcd) > > + > > + # From Dsc Global setting > > if self.SkuOverrideValuesEmpty(Pcd.SkuOverrideValues) or > > Pcd.Type in [self._PCD_TYPE_STRING_[MODEL_PCD_FIXED_AT_BUILD], > > > > self._PCD_TYPE_STRING_[MODEL_PCD_PATCHABLE_IN_MODULE]]: > > CApp =3D CApp + self.GenerateInitValueFunction(Pcd, > > self.SkuIdMgr.SystemSkuId, TAB_DEFAULT_STORES_DEFAULT) > > else: > > for SkuName in self.SkuIdMgr.SkuOverrideOrder(): > > if SkuName not in Pcd.SkuOverrideValues: > > continue > > for DefaultStoreName in > > Pcd.SkuOverrideValues[SkuName]: > > CApp =3D CApp + > > self.GenerateInitValueFunction(Pcd, SkuName, DefaultStoreName) > > + > > + # From Dsc module scope setting > > + CApp =3D CApp + self.GenerateModuleScopeValue(Pcd) > > + > > + #create Initialize_ functions > > if self.SkuOverrideValuesEmpty(Pcd.SkuOverrideValues) or > > Pcd.Type in [self._PCD_TYPE_STRING_[MODEL_PCD_FIXED_AT_BUILD], > > > > self._PCD_TYPE_STRING_[MODEL_PCD_PATCHABLE_IN_MODULE]]: > > InitByteValue, CApp =3D > > self.GenerateInitializeFunc(self.SkuIdMgr.SystemSkuId, > > TAB_DEFAULT_STORES_DEFAULT, Pcd, InitByteValue, CApp) > > + InitByteValue, CApp =3D > > > self.GenerateModuleScopeInitializeFunc(self.SkuIdMgr.SystemSkuId,Pcd,Ini= tBy > > teValue,CApp) > > else: > > for SkuName in self.SkuIdMgr.SkuOverrideOrder(): > > if SkuName not in Pcd.SkuOverrideValues: > > continue > > for DefaultStoreName in Pcd.DefaultStoreName: > > @@ -2616,10 +2817,12 @@ class DscBuildData(PlatformBuildClassObject): > > CApp =3D CApp + ' )\n' > > CApp =3D CApp + '{\n' > > for Pcd in StructuredPcds.values(): > > if self.SkuOverrideValuesEmpty(Pcd.SkuOverrideValues) or > > Pcd.Type in [self._PCD_TYPE_STRING_[MODEL_PCD_FIXED_AT_BUILD], > > self._PCD_TYPE_STRING_[MODEL_PCD_PATCHABLE_IN_MODULE]]: > > CApp =3D CApp + ' Initialize_%s_%s_%s_%s();\n' % > > (self.SkuIdMgr.SystemSkuId, TAB_DEFAULT_STORES_DEFAULT, > > Pcd.TokenSpaceGuidCName, Pcd.TokenCName) > > + for ModuleGuid in > > Pcd.PcdFiledValueFromDscComponent: > > + CApp +=3D " Initialize_%s_%s_%s_%s();\n" % > > (ModuleGuid,TAB_DEFAULT_STORES_DEFAULT ,Pcd.TokenSpaceGuidCName, > > Pcd.TokenCName) > > else: > > for SkuName in self.SkuIdMgr.SkuOverrideOrder(): > > if SkuName not in > self.SkuIdMgr.AvailableSkuIdSet: > > continue > > for DefaultStoreName in > > Pcd.SkuOverrideValues[SkuName]: > > @@ -2631,10 +2834,11 @@ class DscBuildData(PlatformBuildClassObject): > > if not os.path.exists(self.OutputPath): > > os.makedirs(self.OutputPath) > > CAppBaseFileName =3D os.path.join(self.OutputPath, > > PcdValueInitName) > > SaveFileOnChange(CAppBaseFileName + '.c', CApp, False) > > > > + # start generating makefile > > MakeApp =3D PcdMakefileHeader > > if sys.platform =3D=3D "win32": > > MakeApp =3D MakeApp + 'APPFILE =3D %s\%s.exe\n' % > > (self.OutputPath, PcdValueInitName) + 'APPNAME =3D %s\n' % > > (PcdValueInitName) + 'OBJECTS =3D %s\%s.obj %s.obj\n' % (self.OutputPa= th, > > PcdValueInitName, os.path.join(self.OutputPath, PcdValueCommonName)) + > > 'INC =3D ' > > else: > > MakeApp =3D MakeApp + PcdGccMakefile > > @@ -2753,19 +2957,22 @@ class DscBuildData(PlatformBuildClassObject): > > MakeApp =3D MakeApp + '\tcp > -f %s %s/PcdValueCommon.c\n' % > > (PcdValueCommonPath, self.OutputPath) > > MakeFileName =3D os.path.join(self.OutputPath, 'Makefile') > > MakeApp +=3D "$(OBJECTS) : %s\n" % MakeFileName > > SaveFileOnChange(MakeFileName, MakeApp, False) > > > > + # start generating input file > > InputValueFile =3D os.path.join(self.OutputPath, 'Input.txt') > > OutputValueFile =3D os.path.join(self.OutputPath, 'Output.txt= ') > > SaveFileOnChange(InputValueFile, InitByteValue, False) > > > > Dest_PcdValueInitExe =3D PcdValueInitName > > if not sys.platform =3D=3D "win32": > > Dest_PcdValueInitExe =3D os.path.join(self.OutputPath, > > PcdValueInitName) > > else: > > Dest_PcdValueInitExe =3D os.path.join(self.OutputPath, > > PcdValueInitName) +".exe" > > + > > + #start building the structure pcd value tool > > Messages =3D '' > > if sys.platform =3D=3D "win32": > > MakeCommand =3D 'nmake -f %s' % (MakeFileName) > > returncode, StdOut, StdErr =3D > DscBuildData.ExecuteCommand > > (MakeCommand) > > Messages =3D StdOut > > @@ -2824,17 +3031,19 @@ class DscBuildData(PlatformBuildClassObject): > > if MessageGroup: > > EdkLogger.error("build", > PCD_STRUCTURE_PCD_ERROR, > > "\n".join(MessageGroup) ) > > else: > > EdkLogger.error('Build', COMMAND_FAILURE, 'Can > not > > execute command: %s\n%s\n%s' % (MakeCommand, StdOut, StdErr)) > > > > + #start executing the structure pcd value tool > > if DscBuildData.NeedUpdateOutput(OutputValueFile, > > Dest_PcdValueInitExe, InputValueFile): > > Command =3D Dest_PcdValueInitExe + ' -i %s -o %s' % > > (InputValueFile, OutputValueFile) > > returncode, StdOut, StdErr =3D > DscBuildData.ExecuteCommand > > (Command) > > EdkLogger.verbose ('%s\n%s\n%s' % (Command, StdOut, > > StdErr)) > > if returncode !=3D 0: > > EdkLogger.warn('Build', COMMAND_FAILURE, 'Can > not > > collect output from command: %s\n%s\n' % (Command, StdOut, StdErr)) > > > > + #start update structure pcd final value > > File =3D open (OutputValueFile, 'r') > > FileBuffer =3D File.readlines() > > File.close() > > > > StructurePcdSet =3D [] > > diff --git a/BaseTools/Source/Python/build/BuildReport.py > > b/BaseTools/Source/Python/build/BuildReport.py > > index 8efa869162..d4de07cae2 100644 > > --- a/BaseTools/Source/Python/build/BuildReport.py > > +++ b/BaseTools/Source/Python/build/BuildReport.py > > @@ -694,11 +694,11 @@ class ModuleReport(object): > > FileWrite(File, "PCI Class Code: %s" % > > self.PciClassCode) > > > > FileWrite(File, gSectionSep) > > > > if "PCD" in ReportType: > > - GlobalPcdReport.GenerateReport(File, self.ModulePcdSet) > > + GlobalPcdReport.GenerateReport(File, > > self.ModulePcdSet,self.FileGuid) > > > > if "LIBRARY" in ReportType: > > self.LibraryReport.GenerateReport(File) > > > > if "DEPEX" in ReportType: > > @@ -879,11 +879,11 @@ class PcdReport(object): > > for (TokenCName, TokenSpaceGuidCName) in > > Pa.Platform.Pcds: > > DscDefaultValue =3D Pa.Platform.Pcds[(TokenCName, > > TokenSpaceGuidCName)].DscDefaultValue > > if DscDefaultValue: > > self.DscPcdDefault[(TokenCName, > > TokenSpaceGuidCName)] =3D DscDefaultValue > > > > - def GenerateReport(self, File, ModulePcdSet): > > + def GenerateReport(self, File, ModulePcdSet,module_guid=3DNone): > > if not ModulePcdSet: > > if self.ConditionalPcds: > > self.GenerateReportDetail(File, ModulePcdSet, 1) > > if self.UnusedPcds: > > IsEmpty =3D True > > @@ -895,11 +895,11 @@ class PcdReport(object): > > break > > if not IsEmpty: > > break > > if not IsEmpty: > > self.GenerateReportDetail(File, ModulePcdSet, 2) > > - self.GenerateReportDetail(File, ModulePcdSet) > > + self.GenerateReportDetail(File, ModulePcdSet,module_guid =3D > > module_guid) > > > > ## > > # Generate report for PCD information > > # > > # This function generates report for separate module expression > > @@ -911,11 +911,11 @@ class PcdReport(object): > > # platform PCD report > > # @param ReportySubType 0 means platform/module PCD report, > 1 > > means Conditional > > # directives section report, 2 means > > Unused Pcds section report > > # @param DscOverridePcds Module DSC override PCDs set > > # > > - def GenerateReportDetail(self, File, ModulePcdSet, ReportSubType = = =3D > 0): > > + def GenerateReportDetail(self, File, ModulePcdSet, ReportSubType = = =3D > > 0,module_guid=3DNone): > > PcdDict =3D self.AllPcds > > if ReportSubType =3D=3D 1: > > PcdDict =3D self.ConditionalPcds > > elif ReportSubType =3D=3D 2: > > PcdDict =3D self.UnusedPcds > > @@ -991,14 +991,16 @@ class PcdReport(object): > > if DscDefaultValue: > > PcdValue =3D DscDefaultValue > > #The DefaultValue of StructurePcd already be the > latest, > > no need to update. > > if not self.IsStructurePcd(Pcd.TokenCName, > > Pcd.TokenSpaceGuidCName): > > Pcd.DefaultValue =3D PcdValue > > + PcdComponentValue =3D None > > if ModulePcdSet is not None: > > if (Pcd.TokenCName, > Pcd.TokenSpaceGuidCName, > > Type) not in ModulePcdSet: > > continue > > - InfDefaultValue, PcdValue =3D > > ModulePcdSet[Pcd.TokenCName, Pcd.TokenSpaceGuidCName, Type] > > + InfDefaultValue, PcdComponentValue =3D > > ModulePcdSet[Pcd.TokenCName, Pcd.TokenSpaceGuidCName, Type] > > + PcdValue =3D PcdComponentValue > > #The DefaultValue of StructurePcd already be > the > > latest, no need to update. > > if not self.IsStructurePcd(Pcd.TokenCName, > > Pcd.TokenSpaceGuidCName): > > Pcd.DefaultValue =3D PcdValue > > if InfDefaultValue: > > try: > > @@ -1079,62 +1081,68 @@ class PcdReport(object): > > if self.IsStructurePcd(Pcd.TokenCName, > > Pcd.TokenSpaceGuidCName): > > IsStructure =3D True > > if TypeName in ('DYNVPD', 'DEXVPD'): > > SkuInfoList =3D Pcd.SkuInfoList > > Pcd =3D > > GlobalData.gStructurePcd[self.Arch][(Pcd.TokenCName, > > Pcd.TokenSpaceGuidCName)] > > + if ModulePcdSet and > > ModulePcdSet.get((Pcd.TokenCName, Pcd.TokenSpaceGuidCName, Type)): > > + InfDefaultValue, PcdComponentValue =3D > > ModulePcdSet[Pcd.TokenCName, Pcd.TokenSpaceGuidCName, Type] > > + DscDefaultValBak =3D Pcd.DefaultValue > > + Pcd.DefaultValue =3D PcdComponentValue > > + > > Pcd.DatumType =3D Pcd.StructName > > if TypeName in ('DYNVPD', 'DEXVPD'): > > Pcd.SkuInfoList =3D SkuInfoList > > if Pcd.PcdValueFromComm or > > Pcd.PcdFieldValueFromComm: > > BuildOptionMatch =3D True > > DecMatch =3D False > > elif Pcd.PcdValueFromFdf or > > Pcd.PcdFieldValueFromFdf: > > DscDefaultValue =3D True > > DscMatch =3D True > > DecMatch =3D False > > - elif Pcd.SkuOverrideValues: > > - DscOverride =3D False > > - if Pcd.DefaultFromDSC: > > - DscOverride =3D True > > - else: > > - DictLen =3D 0 > > - for item in Pcd.SkuOverrideValues: > > - DictLen +=3D > > len(Pcd.SkuOverrideValues[item]) > > - if not DictLen: > > - DscOverride =3D False > > + else: > > + if Pcd.Type in PCD_DYNAMIC_TYPE_SET | > > PCD_DYNAMIC_EX_TYPE_SET: > > + DscOverride =3D False > > + if Pcd.DefaultFromDSC: > > + DscOverride =3D True > > else: > > - if not Pcd.SkuInfoList: > > - OverrideValues =3D > > Pcd.SkuOverrideValues > > - if OverrideValues: > > - for Data in > > OverrideValues.values(): > > - Struct =3D > > list(Data.values()) > > - if Struct: > > - DscOverride =3D > > self.ParseStruct(Struct[0]) > > - break > > + DictLen =3D 0 > > + for item in Pcd.SkuOverrideValues: > > + DictLen +=3D > > len(Pcd.SkuOverrideValues[item]) > > + if not DictLen: > > + DscOverride =3D False > > else: > > - SkuList =3D > > sorted(Pcd.SkuInfoList.keys()) > > - for Sku in SkuList: > > - SkuInfo =3D > > Pcd.SkuInfoList[Sku] > > - if > > SkuInfo.DefaultStoreDict: > > - DefaultStoreList =3D > > sorted(SkuInfo.DefaultStoreDict.keys()) > > - for DefaultStore in > > DefaultStoreList: > > - OverrideValues > =3D > > Pcd.SkuOverrideValues[Sku] > > - DscOverride =3D > > self.ParseStruct(OverrideValues[DefaultStore]) > > - if DscOverride: > > + if not Pcd.SkuInfoList: > > + OverrideValues =3D > > Pcd.SkuOverrideValues > > + if OverrideValues: > > + for Data in > > OverrideValues.values(): > > + Struct =3D > > list(Data.values()) > > + if Struct: > > + > > DscOverride =3D self.ParseStruct(Struct[0]) > > break > > - if DscOverride: > > - break > > - if DscOverride: > > + else: > > + SkuList =3D > > sorted(Pcd.SkuInfoList.keys()) > > + for Sku in SkuList: > > + SkuInfo =3D > > Pcd.SkuInfoList[Sku] > > + if > > SkuInfo.DefaultStoreDict: > > + > DefaultStoreList > > =3D sorted(SkuInfo.DefaultStoreDict.keys()) > > + for > DefaultStore > > in DefaultStoreList: > > + > > OverrideValues =3D Pcd.SkuOverrideValues[Sku] > > + > > DscOverride =3D self.ParseStruct(OverrideValues[DefaultStore]) > > + if > > DscOverride: > > + > break > > + if DscOverride: > > + break > > + if DscOverride: > > + DscDefaultValue =3D True > > + DscMatch =3D True > > + DecMatch =3D False > > + else: > > + DecMatch =3D True > > + else: > > DscDefaultValue =3D True > > DscMatch =3D True > > DecMatch =3D False > > - else: > > - DecMatch =3D True > > - else: > > - DscDefaultValue =3D True > > - DscMatch =3D True > > - DecMatch =3D False > > > > # > > # Report PCD item according to their override > > relationship > > # > > if Pcd.DatumType =3D=3D 'BOOLEAN': > > @@ -1151,17 +1159,18 @@ class PcdReport(object): > > elif InfDefaultValue and InfMatch: > > self.PrintPcdValue(File, Pcd, PcdTokenCName, > > TypeName, IsStructure, DscMatch, DscDefaultValBak, InfMatch, > > InfDefaultValue, DecMatch, DecDefaultValue, '*M') > > elif BuildOptionMatch: > > self.PrintPcdValue(File, Pcd, PcdTokenCName, > > TypeName, IsStructure, DscMatch, DscDefaultValBak, InfMatch, > > InfDefaultValue, DecMatch, DecDefaultValue, '*B') > > else: > > - if DscDefaultValue and DscMatch: > > + if PcdComponentValue: > > + self.PrintPcdValue(File, Pcd, > PcdTokenCName, > > TypeName, IsStructure, DscMatch, DscDefaultValBak, InfMatch, > > PcdComponentValue, DecMatch, DecDefaultValue, '*M', module_guid) > > + elif DscDefaultValue and DscMatch: > > if (Pcd.TokenCName, Key, Field) in > > self.FdfPcdSet: > > self.PrintPcdValue(File, Pcd, > > PcdTokenCName, TypeName, IsStructure, DscMatch, DscDefaultValBak, > > InfMatch, InfDefaultValue, DecMatch, DecDefaultValue, '*F') > > else: > > self.PrintPcdValue(File, Pcd, > > PcdTokenCName, TypeName, IsStructure, DscMatch, DscDefaultValBak, > > InfMatch, InfDefaultValue, DecMatch, DecDefaultValue, '*P') > > - else: > > - self.PrintPcdValue(File, Pcd, > PcdTokenCName, > > TypeName, IsStructure, DscMatch, DscDefaultValBak, InfMatch, > > InfDefaultValue, DecMatch, DecDefaultValue, '*M') > > + > > > > if ModulePcdSet is None: > > if IsStructure: > > continue > > if not TypeName in ('PATCH', 'FLAG', 'FIXED'): > > @@ -1263,11 +1272,11 @@ class PcdReport(object): > > self.PrintStructureInfo(File, filedvalues) > > if DecMatch and IsStructure: > > for filedvalues in Pcd.DefaultValues.values(): > > self.PrintStructureInfo(File, filedvalues) > > > > - def PrintPcdValue(self, File, Pcd, PcdTokenCName, TypeName, > > IsStructure, DscMatch, DscDefaultValue, InfMatch, InfDefaultValue, > DecMatch, > > DecDefaultValue, Flag =3D ' '): > > + def PrintPcdValue(self, File, Pcd, PcdTokenCName, TypeName, > > IsStructure, DscMatch, DscDefaultValue, InfMatch, InfDefaultValue, > DecMatch, > > DecDefaultValue, Flag =3D ' ',module_guid=3DNone): > > if not Pcd.SkuInfoList: > > Value =3D Pcd.DefaultValue > > IsByteArray, ArrayList =3D ByteArrayForamt(Value) > > if IsByteArray: > > FileWrite(File, ' %-*s : %6s %10s =3D %s' % > (self.MaxLen, > > Flag + ' ' + PcdTokenCName, TypeName, '(' + Pcd.DatumType + ')', '{')) > > @@ -1286,18 +1295,24 @@ class PcdReport(object): > > FiledOverrideFlag =3D False > > if (Pcd.TokenCName,Pcd.TokenSpaceGuidCName) in > > GlobalData.gPcdSkuOverrides: > > OverrideValues =3D > > > GlobalData.gPcdSkuOverrides[(Pcd.TokenCName,Pcd.TokenSpaceGuidCName) > > ] > > else: > > OverrideValues =3D Pcd.SkuOverrideValues > > + FieldOverrideValues =3D None > > if OverrideValues: > > for Data in OverrideValues.values(): > > Struct =3D list(Data.values()) > > if Struct: > > - OverrideFieldStruct =3D > > self.OverrideFieldValue(Pcd, Struct[0]) > > - self.PrintStructureInfo(File, > > OverrideFieldStruct) > > + FieldOverrideValues =3D Struct[0] > > FiledOverrideFlag =3D True > > break > > + if Pcd.PcdFiledValueFromDscComponent and > > module_guid and module_guid.replace("-","S") in > > Pcd.PcdFiledValueFromDscComponent: > > + FieldOverrideValues =3D > > Pcd.PcdFiledValueFromDscComponent[module_guid.replace("-","S")] > > + if FieldOverrideValues: > > + OverrideFieldStruct =3D self.OverrideFieldValue(P= cd, > > FieldOverrideValues) > > + self.PrintStructureInfo(File, OverrideFieldStruct= ) > > + > > if not FiledOverrideFlag and > > (Pcd.PcdFieldValueFromComm or Pcd.PcdFieldValueFromFdf): > > OverrideFieldStruct =3D > self.OverrideFieldValue(Pcd, > > {}) > > self.PrintStructureInfo(File, OverrideFieldStruct= ) > > self.PrintPcdDefault(File, Pcd, IsStructure, DscMatch, > > DscDefaultValue, InfMatch, InfDefaultValue, DecMatch, DecDefaultValue) > > else: > > -- > > 2.20.1.windows.1 > > > > > > > > > > >=20 >=20 >=20 >=20 >=20 >=20 >=20 >=20 >=20 >=20 >=20 >=20