public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Feng, Bob C" <bob.c.feng@intel.com>
To: "Zhu, Yonghong" <yonghong.zhu@intel.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Subject: Re: [Patch V2] BaseTools: Fix a bug that HII type pcd value display extra 0x00
Date: Mon, 5 Mar 2018 07:06:18 +0000	[thread overview]
Message-ID: <08650203BA1BD64D8AD9B6D5D74A85D15537654A@SHSMSX101.ccr.corp.intel.com> (raw)
In-Reply-To: <1520232962-6664-1-git-send-email-yonghong.zhu@intel.com>

Reviewed-by: Feng, Bob C <bob.c.feng@intel.com> 

-----Original Message-----
From: Zhu, Yonghong 
Sent: Monday, March 05, 2018 2:56 PM
To: edk2-devel@lists.01.org
Cc: Feng, Bob C <bob.c.feng@intel.com>
Subject: [Patch V2] BaseTools: Fix a bug that HII type pcd value display extra 0x00

V2: Add Pcd.DatumType check.

Fix a bug that HII type Pcd value display in the report will have an extra 0x00, because original code use StringToArray function and it will judge whether the value length is a multiplier of 2, if not, it will change the value in Pcd Object and add an extra 0x00.

Cc: Bob Feng <bob.c.feng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
---
 BaseTools/Source/Python/AutoGen/AutoGen.py        | 7 ++++++-
 BaseTools/Source/Python/Workspace/DscBuildData.py | 6 +-----
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py
index 439e360..c8c042b 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -1329,11 +1329,16 @@ class PlatformAutoGen(AutoGen):
                     continue
                 if len(Sku.VariableName) > 0:
                     VariableGuidStructure = Sku.VariableGuidValue
                     VariableGuid = GuidStructureStringToGuidString(VariableGuidStructure)
                     for StorageName in Sku.DefaultStoreDict:
-                        VariableInfo.append_variable(var_info(Index,pcdname,StorageName,SkuName, StringToArray(Sku.VariableName),VariableGuid, Sku.VariableOffset, Sku.VariableAttribute , Sku.HiiDefaultValue,Sku.DefaultStoreDict[StorageName],Pcd.DatumType))
+                        HiiValue = Sku.HiiDefaultValue
+                        DefaultStoreVal= Sku.DefaultStoreDict[StorageName]
+                        if Pcd.DatumType not in [TAB_UINT8, TAB_UINT16, TAB_UINT32, TAB_UINT64, "BOOLEAN"]:
+                            HiiValue = StringToArray(Sku.HiiDefaultValue)
+                            DefaultStoreVal = StringToArray(Sku.DefaultStoreDict[StorageName])
+                        
+ VariableInfo.append_variable(var_info(Index,pcdname,StorageName,SkuNam
+ e, StringToArray(Sku.VariableName),VariableGuid, Sku.VariableOffset, 
+ Sku.VariableAttribute , HiiValue, DefaultStoreVal,Pcd.DatumType))
             Index += 1
         return VariableInfo
 
     def UpdateNVStoreMaxSize(self,OrgVpdFile):
         if self.VariableInfo:
diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/Source/Python/Workspace/DscBuildData.py
index 9d78770..fc7a307 100644
--- a/BaseTools/Source/Python/Workspace/DscBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
@@ -2513,17 +2513,13 @@ class DscBuildData(PlatformBuildClassObject):
             else:
                 MaxSize = 0
             if pcd.DatumType not in ['BOOLEAN','UINT8','UINT16','UINT32','UINT64']:
                 for (_, skuobj) in pcd.SkuInfoList.items():
                     datalen = 0
-                    skuobj.HiiDefaultValue = StringToArray(skuobj.HiiDefaultValue)
-                    datalen = len(skuobj.HiiDefaultValue.split(","))
+                    datalen = 
+ len((StringToArray(skuobj.HiiDefaultValue)).split(","))
                     if datalen > MaxSize:
                         MaxSize = datalen
-                    for defaultst in skuobj.DefaultStoreDict:
-                        skuobj.DefaultStoreDict[defaultst] = StringToArray(skuobj.DefaultStoreDict[defaultst])
-                pcd.DefaultValue = StringToArray(pcd.DefaultValue)
                 pcd.MaxDatumSize = str(MaxSize)
         rt, invalidhii = self.CheckVariableNameAssignment(Pcds)
         if not rt:
             invalidpcd = ",".join(invalidhii)
             EdkLogger.error('build', PCD_VARIABLE_INFO_ERROR, Message='The same HII PCD must map to the same EFI variable for all SKUs', File=self.MetaFile, ExtraData=invalidpcd)
--
2.6.1.windows.1



      reply	other threads:[~2018-03-05  7:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-05  6:56 [Patch V2] BaseTools: Fix a bug that HII type pcd value display extra 0x00 Yonghong Zhu
2018-03-05  7:06 ` Feng, Bob C [this message]

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=08650203BA1BD64D8AD9B6D5D74A85D15537654A@SHSMSX101.ccr.corp.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