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.115; helo=mga14.intel.com; envelope-from=zhiqiangx.zhao@intel.com; receiver=edk2-devel@lists.01.org Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (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 380C321129455 for ; Tue, 11 Sep 2018 18:41:41 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Sep 2018 18:41:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,362,1531810800"; d="scan'208";a="69293986" Received: from tiano-zzq.ccr.corp.intel.com ([10.239.49.10]) by fmsmga007.fm.intel.com with ESMTP; 11 Sep 2018 18:41:38 -0700 From: Zhaozh1x To: edk2-devel@lists.01.org Cc: Zhaozh1x , Liming Gao , Yonghong Zhu , Bob Feng Date: Wed, 12 Sep 2018 09:41:26 +0800 Message-Id: <20180912014126.16724-1-zhiqiangx.zhao@intel.com> X-Mailer: git-send-email 2.14.1.windows.1 Subject: [PATCH] BaseTools: pcd in commandLine. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Sep 2018 01:41:41 -0000 In command line, the latter full assign value in commandLine should override the former field assign value. For example, --pcd Token.pcd.field="" --pcd Token.pcd=H"{}". Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: ZhiqiangX Zhao Cc: Liming Gao Cc: Yonghong Zhu Cc: Bob Feng --- BaseTools/Source/Python/Workspace/DscBuildData.py | 17 +++++++++++++++++ BaseTools/Source/Python/build/BuildReport.py | 20 ++++++++++++++++---- 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/Source/Python/Workspace/DscBuildData.py index aaef404772..74cb135bbd 100644 --- a/BaseTools/Source/Python/Workspace/DscBuildData.py +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py @@ -1032,6 +1032,23 @@ class DscBuildData(PlatformBuildClassObject): PcdItem = BuildData.Pcds[key] if (TokenSpaceGuidCName, TokenCName) == (PcdItem.TokenSpaceGuidCName, PcdItem.TokenCName) and FieldName =="": PcdItem.DefaultValue = pcdvalue + #In command line, the latter full assign value in commandLine should override the former field assign value. + #For example, --pcd Token.pcd.field="" --pcd Token.pcd=H"{}" + delete_assign = [] + field_assign = {} + if GlobalData.BuildOptionPcd: + for pcdTuple in GlobalData.BuildOptionPcd: + TokenSpaceGuid, Token, Field = pcdTuple[0], pcdTuple[1], pcdTuple[2] + if Field: + if (TokenSpaceGuid, Token) not in field_assign: + field_assign[TokenSpaceGuid, Token] = [] + field_assign[TokenSpaceGuid, Token].append(pcdTuple) + else: + if (TokenSpaceGuid, Token) in field_assign: + delete_assign.extend(field_assign[TokenSpaceGuid, Token]) + field_assign[TokenSpaceGuid, Token] = [] + for item in delete_assign: + GlobalData.BuildOptionPcd.remove(item) @staticmethod def HandleFlexiblePcd(TokenSpaceGuidCName, TokenCName, PcdValue, PcdDatumType, GuidDict, FieldName=''): diff --git a/BaseTools/Source/Python/build/BuildReport.py b/BaseTools/Source/Python/build/BuildReport.py index a598d64244..3886a7a55e 100644 --- a/BaseTools/Source/Python/build/BuildReport.py +++ b/BaseTools/Source/Python/build/BuildReport.py @@ -982,12 +982,16 @@ class PcdReport(object): PcdValue = DecDefaultValue if DscDefaultValue: PcdValue = DscDefaultValue - Pcd.DefaultValue = PcdValue + #The DefaultValue of StructurePcd already be the latest, no need to update. + if not self.IsStructurePcd(Pcd.TokenCName, Pcd.TokenSpaceGuidCName): + Pcd.DefaultValue = PcdValue if ModulePcdSet is not None: if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName, Type) not in ModulePcdSet: continue InfDefaultValue, PcdValue = ModulePcdSet[Pcd.TokenCName, Pcd.TokenSpaceGuidCName, Type] - Pcd.DefaultValue = PcdValue + #The DefaultValue of StructurePcd already be the latest, no need to update. + if not self.IsStructurePcd(Pcd.TokenCName, Pcd.TokenSpaceGuidCName): + Pcd.DefaultValue = PcdValue if InfDefaultValue: try: InfDefaultValue = ValueExpressionEx(InfDefaultValue, Pcd.DatumType, self._GuidDict)(True) @@ -1003,7 +1007,9 @@ class PcdReport(object): if pcd[2]: continue PcdValue = pcd[3] - Pcd.DefaultValue = PcdValue + #The DefaultValue of StructurePcd already be the latest, no need to update. + if not self.IsStructurePcd(Pcd.TokenCName, Pcd.TokenSpaceGuidCName): + Pcd.DefaultValue = PcdValue BuildOptionMatch = True break @@ -1050,7 +1056,7 @@ class PcdReport(object): DscMatch = (DscDefaultValue.strip() == PcdValue.strip()) IsStructure = False - if GlobalData.gStructurePcd and (self.Arch in GlobalData.gStructurePcd) and ((Pcd.TokenCName, Pcd.TokenSpaceGuidCName) in GlobalData.gStructurePcd[self.Arch]): + if self.IsStructurePcd(Pcd.TokenCName, Pcd.TokenSpaceGuidCName): IsStructure = True if TypeName in ('DYNVPD', 'DEXVPD'): SkuInfoList = Pcd.SkuInfoList @@ -1413,6 +1419,12 @@ class PcdReport(object): else: return value + def IsStructurePcd(self, PcdToken, PcdTokenSpaceGuid): + if GlobalData.gStructurePcd and (self.Arch in GlobalData.gStructurePcd) and ((PcdToken, PcdTokenSpaceGuid) in GlobalData.gStructurePcd[self.Arch]): + return True + else: + return False + ## # Reports platform and module Prediction information # -- 2.14.1.windows.1