From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.151; helo=mga17.intel.com; envelope-from=liming.gao@intel.com; receiver=edk2-devel@lists.01.org Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 26EBA209605D5 for ; Thu, 5 Jul 2018 19:06:57 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Jul 2018 19:06:57 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,314,1526367600"; d="scan'208";a="213802124" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by orsmga004.jf.intel.com with ESMTP; 05 Jul 2018 19:06:50 -0700 Received: from fmsmsx120.amr.corp.intel.com (10.18.124.208) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 5 Jul 2018 19:06:49 -0700 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by fmsmsx120.amr.corp.intel.com (10.18.124.208) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 5 Jul 2018 19:06:49 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.81]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.57]) with mapi id 14.03.0319.002; Fri, 6 Jul 2018 10:06:47 +0800 From: "Gao, Liming" To: "Zhu, Yonghong" , "edk2-devel@lists.01.org" Thread-Topic: [edk2] [Patch V2] BaseTools: enable FixedAtBuild (VOID*) PCD use in the [DEPEX] section Thread-Index: AQHUFDGual0VcWMOKU6VlLbTfg6FOaSBcCLA//96+4CAAIg58A== Date: Fri, 6 Jul 2018 02:06:46 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14E2B6E1A@SHSMSX104.ccr.corp.intel.com> References: <1530775653-4856-1-git-send-email-yonghong.zhu@intel.com> <4A89E2EF3DFEDB4C8BFDE51014F606A14E2B6DF3@SHSMSX104.ccr.corp.intel.com> In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [Patch V2] BaseTools: enable FixedAtBuild (VOID*) PCD use in the [DEPEX] section X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Jul 2018 02:06:58 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Yes. It is too late. The error message says the byte value is wrong. But, i= t doesn't mention which PCD is wrong. =20 >-----Original Message----- >From: Zhu, Yonghong >Sent: Friday, July 06, 2018 9:58 AM >To: Gao, Liming ; edk2-devel@lists.01.org >Cc: Zhu, Yonghong >Subject: RE: [edk2] [Patch V2] BaseTools: enable FixedAtBuild (VOID*) PCD >use in the [DEPEX] section > >In GetGuidValue() function it already have this logic to handle it. > >Best Regards, >Zhu Yonghong > > >-----Original Message----- >From: Gao, Liming >Sent: Friday, July 06, 2018 9:55 AM >To: Zhu, Yonghong ; edk2-devel@lists.01.org >Subject: RE: [edk2] [Patch V2] BaseTools: enable FixedAtBuild (VOID*) PCD >use in the [DEPEX] section > >Yonghong: > On error handling, could you check VOID* PCD length to make sure its siz= e is >16 when it is used in [Depex] section? > >Thanks >Liming >>-----Original Message----- >>From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of >>Yonghong Zhu >>Sent: Thursday, July 05, 2018 3:28 PM >>To: edk2-devel@lists.01.org >>Cc: Gao, Liming >>Subject: [edk2] [Patch V2] BaseTools: enable FixedAtBuild (VOID*) PCD >>use in the [DEPEX] section >> >>From: Yunhua Feng >> >>V2: limit the PCD used in the [Depex] section should be used in the >>module >> >>The PCD item used in INF [Depex] section must be defined as >>FixedAtBuild type and VOID* datum type, and the size of the PCD must be >16 bytes. >> >>Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=3D443 >>Cc: Liming Gao >>Cc: Yonghong Zhu >>Contributed-under: TianoCore Contribution Agreement 1.1 >>Signed-off-by: Yunhua Feng >>--- >> BaseTools/Source/Python/AutoGen/AutoGen.py | 31 >>++++++++++++++++++++--- >> BaseTools/Source/Python/AutoGen/GenDepex.py | 6 +++++ >> BaseTools/Source/Python/Workspace/InfBuildData.py | 15 +++++++---- >> BaseTools/Source/Python/build/BuildReport.py | 6 +++++ >> 4 files changed, 50 insertions(+), 8 deletions(-) >> >>diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py >>b/BaseTools/Source/Python/AutoGen/AutoGen.py >>index 6d76afd..7d4539e 100644 >>--- a/BaseTools/Source/Python/AutoGen/AutoGen.py >>+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py >>@@ -2745,10 +2745,14 @@ class ModuleAutoGen(AutoGen): >> ## Store the FixedAtBuild Pcds >> # >> self._FixedAtBuildPcds =3D [] >> self.ConstPcd =3D {} >> >>+ ##Store the VOID* type FixedAtBuild Pcds >>+ # >>+ self._FixedPcdVoidTypeDict =3D {} >>+ >> def __repr__(self): >> return "%s [%s]" % (self.MetaFile, self.Arch) >> >> # Get FixedAtBuild Pcds of this Module >> def _GetFixedAtBuildPcds(self): >>@@ -2758,11 +2762,20 @@ class ModuleAutoGen(AutoGen): >> if Pcd.Type !=3D TAB_PCDS_FIXED_AT_BUILD: >> continue >> if Pcd not in self._FixedAtBuildPcds: >> self._FixedAtBuildPcds.append(Pcd) >> >>- return self._FixedAtBuildPcds >>+ return self._FixedAtBuildPcds >>+ >>+ def _GetFixedAtBuildVoidTypePcds(self): >>+ if self._FixedPcdVoidTypeDict: >>+ return self._FixedPcdVoidTypeDict >>+ for Pcd in self.ModulePcdList: >>+ if Pcd.Type =3D=3D TAB_PCDS_FIXED_AT_BUILD and Pcd.DatumType >>+ =3D=3D >>TAB_VOID: >>+ if '{}.{}'.format(Pcd.TokenSpaceGuidCName, >>+ Pcd.TokenCName) not >>in self._FixedPcdVoidTypeDict: >>+ >>self._FixedPcdVoidTypeDict['{}.{}'.format(Pcd.TokenSpaceGuidCName, >>Pcd.TokenCName)] =3D Pcd.DefaultValue >>+ return self._FixedPcdVoidTypeDict >> >> def _GetUniqueBaseName(self): >> BaseName =3D self.Name >> for Module in self.PlatformInfo.ModuleAutoGenList: >> if Module.MetaFile =3D=3D self.MetaFile: >>@@ -3029,11 +3042,11 @@ class ModuleAutoGen(AutoGen): >> self._DepexDict =3D {} >> if self.DxsFile or self.IsLibrary or >>TAB_DEPENDENCY_EXPRESSION_FILE in self.FileTypes: >> return self._DepexDict >> >> self._DepexDict[self.ModuleType] =3D [] >>- >>+ self._GetFixedAtBuildVoidTypePcds() >> for ModuleType in self._DepexDict: >> DepexList =3D self._DepexDict[ModuleType] >> # >> # Append depex from dependent libraries, if not "BEFORE"= , "AFTER" >>expresion >> # >>@@ -3041,11 +3054,22 @@ class ModuleAutoGen(AutoGen): >> Inherited =3D False >> for D in M.Depex[self.Arch, ModuleType]: >> if DepexList !=3D []: >> DepexList.append('AND') >> DepexList.append('(') >>- DepexList.extend(D) >>+ #replace D with value if D is FixedAtBuild PCD >>+ NewList =3D [] >>+ for item in D: >>+ if '.' not in item: >>+ NewList.append(item) >>+ else: >>+ if item not in self._FixedPcdVoidTypeDic= t: >>+ EdkLogger.error("build", >>+ FORMAT_INVALID, "{} used in >>[Depex] section should be used as FixedAtBuild type and VOID* datum >>type in the module.".format(item)) >>+ else: >>+ Value =3D self._FixedPcdVoidTypeDict= [item] >>+ NewList.append(Value) >>+ DepexList.extend(NewList) >> if DepexList[-1] =3D=3D 'END': # no need of a E= ND at this time >> DepexList.pop() >> DepexList.append(')') >> Inherited =3D True >> if Inherited: >>@@ -4409,10 +4433,11 @@ class ModuleAutoGen(AutoGen): >> BuildOptionIncPathList =3D property(_GetBuildOptionIncPathList) >> BuildCommand =3D property(_GetBuildCommand) >> >> FixedAtBuildPcds =3D property(_GetFixedAtBuildPcds) >> UniqueBaseName =3D property(_GetUniqueBaseName) >>+ FixedVoidTypePcds =3D property(_GetFixedAtBuildVoidTypePcds) >> >> # This acts like the main() function for the script, unless it is >>'import'ed into another script. >> if __name__ =3D=3D '__main__': >> pass >> >>diff --git a/BaseTools/Source/Python/AutoGen/GenDepex.py >>b/BaseTools/Source/Python/AutoGen/GenDepex.py >>index d3b1eae..c12b613 100644 >>--- a/BaseTools/Source/Python/AutoGen/GenDepex.py >>+++ b/BaseTools/Source/Python/AutoGen/GenDepex.py >>@@ -20,10 +20,12 @@ from Common.LongFilePathSupport import >>OpenLongFilePath as open from io import BytesIO from struct import >>pack from Common.BuildToolError import * from Common.Misc import >>SaveFileOnChange from Common.Misc import >>GuidStructureStringToGuidString >>+from Common.Misc import GuidStructureByteArrayToGuidString >>+from Common.Misc import GuidStringToGuidStructureString >> from Common import EdkLogger as EdkLogger from Common.BuildVersion >> import gBUILD_VERSION from Common.DataType import * >> >> ## Regular expression for matching "DEPENDENCY_START ... >>DEPENDENCY_END" >>@@ -331,10 +333,14 @@ class DependencyExpression: >> # @retval array The byte array representing the GUID value >> # >> def GetGuidValue(self, Guid): >> GuidValueString =3D Guid.replace("{", "").replace("}", "").repla= ce(" ", "") >> GuidValueList =3D GuidValueString.split(",") >>+ if len(GuidValueList) !=3D 11 and len(GuidValueList) =3D=3D 16: >>+ GuidValueString =3D >>GuidStringToGuidStructureString(GuidStructureByteArrayToGuidString(Guid >>)) >>+ GuidValueString =3D GuidValueString.replace("{", >>+ "").replace("}", >>"").replace(" ", "") >>+ GuidValueList =3D GuidValueString.split(",") >> if len(GuidValueList) !=3D 11: >> EdkLogger.error("GenDepex", PARSER_ERROR, "Invalid GUID >>value string or opcode: %s" % Guid) >> return pack("1I2H8B", *(int(value, 16) for value in >>GuidValueList)) >> >> ## Save the binary form of dependency expression in file diff >>--git a/BaseTools/Source/Python/Workspace/InfBuildData.py >>b/BaseTools/Source/Python/Workspace/InfBuildData.py >>index 165e03f..efb3de1 100644 >>--- a/BaseTools/Source/Python/Workspace/InfBuildData.py >>+++ b/BaseTools/Source/Python/Workspace/InfBuildData.py >>@@ -909,16 +909,21 @@ class InfBuildData(ModuleBuildClassObject): >> if Module is None: >> EdkLogger.error('build', >>RESOURCE_NOT_AVAILABLE, "Module is not found in active platform", >> ExtraData=3DToken, File=3Dse= lf.MetaFile, Line=3DRecord[-1]) >> DepexList.append(Module.Guid) >> else: >>- # get the GUID value now >>- Value =3D ProtocolValue(Token, self.Packages, se= lf.MetaFile.Path) >>- if Value is None: >>- Value =3D PpiValue(Token, self.Packages, sel= f.MetaFile.Path) >>+ # it use the Fixed PCD format >>+ if '.' in Token: >>+ Value =3D Token >>+ else: >>+ # get the GUID value now >>+ Value =3D ProtocolValue(Token, >>+ self.Packages, >>self.MetaFile.Path) >> if Value is None: >>- Value =3D GuidValue(Token, self.Packages= , self.MetaFile.Path) >>+ Value =3D PpiValue(Token, self.Packages,= self.MetaFile.Path) >>+ if Value is None: >>+ Value =3D GuidValue(Token, >>+ self.Packages, >>self.MetaFile.Path) >>+ >> if Value is None: >> PackageList =3D "\n\t".join(str(P) for P in = self.Packages) >> EdkLogger.error('build', RESOURCE_NOT_AVAILA= BLE, >> "Value of [%s] is not found = in" % Token, >> ExtraData=3DPackageList, >>File=3Dself.MetaFile, >>Line=3DRecord[-1]) >>diff --git a/BaseTools/Source/Python/build/BuildReport.py >>b/BaseTools/Source/Python/build/BuildReport.py >>index 897167c..0dbbba0 100644 >>--- a/BaseTools/Source/Python/build/BuildReport.py >>+++ b/BaseTools/Source/Python/build/BuildReport.py >>@@ -278,10 +278,16 @@ class DepexParser(object): >> GuidValue =3D GuidStructureStringToGuidString(Packag= e.Ppis[Ppi]) >> self._GuidDb[GuidValue.upper()] =3D Ppi >> for Guid in Package.Guids: >> GuidValue =3D >GuidStructureStringToGuidString(Package.Guids[Guid]) >> self._GuidDb[GuidValue.upper()] =3D Guid >>+ for Ma in Pa.ModuleAutoGenList: >>+ for Pcd in Ma.FixedVoidTypePcds: >>+ PcdValue =3D Ma.FixedVoidTypePcds[Pcd] >>+ if len(PcdValue.split(',')) =3D=3D 16: >>+ GuidValue =3D GuidStructureByteArrayToGuidString= (PcdValue) >>+ self._GuidDb[GuidValue.upper()] =3D Pcd >> >> ## >> # Parse the binary dependency expression files. >> # >> # This function parses the binary dependency expression file and >>translate it >>-- >>2.6.1.windows.1 >> >>_______________________________________________ >>edk2-devel mailing list >>edk2-devel@lists.01.org >>https://lists.01.org/mailman/listinfo/edk2-devel