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=bob.c.feng@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 258E42257C2CA for ; Sun, 4 Mar 2018 23:00:09 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Mar 2018 23:06:21 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.47,426,1515484800"; d="scan'208";a="208875772" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by fmsmga006.fm.intel.com with ESMTP; 04 Mar 2018 23:06:20 -0800 Received: from fmsmsx155.amr.corp.intel.com (10.18.116.71) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.319.2; Sun, 4 Mar 2018 23:06:20 -0800 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by FMSMSX155.amr.corp.intel.com (10.18.116.71) with Microsoft SMTP Server (TLS) id 14.3.319.2; Sun, 4 Mar 2018 23:06:20 -0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.253]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.125]) with mapi id 14.03.0319.002; Mon, 5 Mar 2018 15:06:18 +0800 From: "Feng, Bob C" To: "Zhu, Yonghong" , "edk2-devel@lists.01.org" Thread-Topic: [Patch V2] BaseTools: Fix a bug that HII type pcd value display extra 0x00 Thread-Index: AQHTtE8UmzQQ/WArNESLbo5QFMn+AqPBN/Xw Date: Mon, 5 Mar 2018 07:06:18 +0000 Message-ID: <08650203BA1BD64D8AD9B6D5D74A85D15537654A@SHSMSX101.ccr.corp.intel.com> References: <1520232962-6664-1-git-send-email-yonghong.zhu@intel.com> In-Reply-To: <1520232962-6664-1-git-send-email-yonghong.zhu@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [Patch V2] BaseTools: Fix a bug that HII type pcd value display extra 0x00 X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Mar 2018 07:00:09 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Feng, Bob C =20 -----Original Message----- From: Zhu, Yonghong=20 Sent: Monday, March 05, 2018 2:56 PM To: edk2-devel@lists.01.org Cc: Feng, Bob C Subject: [Patch V2] BaseTools: Fix a bug that HII type pcd value display ex= tra 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 wh= ether the value length is a multiplier of 2, if not, it will change the val= ue in Pcd Object and add an extra 0x00. Cc: Bob Feng Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yonghong Zhu --- 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 =3D Sku.VariableGuidValue VariableGuid =3D GuidStructureStringToGuidString(Varia= bleGuidStructure) for StorageName in Sku.DefaultStoreDict: - VariableInfo.append_variable(var_info(Index,pcdnam= e,StorageName,SkuName, StringToArray(Sku.VariableName),VariableGuid, Sku.Va= riableOffset, Sku.VariableAttribute , Sku.HiiDefaultValue,Sku.DefaultStoreD= ict[StorageName],Pcd.DatumType)) + HiiValue =3D Sku.HiiDefaultValue + DefaultStoreVal=3D Sku.DefaultStoreDict[StorageNam= e] + if Pcd.DatumType not in [TAB_UINT8, TAB_UINT16, TA= B_UINT32, TAB_UINT64, "BOOLEAN"]: + HiiValue =3D StringToArray(Sku.HiiDefaultValue= ) + DefaultStoreVal =3D StringToArray(Sku.DefaultS= toreDict[StorageName]) + =20 + VariableInfo.append_variable(var_info(Index,pcdname,StorageName,SkuNam + e, StringToArray(Sku.VariableName),VariableGuid, Sku.VariableOffset,=20 + Sku.VariableAttribute , HiiValue, DefaultStoreVal,Pcd.DatumType)) Index +=3D 1 return VariableInfo =20 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 =3D 0 if pcd.DatumType not in ['BOOLEAN','UINT8','UINT16','UINT32','= UINT64']: for (_, skuobj) in pcd.SkuInfoList.items(): datalen =3D 0 - skuobj.HiiDefaultValue =3D StringToArray(skuobj.HiiDef= aultValue) - datalen =3D len(skuobj.HiiDefaultValue.split(",")) + datalen =3D=20 + len((StringToArray(skuobj.HiiDefaultValue)).split(",")) if datalen > MaxSize: MaxSize =3D datalen - for defaultst in skuobj.DefaultStoreDict: - skuobj.DefaultStoreDict[defaultst] =3D StringToArr= ay(skuobj.DefaultStoreDict[defaultst]) - pcd.DefaultValue =3D StringToArray(pcd.DefaultValue) pcd.MaxDatumSize =3D str(MaxSize) rt, invalidhii =3D self.CheckVariableNameAssignment(Pcds) if not rt: invalidpcd =3D ",".join(invalidhii) EdkLogger.error('build', PCD_VARIABLE_INFO_ERROR, Message=3D'T= he same HII PCD must map to the same EFI variable for all SKUs', File=3Dsel= f.MetaFile, ExtraData=3Dinvalidpcd) -- 2.6.1.windows.1