Reviewed-by: Liming Gao <[email protected]> >-----Original Message----- >From: Zhu, Yonghong >Sent: Monday, October 09, 2017 9:37 PM >To: [email protected] >Cc: Gao, Liming <[email protected]> >Subject: [Patch] BaseTools: Fix the bug 'DSC DEFAULT' in report wrongly use >FDF value > >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 <[email protected]> >Contributed-under: TianoCore Contribution Agreement 1.1 >Signed-off-by: Yonghong Zhu <[email protected]> >--- > 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.<BR> >+# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR> > # 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
_______________________________________________ edk2-devel mailing list [email protected] https://lists.01.org/mailman/listinfo/edk2-devel

