From mboxrd@z Thu Jan 1 00:00:00 1970 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 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=MqP0K7BW; spf=pass (domain: intel.com, ip: 192.55.52.115, mailfrom: yi1.li@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1646723258; x=1678259258; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=lUaJWaQzLF42unT3/mfg/ES9X4P5Vl/w6JcJfpWlpDs=; b=MqP0K7BWCkV4Lbs5uTvRtAB4OpbvBG7H5q9jDAGJCOt/2onvX8hyt97G WYBYomZsRhFlPmnTdWfLIEhv6y4ch2YsmQdq9zStTKZISMpQnNEdwiF2v Ji5hj1cNll6I8klidd8of+GP18sMTMUlnEYq9db1CYo+HgeHOGY62SK5q oAN7kZT6W7wnLY4ss1gYeTXozlvn9kS4pWNU83mJ3s5mJidQKQFL58cX/ CKCM2Zhv09OfY8/BMq2Z5QY4fWYsnZjPFvOpgGN6X5Hb4G1p8gjmRg2Ou eiNHkmArBWFaKqX08hlxhB0gQubmkSPQukAB88bjGMeesD9PxP+PRk3iF Q==; 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" 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" 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: [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> X-Mailer: git-send-email 2.33.0.windows.2 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit REF:https://bugzilla.tianocore.org/show_bug.cgi?id=1446 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 = Record[-1] ToolChainFamily = Record[1] - TagName = Record[2] - ToolCode = Record[3] - + # OptionsList := [TagName, ToolCode, FeatureFlag] + OptionsList = ['','',''] + TokenList = GetSplitValueList(Record[2], TAB_VALUE_SPLIT) + for Index in range(len(TokenList)): + OptionsList[Index] = TokenList[Index] + if OptionsList[2]: + FeaturePcdExpression = self.CheckFeatureFlagPcd(OptionsList[2]) + if not FeaturePcdExpression: + continue File = PathClass(NormPath(Record[0], Macros), self._ModuleDir, '', - '', False, self._Arch, ToolChainFamily, '', TagName, ToolCode) + '', False, self._Arch, ToolChainFamily, '', OptionsList[0], OptionsList[1]) # check the file validation ErrorCode, ErrorInfo = File.Validate() if ErrorCode != 0: @@ -1067,7 +1073,7 @@ class InfBuildData(ModuleBuildClassObject): return True return False def CheckFeatureFlagPcd(self,Instance): - Pcds = GlobalData.gPlatformFinalPcds[self.Arch].copy() + Pcds = self._GetPcd(MODEL_PCD_FIXED_AT_BUILD) if PcdPattern.search(Instance): PcdTuple = tuple(Instance.split('.')[::-1]) if PcdTuple in self.Pcds: diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py b/BaseTools/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 = 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] = TokenList[2] + '|' + TokenList[extraToken] self._ValueList[0:len(TokenList)] = TokenList Macros = self._Macros # For Acpi tables, remove macro like ' TABLE_NAME=Sata1' -- 2.33.0.windows.2