From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.65; helo=mga03.intel.com; envelope-from=yonghong.zhu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (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 6A13421DF9690 for ; Mon, 9 Oct 2017 06:38:27 -0700 (PDT) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Oct 2017 06:41:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,500,1500966000"; d="scan'208";a="321164337" Received: from shwdeopenpsi168.ccr.corp.intel.com ([10.239.158.121]) by fmsmga004.fm.intel.com with ESMTP; 09 Oct 2017 06:41:35 -0700 From: Yonghong Zhu To: edk2-devel@lists.01.org Cc: Liming Gao Date: Mon, 9 Oct 2017 21:41:31 +0800 Message-Id: <1507556491-16376-1-git-send-email-yonghong.zhu@intel.com> X-Mailer: git-send-email 2.6.1.windows.1 Subject: [Patch] BaseTools: Fix the bug 'DSC DEFAULT' in report wrongly use FDF value X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Oct 2017 13:38:27 -0000 current the PCD value in DSC file may be override by FDF file, then it cause the 'DSC DEFAULT' in build report wrongly display the FDF value but not the DSC file's value. This patch add a attribute DscDefaultValue for PcdClassObject to save the actual DSC file's PCD value and use this value to display for 'DSC DEFAULT'. Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yonghong Zhu --- BaseTools/Source/Python/Workspace/BuildClassObject.py | 7 +++++-- .../Source/Python/Workspace/WorkspaceDatabase.py | 19 +++++++++---------- BaseTools/Source/Python/build/BuildReport.py | 7 ++++--- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/BaseTools/Source/Python/Workspace/BuildClassObject.py b/BaseTools/Source/Python/Workspace/BuildClassObject.py index ea26e5e..5fa497b 100644 --- a/BaseTools/Source/Python/Workspace/BuildClassObject.py +++ b/BaseTools/Source/Python/Workspace/BuildClassObject.py @@ -1,9 +1,9 @@ ## @file # This file is used to define each component of the build database # -# Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.
# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at # http://opensource.org/licenses/bsd-license.php # @@ -42,11 +42,11 @@ from Common.BuildToolError import * # @var SkuInfoList: To store value for SkuInfoList # @var IsOverrided: To store value for IsOverrided # @var Phase: To store value for Phase, default is "DXE" # class PcdClassObject(object): - def __init__(self, Name = None, Guid = None, Type = None, DatumType = None, Value = None, Token = None, MaxDatumSize = None, SkuInfoList = {}, IsOverrided = False, GuidValue = None, validateranges = [], validlists = [], expressions = []): + def __init__(self, Name = None, Guid = None, Type = None, DatumType = None, Value = None, Token = None, MaxDatumSize = None, SkuInfoList = {}, IsOverrided = False, GuidValue = None, validateranges = [], validlists = [], expressions = [], IsDsc = False): self.TokenCName = Name self.TokenSpaceGuidCName = Guid self.TokenSpaceGuidValue = GuidValue self.Type = Type self.DatumType = DatumType @@ -60,10 +60,13 @@ class PcdClassObject(object): self.IsFromBinaryInf = False self.IsFromDsc = False self.validateranges = validateranges self.validlists = validlists self.expressions = expressions + self.DscDefaultValue = None + if IsDsc: + self.DscDefaultValue = Value ## Convert the class to a string # # Convert each member of the class to string # Organize to a signle line format string diff --git a/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py b/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py index b617221..2c4b973 100644 --- a/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py +++ b/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py @@ -883,12 +883,12 @@ class DscBuildData(PlatformBuildClassObject): PcdValue, '', MaxDatumSize, {}, False, - None - ) + None, + IsDsc=True) return Pcds ## Retrieve dynamic PCD settings # # @param Type PCD type @@ -948,13 +948,13 @@ class DscBuildData(PlatformBuildClassObject): PcdValue, '', MaxDatumSize, {SkuName : SkuInfo}, False, - None - ) - + None, + IsDsc=True) + for pcd in Pcds.values(): pcdDecObject = self._DecPcds[pcd.TokenCName,pcd.TokenSpaceGuidCName] if 'DEFAULT' not in pcd.SkuInfoList.keys() and 'COMMON' not in pcd.SkuInfoList.keys(): valuefromDec = pcdDecObject.DefaultValue SkuInfo = SkuInfoClass('DEFAULT', '0', '', '', '', '', '', valuefromDec) @@ -1067,13 +1067,12 @@ class DscBuildData(PlatformBuildClassObject): {SkuName : SkuInfo}, False, None, pcdDecObject.validateranges, pcdDecObject.validlists, - pcdDecObject.expressions - ) - + pcdDecObject.expressions, + IsDsc=True) for pcd in Pcds.values(): SkuInfoObj = pcd.SkuInfoList.values()[0] pcdDecObject = self._DecPcds[pcd.TokenCName,pcd.TokenSpaceGuidCName] # Only fix the value while no value provided in DSC file. @@ -1177,12 +1176,12 @@ class DscBuildData(PlatformBuildClassObject): InitialValue, '', MaxDatumSize, {SkuName : SkuInfo}, False, - None - ) + None, + IsDsc=True) for pcd in Pcds.values(): SkuInfoObj = pcd.SkuInfoList.values()[0] pcdDecObject = self._DecPcds[pcd.TokenCName,pcd.TokenSpaceGuidCName] if 'DEFAULT' not in pcd.SkuInfoList.keys() and 'COMMON' not in pcd.SkuInfoList.keys(): valuefromDec = pcdDecObject.DefaultValue diff --git a/BaseTools/Source/Python/build/BuildReport.py b/BaseTools/Source/Python/build/BuildReport.py index f0e9093..6a4d7e0 100644 --- a/BaseTools/Source/Python/build/BuildReport.py +++ b/BaseTools/Source/Python/build/BuildReport.py @@ -831,11 +831,11 @@ class PcdReport(object): # self.DscPcdDefault = {} for Arch in Wa.ArchList: Platform = Wa.BuildDatabase[Wa.MetaFile, Arch, Wa.BuildTarget, Wa.ToolChain] for (TokenCName, TokenSpaceGuidCName) in Platform.Pcds: - DscDefaultValue = Platform.Pcds[(TokenCName, TokenSpaceGuidCName)].DefaultValue + DscDefaultValue = Platform.Pcds[(TokenCName, TokenSpaceGuidCName)].DscDefaultValue if DscDefaultValue: self.DscPcdDefault[(TokenCName, TokenSpaceGuidCName)] = DscDefaultValue def GenerateReport(self, File, ModulePcdSet): if self.ConditionalPcds: @@ -912,10 +912,11 @@ class PcdReport(object): # # Get PCD default value and their override relationship # DecDefaultValue = self.DecPcdDefault.get((Pcd.TokenCName, Pcd.TokenSpaceGuidCName, DecType)) DscDefaultValue = self.DscPcdDefault.get((Pcd.TokenCName, Pcd.TokenSpaceGuidCName)) + DscDefaultValBak= DscDefaultValue DscDefaultValue = self.FdfPcdSet.get((Pcd.TokenCName, Key), DscDefaultValue) InfDefaultValue = None PcdValue = DecDefaultValue if DscDefaultValue: @@ -998,12 +999,12 @@ class PcdReport(object): if TypeName in ('DYNHII', 'DEXHII'): FileWrite(File, '%*s: %s: %s' % (self.MaxLen + 4, SkuInfo.VariableGuid, SkuInfo.VariableName, SkuInfo.VariableOffset)) else: FileWrite(File, '%*s' % (self.MaxLen + 4, SkuInfo.VpdOffset)) - if not DscMatch and DscDefaultValue != None: - FileWrite(File, ' %*s = %s' % (self.MaxLen + 19, 'DSC DEFAULT', DscDefaultValue.strip())) + if not DscMatch and DscDefaultValBak != None: + FileWrite(File, ' %*s = %s' % (self.MaxLen + 19, 'DSC DEFAULT', DscDefaultValBak.strip())) if not InfMatch and InfDefaultValue != None: FileWrite(File, ' %*s = %s' % (self.MaxLen + 19, 'INF DEFAULT', InfDefaultValue.strip())) if not DecMatch and DecDefaultValue != None: -- 2.6.1.windows.1