From nobody Sun May 19 01:43:15 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+87346+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+87346+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1646723256; cv=none; d=zohomail.com; s=zohoarc; b=OaH0sZNP8DauqmPiwg3i8exN20i2TPmSsQKAxQvay773AiPuXYfx9bNCU21d8ZvXbCOoqtRVncvHGJN04pqNKL3mDF/j18sWCNFAOwUIMsf5CCV26ZNglTHvL1wcpW36pKKpZahMZlMIyMIUZRchBBd/o9HTpGYh9sDGofKY48c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646723256; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=6QvJbHS7gvJ4K51ZuSy3NDXdGTOcyCOsZxWR2wh1GCE=; b=byNrMh+BVHakRO+BNM9uxmojU193lgZwzVOzRRP7Ju1FLv97dRgkVFZUB5s9ITmbVtTHq/xWSHYTWhZ3w5w4SPY1WKPw9cq2veyKfqSNPDIxhjHMob1hLXAUIWdgXy5+yngOGtmL04BI5a6DnABvT+WnnLGhK36vQOgAhwz0aPg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+87346+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 164672325628051.12602465877421; Mon, 7 Mar 2022 23:07:36 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id XPcHYY1788612x5vCJerf2xI; Mon, 07 Mar 2022 23:07:36 -0800 X-Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web10.5832.1646723252884649804 for ; Mon, 07 Mar 2022 23:07:36 -0800 X-IronPort-AV: E=McAfee;i="6200,9189,10279"; a="254802513" X-IronPort-AV: E=Sophos;i="5.90,163,1643702400"; d="scan'208";a="254802513" X-Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Mar 2022 23:07:35 -0800 X-IronPort-AV: E=Sophos;i="5.90,163,1643702400"; d="scan'208";a="643557466" X-Received: from shwdejointd178.ccr.corp.intel.com ([10.239.153.103]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Mar 2022 23:07:34 -0800 From: "yi1 li" To: devel@edk2.groups.io Cc: yi1 li , Bob Feng , Liming Gao , "Zhiju . Fan" Subject: [edk2-devel] [PATCH 1/2] BaseTools:Add the FeatureFlagExpression usage to the InfBuildData Date: Tue, 8 Mar 2022 15:07:10 +0800 Message-Id: <97c2871bf6a8465868120cac39f45b051d61f16c.1646721943.git.yi1.li@intel.com> In-Reply-To: References: MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,yi1.li@intel.com X-Gm-Message-State: kyhgebKOkETWCXgjGvOtNjD7x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1646723256; bh=hxglxom+FQ2OtYTZvtuV7e6tPF52hcNmlJpDaRUdVEw=; h=Cc:Date:From:Reply-To:Subject:To; b=FqkclgTnS8uucJUXmrkczSdwRHy4Njct+5jVtK+wVgbhrDhooK8cc/Nn23vCms4DARO GVdg29s83FYCapT2H4DFMN5v3xn8zkhMhOqEDXs9r9rz8h69Peioe/DYMLCUhcbMTp/qf CtqNNZe58jdPlIFPaNStcfkTdF3W20GDkYc= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1646723257873100005 Content-Type: text/plain; charset="utf-8" REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D1446 FeatureFlagExpression Support in LibraryClasses/Guids/Ppi/Protocols section of INF file. The Pcd value in the expression is from INF or DEC When a FeatureFlagExpression is present,if the expression evaluates to TRUE,then the entry is valid. If the expression evaluates to FALSE, then the EDK II build tools must ignore the entry. This patch is going to add this feature. Cc: Bob Feng Cc: Liming Gao Signed-off-by: yi1 li Signed-off-by: Zhiju.Fan --- BaseTools/Source/Python/Common/Expression.py | 2 +- BaseTools/Source/Python/Common/GlobalData.py | 1 + .../Source/Python/Workspace/InfBuildData.py | 65 +++++++++++++++++-- .../Python/Workspace/WorkspaceCommon.py | 10 ++- 4 files changed, 70 insertions(+), 8 deletions(-) diff --git a/BaseTools/Source/Python/Common/Expression.py b/BaseTools/Sourc= e/Python/Common/Expression.py index 07ca039a9cf3..31bf0e4b6cf7 100644 --- a/BaseTools/Source/Python/Common/Expression.py +++ b/BaseTools/Source/Python/Common/Expression.py @@ -43,7 +43,7 @@ ERR_IN_OPERAND =3D 'Macro after IN operator can = only be: $(FAMILY), $(ARC __ValidString =3D re.compile(r'[_a-zA-Z][_0-9a-zA-Z]*$') _ReLabel =3D re.compile('LABEL\((\w+)\)') _ReOffset =3D re.compile('OFFSET_OF\((\w+)\)') -PcdPattern =3D re.compile(r'[_a-zA-Z][0-9A-Za-z_]*\.[_a-zA-Z][0-9A-Za-z_]*= $') +PcdPattern =3D re.compile(r'^[_a-zA-Z][0-9A-Za-z_]*\.[_a-zA-Z][0-9A-Za-z_]= *$') =20 ## SplitString # Split string to list according double quote diff --git a/BaseTools/Source/Python/Common/GlobalData.py b/BaseTools/Sourc= e/Python/Common/GlobalData.py index 61ab3f7e24cd..197bd8366682 100755 --- a/BaseTools/Source/Python/Common/GlobalData.py +++ b/BaseTools/Source/Python/Common/GlobalData.py @@ -18,6 +18,7 @@ gGlobalDefines =3D {} gPlatformDefines =3D {} # PCD name and value pair for fixed at build and feature flag gPlatformPcds =3D {} +gPlatformFinalPcds =3D {} # PCDs with type that are not fixed at build and feature flag gPlatformOtherPcds =3D {} gActivePlatform =3D None diff --git a/BaseTools/Source/Python/Workspace/InfBuildData.py b/BaseTools/= Source/Python/Workspace/InfBuildData.py index 45b8ef4716dd..9643bf17ac63 100644 --- a/BaseTools/Source/Python/Workspace/InfBuildData.py +++ b/BaseTools/Source/Python/Workspace/InfBuildData.py @@ -14,6 +14,7 @@ from types import * from .MetaFileParser import * from collections import OrderedDict from Workspace.BuildClassObject import ModuleBuildClassObject, LibraryClas= sObject, PcdClassObject +from Common.Expression import ValueExpressionEx, PcdPattern =20 ## Get Protocol value from given packages # @@ -554,6 +555,9 @@ class InfBuildData(ModuleBuildClassObject): Instance =3D Record[1] if Instance: Instance =3D NormPath(Instance, self._Macros) + FeaturePcdExpression =3D self.CheckFeatureFlagPcd(Instance) + if not FeaturePcdExpression: + continue RetVal[Lib] =3D Instance else: RetVal[Lib] =3D None @@ -584,6 +588,10 @@ class InfBuildData(ModuleBuildClassObject): self._ProtocolComments =3D OrderedDict() RecordList =3D self._RawData[MODEL_EFI_PROTOCOL, self._Arch, self.= _Platform] for Record in RecordList: + if Record[1]: + FeaturePcdExpression =3D self.CheckFeatureFlagPcd(Record[1= ]) + if not FeaturePcdExpression: + continue CName =3D Record[0] Value =3D _ProtocolValue(CName, self.Packages, self.MetaFile.P= ath) if Value is None: @@ -608,6 +616,10 @@ class InfBuildData(ModuleBuildClassObject): self._PpiComments =3D OrderedDict() RecordList =3D self._RawData[MODEL_EFI_PPI, self._Arch, self._Plat= form] for Record in RecordList: + if Record[1]: + FeaturePcdExpression =3D self.CheckFeatureFlagPcd(Record[1= ]) + if not FeaturePcdExpression: + continue CName =3D Record[0] Value =3D _PpiValue(CName, self.Packages, self.MetaFile.Path) if Value is None: @@ -631,7 +643,12 @@ class InfBuildData(ModuleBuildClassObject): RetVal =3D OrderedDict() self._GuidComments =3D OrderedDict() RecordList =3D self._RawData[MODEL_EFI_GUID, self._Arch, self._Pla= tform] + RetVal.update(self.GetGuidsUsedByPcd()) for Record in RecordList: + if Record[1]: + FeaturePcdExpression =3D self.CheckFeatureFlagPcd(Record[1= ]) + if not FeaturePcdExpression: + continue CName =3D Record[0] Value =3D GuidValue(CName, self.Packages, self.MetaFile.Path) if Value is None: @@ -860,7 +877,12 @@ class InfBuildData(ModuleBuildClassObject): def GetGuidsUsedByPcd(self): self.Guid return self._GuidsUsedByPcd - + @cached_class_function + def GetGuidDict(self): + GuidDict =3D OrderedDict() + for Package in self.Packages: + GuidDict.update(Package.Guids) + return GuidDict ## Retrieve PCD for given type def _GetPcd(self, Type): Pcds =3D OrderedDict() @@ -877,7 +899,6 @@ class InfBuildData(ModuleBuildClassObject): self._PcdComments[TokenSpaceGuid, PcdCName] =3D Comments =20 # resolve PCD type, value, datum info, etc. by getting its definit= ion from package - _GuidDict =3D self.Guids.copy() for PcdCName, TokenSpaceGuid in PcdList: PcdRealName =3D PcdCName Setting, LineNo =3D PcdDict[self._Arch, self.Platform, PcdCNam= e, TokenSpaceGuid] @@ -895,7 +916,7 @@ class InfBuildData(ModuleBuildClassObject): '', {}, False, - self.Guids[TokenSpaceGuid] + self.GetGuidDict()[TokenSpaceGuid] ) if Type =3D=3D MODEL_PCD_PATCHABLE_IN_MODULE and ValueList[1]: # Patch PCD: TokenSpace.PcdCName|Value|Offset @@ -931,7 +952,6 @@ class InfBuildData(ModuleBuildClassObject): # # TAB_PCDS_FIXED_AT_BUILD, TAB_PCDS_PATCHABLE_IN_MODULE,= TAB_PCDS_FEATURE_FLAG, TAB_PCDS_DYNAMIC, TAB_PCDS_DYNAMIC_EX # - _GuidDict.update(Package.Guids) PcdType =3D self._PCD_TYPE_STRING_[Type] if Type =3D=3D MODEL_PCD_DYNAMIC: Pcd.Pending =3D True @@ -1023,7 +1043,7 @@ class InfBuildData(ModuleBuildClassObject): Pcd.DefaultValue =3D PcdInPackage.DefaultValue else: try: - Pcd.DefaultValue =3D ValueExpressionEx(Pcd.Def= aultValue, Pcd.DatumType, _GuidDict)(True) + Pcd.DefaultValue =3D ValueExpressionEx(Pcd.Def= aultValue, Pcd.DatumType, self.GetGuidDict())(True) except BadExpression as Value: EdkLogger.error('Parser', FORMAT_INVALID, 'PCD= [%s.%s] Value "%s", %s' %(TokenSpaceGuid, PcdRealName, Pcd.DefaultValue, V= alue), File=3Dself.MetaFile, Line=3DL= ineNo) @@ -1046,6 +1066,41 @@ class InfBuildData(ModuleBuildClassObject): if (self.Binaries and not self.Sources) or GlobalData.gIgnoreSourc= e: return True return False + def CheckFeatureFlagPcd(self,Instance): + Pcds =3D GlobalData.gPlatformFinalPcds[self.Arch].copy() + if PcdPattern.search(Instance): + PcdTuple =3D tuple(Instance.split('.')[::-1]) + if PcdTuple in self.Pcds: + if not (self.Pcds[PcdTuple].Type =3D=3D 'FeatureFlag' or s= elf.Pcds[PcdTuple].Type =3D=3D 'FixedAtBuild') and Instance not in Pcds: + EdkLogger.error('build', FORMAT_INVALID, + "\nit must be defined in a [PcdsFeatur= eFlag] or [PcdsFixedAtBuild] section of Dsc or Dec file or [FeaturePcd] or = [FixedPcd] of Inf file", + File=3Dstr(self), ExtraData=3DInstance) + Pcds[Instance] =3D self.Pcds[PcdTuple].DefaultValue + if Instance in Pcds: + if Pcds[Instance] =3D=3D '0': + return False + elif Pcds[Instance] =3D=3D '1': + return True + try: + Value =3D ValueExpression(Instance, Pcds)() + if Value =3D=3D True: + return True + return False + except: + EdkLogger.warn('build', FORMAT_INVALID,"The FeatureFlagExp= ression cannot be evaluated", File=3Dstr(self), ExtraData=3DInstance) + return False + else: + for Name, Guid in self.Pcds: + if self.Pcds[(Name, Guid)].Type =3D=3D 'FeatureFlag' or se= lf.Pcds[(Name, Guid)].Type =3D=3D 'FixedAtBuild': + Pcds['%s.%s' % (Guid, Name)] =3D self.Pcds[(Name, Guid= )].DefaultValue + try: + Value =3D ValueExpression(Instance, Pcds)() + if Value =3D=3D True: + return True + return False + except: + EdkLogger.warn('build', FORMAT_INVALID, "The FeatureFlagEx= pression cannot be evaluated", File=3Dstr(self), ExtraData=3DInstance) + return False def ExtendCopyDictionaryLists(CopyToDict, CopyFromDict): for Key in CopyFromDict: CopyToDict[Key].extend(CopyFromDict[Key]) diff --git a/BaseTools/Source/Python/Workspace/WorkspaceCommon.py b/BaseToo= ls/Source/Python/Workspace/WorkspaceCommon.py index 53027a0e30f5..03e31bacfb51 100644 --- a/BaseTools/Source/Python/Workspace/WorkspaceCommon.py +++ b/BaseTools/Source/Python/Workspace/WorkspaceCommon.py @@ -42,8 +42,9 @@ def GetPackageList(Platform, BuildDatabase, Arch, Target,= Toolchain): for ModuleFile in Platform.Modules: Data =3D BuildDatabase[ModuleFile, Arch, Target, Toolchain] PkgSet.update(Data.Packages) - for Lib in GetLiabraryInstances(Data, Platform, BuildDatabase, Arc= h, Target, Toolchain): - PkgSet.update(Lib.Packages) + for ModuleFile in Platform.LibraryInstances: + Data =3D BuildDatabase[ModuleFile, Arch, Target, Toolchain] + PkgSet.update(Data.Packages) return list(PkgSet) =20 ## Get all declared PCD from platform for specified arch, target and toolc= hain @@ -75,6 +76,11 @@ def GetDeclaredPcd(Platform, BuildDatabase, Arch, Target= , Toolchain, additionalP break if (PcdCName, PcdTokenName) not in DecPcds: DecPcds[PcdCName, PcdTokenName] =3D Pkg.Pcds[Pcd] + if not GlobalData.gPlatformFinalPcds.get(Arch): + GlobalData.gPlatformFinalPcds[Arch] =3D OrderedDict() + for Name,Guid in DecPcds: + if DecPcds[Name,Guid].Type =3D=3D 'FeatureFlag' or DecPcds[Name,Gu= id].Type =3D=3D 'FixedAtBuild': + GlobalData.gPlatformFinalPcds[Arch]['%s.%s'%(Guid,Name)]=3DDec= Pcds[Name,Guid].DefaultValue return DecPcds, GuidDict =20 ## Get all dependent libraries for a module --=20 2.33.0.windows.2 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#87346): https://edk2.groups.io/g/devel/message/87346 Mute This Topic: https://groups.io/mt/89632330/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Sun May 19 01:43:15 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+87347+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+87347+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1646723259; cv=none; d=zohomail.com; s=zohoarc; b=XJ4gJo8E1CSoa4+5fLkVQHeePhcN04dp9u9SZ8U9QWjqFeA1M6WuHcJNyTcXBAZnfueComlK/3op0wUEWcYMJzT4C3A4q66uAQZT58exqB5BNGzdiWIQkPcAH4eu1YhJsI8NY8dDhveVzHPsv6cR5/OiNgoVQXRg7+qaCn9cpqc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646723259; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=ve4Xp5gyGdHFJv/HWbKnAbQi2goesu6Uc7De5LcRguI=; b=VuC3n+kIN5jHwmlqHNUcrR826wOvpyzuULTIBWpjtYUbBm59JQsOEp6GIZiZqJsG2tTuYjeucU8XgBDiS1Lb7hPpt2Wo+L0qkED23SlE0WDiYR3Q6sYnwTQDhDV0XHI7H4DqZHUOVOSXb9jJL+UJ7p7u329NfEEaBHiDzcT7Dok= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+87347+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1646723259592651.7867850953403; Mon, 7 Mar 2022 23:07:39 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id JXMvYY1788612xhI57XiPUcD; Mon, 07 Mar 2022 23:07:39 -0800 X-Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web10.5832.1646723252884649804 for ; Mon, 07 Mar 2022 23:07:38 -0800 X-IronPort-AV: E=McAfee;i="6200,9189,10279"; a="254802534" X-IronPort-AV: E=Sophos;i="5.90,163,1643702400"; d="scan'208";a="254802534" X-Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Mar 2022 23:07:38 -0800 X-IronPort-AV: E=Sophos;i="5.90,163,1643702400"; d="scan'208";a="643557486" X-Received: from shwdejointd178.ccr.corp.intel.com ([10.239.153.103]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Mar 2022 23:07:36 -0800 From: "yi1 li" To: devel@edk2.groups.io Cc: yi1 li , Bob Feng , Liming Gao , Heng Luo Subject: [edk2-devel] [PATCH 2/2] BaseTools:Add the FeatureFlagExpression usage to the Source Section Date: Tue, 8 Mar 2022 15:07:11 +0800 Message-Id: <4a24df439a87ae36383a0e14b0b46c4ef63db96c.1646721943.git.yi1.li@intel.com> In-Reply-To: References: MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,yi1.li@intel.com X-Gm-Message-State: 4t9afv4RuTmphrMV3hd09LDZx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1646723259; bh=LmjfnVd3zTLEnYSS47kfC0XvnYFO0uFQtlygtMNNrmI=; h=Cc:Date:From:Reply-To:Subject:To; b=ZEZZMuv9iwB/tStV2sZv6oyjksC6mET2JXw8nJxFq8+Jz0TutnjUMs2DM7YQEOS/YNs h9YxuWxjk5H5rkNQNhgJyPsYYsxKxbnW7I5PLhk1yfJgFI8uLYpb6SN7A7IooRGXaxbsr mkjrap//u1vxbnTUmnLNv6dBpEpgz+NMNUg= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1646723261748100001 Content-Type: text/plain; charset="utf-8" REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D1446 FeatureFlagExpression Support in Source section of INF file. The Pcd value in the expression is from INF or DEC. When a FeatureFlagExpression is present,if the expression evaluates to TRUE,then the entry is valid. If the expression evaluates to FALSE, then the EDK II build tools must ignore the entry. This patch is going to add this feature. Cc: Bob Feng Cc: Liming Gao Cc: Heng Luo Signed-off-by: yi1 li --- .../Source/Python/Workspace/InfBuildData.py | 16 +++++++++++----- .../Source/Python/Workspace/MetaFileParser.py | 4 ++++ 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/BaseTools/Source/Python/Workspace/InfBuildData.py b/BaseTools/= Source/Python/Workspace/InfBuildData.py index 9643bf17ac63..da5d3f0dc93c 100644 --- a/BaseTools/Source/Python/Workspace/InfBuildData.py +++ b/BaseTools/Source/Python/Workspace/InfBuildData.py @@ -529,11 +529,17 @@ class InfBuildData(ModuleBuildClassObject): for Record in RecordList: LineNo =3D Record[-1] ToolChainFamily =3D Record[1] - TagName =3D Record[2] - ToolCode =3D Record[3] - + # OptionsList :=3D [TagName, ToolCode, FeatureFlag] + OptionsList =3D ['','',''] + TokenList =3D GetSplitValueList(Record[2], TAB_VALUE_SPLIT) + for Index in range(len(TokenList)): + OptionsList[Index] =3D TokenList[Index] + if OptionsList[2]: + FeaturePcdExpression =3D self.CheckFeatureFlagPcd(OptionsL= ist[2]) + if not FeaturePcdExpression: + continue File =3D PathClass(NormPath(Record[0], Macros), self._ModuleDi= r, '', - '', False, self._Arch, ToolChainFamily, '', T= agName, ToolCode) + '', False, self._Arch, ToolChainFamily, '', O= ptionsList[0], OptionsList[1]) # check the file validation ErrorCode, ErrorInfo =3D File.Validate() if ErrorCode !=3D 0: @@ -1067,7 +1073,7 @@ class InfBuildData(ModuleBuildClassObject): return True return False def CheckFeatureFlagPcd(self,Instance): - Pcds =3D GlobalData.gPlatformFinalPcds[self.Arch].copy() + Pcds =3D self._GetPcd(MODEL_PCD_FIXED_AT_BUILD) if PcdPattern.search(Instance): PcdTuple =3D tuple(Instance.split('.')[::-1]) if PcdTuple in self.Pcds: diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py b/BaseTool= s/Source/Python/Workspace/MetaFileParser.py index a3b6edbd15ee..3508591b281e 100644 --- a/BaseTools/Source/Python/Workspace/MetaFileParser.py +++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py @@ -736,6 +736,10 @@ class InfParser(MetaFileParser): @ParseMacro def _SourceFileParser(self): TokenList =3D GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT) + # Let TokenList[2] be TagName|ToolCode|FeatureFlag + if len(TokenList) > 3: + for extraToken in range(3, len(TokenList)): + TokenList[2] =3D TokenList[2] + '|' + TokenList[extraToken] self._ValueList[0:len(TokenList)] =3D TokenList Macros =3D self._Macros # For Acpi tables, remove macro like ' TABLE_NAME=3DSata1' --=20 2.33.0.windows.2 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#87347): https://edk2.groups.io/g/devel/message/87347 Mute This Topic: https://groups.io/mt/89632331/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-