From nobody Mon Apr 29 22:01:00 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail(p=none dis=none) header.from=intel.com Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1530775662672263.2271480791293; Thu, 5 Jul 2018 00:27:42 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id B93E0210C6430; Thu, 5 Jul 2018 00:27:41 -0700 (PDT) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (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 E6A3F202E541F for ; Thu, 5 Jul 2018 00:27:40 -0700 (PDT) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Jul 2018 00:27:40 -0700 Received: from shwdeopenpsi168.ccr.corp.intel.com ([10.239.158.129]) by orsmga003.jf.intel.com with ESMTP; 05 Jul 2018 00:27:35 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.93; helo=mga11.intel.com; envelope-from=yonghong.zhu@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,311,1526367600"; d="scan'208";a="64565073" From: Yonghong Zhu To: edk2-devel@lists.01.org Date: Thu, 5 Jul 2018 15:27:33 +0800 Message-Id: <1530775653-4856-1-git-send-email-yonghong.zhu@intel.com> X-Mailer: git-send-email 2.6.1.windows.1 Subject: [edk2] [Patch V2] BaseTools: enable FixedAtBuild (VOID*) PCD use in the [DEPEX] section X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" 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 # =20 self._FixedAtBuildPcds =3D [] self.ConstPcd =3D {} =20 + ##Store the VOID* type FixedAtBuild Pcds + # + self._FixedPcdVoidTypeDict =3D {} + def __repr__(self): return "%s [%s]" % (self.MetaFile, self.Arch) =20 # 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) =20 - return self._FixedAtBuildPcds =20 + 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.TokenSpa= ceGuidCName, Pcd.TokenCName)] =3D Pcd.DefaultValue + return self._FixedPcdVoidTypeDict =20 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 =20 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._FixedPcdVoidTypeDict: + EdkLogger.error("build", FORMAT_INVALI= D, "{} used in [Depex] section should be used as FixedAtBuild type and VOID= * datum type in the module.".format(item)) + else: + Value =3D self._FixedPcdVoidTypeDict[i= tem] + NewList.append(Value) + DepexList.extend(NewList) if DepexList[-1] =3D=3D 'END': # no need of a END= 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) =20 FixedAtBuildPcds =3D property(_GetFixedAtBuildPcds) UniqueBaseName =3D property(_GetUniqueBaseName) + FixedVoidTypePcds =3D property(_GetFixedAtBuildVoidTypePcds) =20 # This acts like the main() function for the script, unless it is 'import'= ed into another script. if __name__ =3D=3D '__main__': pass =20 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 * =20 ## 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("}", "").replace= (" ", "") GuidValueList =3D GuidValueString.split(",") + if len(GuidValueList) !=3D 11 and len(GuidValueList) =3D=3D 16: + GuidValueString =3D GuidStringToGuidStructureString(GuidStruct= ureByteArrayToGuidString(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)) =20 ## 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_AVAILABL= E, "Module is not found in active platform", ExtraData=3DToken, File=3Dself= .MetaFile, Line=3DRecord[-1]) DepexList.append(Module.Guid) else: - # get the GUID value now - Value =3D ProtocolValue(Token, self.Packages, self= .MetaFile.Path) - if Value is None: - Value =3D PpiValue(Token, self.Packages, self.= 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, s= elf.MetaFile.Path) + if Value is None: + Value =3D GuidValue(Token, self.Packag= es, self.MetaFile.Path) + if Value is None: PackageList =3D "\n\t".join(str(P) for P in se= lf.Packages) EdkLogger.error('build', RESOURCE_NOT_AVAILABL= E, "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/Sourc= e/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(Package.= 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(P= cdValue) + self._GuidDb[GuidValue.upper()] =3D Pcd =20 ## # Parse the binary dependency expression files. #=20 # This function parses the binary dependency expression file and trans= late it --=20 2.6.1.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel