public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Yonghong Zhu <yonghong.zhu@intel.com>
To: edk2-devel@lists.01.org
Cc: Liming Gao <liming.gao@intel.com>
Subject: [Patch] BaseTools: Fix the bug 'DSC DEFAULT' in report wrongly use FDF value
Date: Mon,  9 Oct 2017 21:41:31 +0800	[thread overview]
Message-ID: <1507556491-16376-1-git-send-email-yonghong.zhu@intel.com> (raw)

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 <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
---
 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



             reply	other threads:[~2017-10-09 13:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-09 13:41 Yonghong Zhu [this message]
  -- strict thread matches above, loose matches on Subject: below --
2017-10-09 13:37 [Patch] BaseTools: Fix the bug 'DSC DEFAULT' in report wrongly use FDF value Yonghong Zhu
2017-10-11  4:48 ` Gao, Liming

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1507556491-16376-1-git-send-email-yonghong.zhu@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox