From nobody Sat Apr 20 02:46:36 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail(p=none dis=none) header.from=intel.com Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1528202254196489.2129620982944; Tue, 5 Jun 2018 05:37:34 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 27FEC2116DA06; Tue, 5 Jun 2018 05:37:33 -0700 (PDT) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (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 C7E1B2116DA03 for ; Tue, 5 Jun 2018 05:37:32 -0700 (PDT) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Jun 2018 05:37:32 -0700 Received: from shwdeopenpsi168.ccr.corp.intel.com ([10.239.158.129]) by orsmga005.jf.intel.com with ESMTP; 05 Jun 2018 05:37:31 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.31; helo=mga06.intel.com; envelope-from=yonghong.zhu@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,478,1520924400"; d="scan'208";a="230068635" From: Yonghong Zhu To: edk2-devel@lists.01.org Date: Tue, 5 Jun 2018 20:37:29 +0800 Message-Id: <1528202249-1272-1-git-send-email-yonghong.zhu@intel.com> X-Mailer: git-send-email 2.6.1.windows.1 Subject: [edk2] [Patch] BaseTools: Display both Hex and integer value format of PCD value X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Yunhua Feng , Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Yunhua Feng If the PCD's datum type is UINT8, UINT16, UINT32 or UINT64, then in the report will display both hexadecimal format and integer format of PCD value. Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yunhua Feng Reviewed-by: Yonghong Zhu =20 --- BaseTools/Source/Python/build/BuildReport.py | 40 ++++++++++++++++++++++++= ++++ 1 file changed, 40 insertions(+) diff --git a/BaseTools/Source/Python/build/BuildReport.py b/BaseTools/Sourc= e/Python/build/BuildReport.py index ad05c4a..61ea645 100644 --- a/BaseTools/Source/Python/build/BuildReport.py +++ b/BaseTools/Source/Python/build/BuildReport.py @@ -1138,29 +1138,44 @@ class PcdReport(object): if IsByteArray: FileWrite(File, ' %*s =3D %s' % (self.MaxLen + 19, 'DSC= DEFAULT', "{")) for Array in ArrayList: FileWrite(File, '%s' % (Array)) else: + if Pcd.DatumType in TAB_PCD_CLEAN_NUMERIC_TYPES: + if Value.startswith(('0x', '0X')): + Value =3D '{} ({:d})'.format(Value, int(Value, 0)) + else: + Value =3D "0x{:X} ({})".format(int(Value, 0), Valu= e) FileWrite(File, ' %*s =3D %s' % (self.MaxLen + 19, 'DSC= DEFAULT', Value)) if not InfMatch and InfDefaultValue is not None: Value =3D InfDefaultValue.strip() IsByteArray, ArrayList =3D ByteArrayForamt(Value) if IsByteArray: FileWrite(File, ' %*s =3D %s' % (self.MaxLen + 19, 'INF= DEFAULT', "{")) for Array in ArrayList: FileWrite(File, '%s' % (Array)) else: + if Pcd.DatumType in TAB_PCD_CLEAN_NUMERIC_TYPES: + if Value.startswith(('0x', '0X')): + Value =3D '{} ({:d})'.format(Value, int(Value, 0)) + else: + Value =3D "0x{:X} ({})".format(int(Value, 0), Valu= e) FileWrite(File, ' %*s =3D %s' % (self.MaxLen + 19, 'INF= DEFAULT', Value)) =20 if not DecMatch and DecDefaultValue is not None: Value =3D DecDefaultValue.strip() IsByteArray, ArrayList =3D ByteArrayForamt(Value) if IsByteArray: FileWrite(File, ' %*s =3D %s' % (self.MaxLen + 19, 'DEC= DEFAULT', "{")) for Array in ArrayList: FileWrite(File, '%s' % (Array)) else: + if Pcd.DatumType in TAB_PCD_CLEAN_NUMERIC_TYPES: + if Value.startswith(('0x', '0X')): + Value =3D '{} ({:d})'.format(Value, int(Value, 0)) + else: + Value =3D "0x{:X} ({})".format(int(Value, 0), Valu= e) FileWrite(File, ' %*s =3D %s' % (self.MaxLen + 19, 'DEC= DEFAULT', Value)) if IsStructure: self.PrintStructureInfo(File, Pcd.DefaultValues) if DecMatch and IsStructure: self.PrintStructureInfo(File, Pcd.DefaultValues) @@ -1172,10 +1187,15 @@ class PcdReport(object): if IsByteArray: FileWrite(File, ' %-*s : %6s %10s =3D %s' % (self.MaxLen= , Flag + ' ' + PcdTokenCName, TypeName, '(' + Pcd.DatumType + ')', '{')) for Array in ArrayList: FileWrite(File, '%s' % (Array)) else: + if Pcd.DatumType in TAB_PCD_CLEAN_NUMERIC_TYPES: + if Value.startswith(('0x','0X')): + Value =3D '{} ({:d})'.format(Value, int(Value, 0)) + else: + Value =3D "0x{:X} ({})".format(int(Value, 0), Valu= e) FileWrite(File, ' %-*s : %6s %10s =3D %s' % (self.MaxLen= , Flag + ' ' + PcdTokenCName, TypeName, '(' + Pcd.DatumType + ')', Value)) if IsStructure: OverrideValues =3D Pcd.SkuOverrideValues if OverrideValues: Keys =3D OverrideValues.keys() @@ -1208,10 +1228,15 @@ class PcdReport(object): else: FileWrite(File, ' %-*s : %6s %10= s %10s %10s =3D %s' % (self.MaxLen, Flag + ' ' + PcdTokenCName, TypeName, '= (' + Pcd.DatumType + ')', '(' + SkuIdName + ')', '(' + DefaultStore + ')', = '{')) for Array in ArrayList: FileWrite(File, '%s' % (Array)) else: + if Pcd.DatumType in TAB_PCD_CLEAN_NUME= RIC_TYPES: + if Value.startswith(('0x', '0X')): + Value =3D '{} ({:d})'.format(V= alue, int(Value, 0)) + else: + Value =3D "0x{:X} ({})".format= (int(Value, 0), Value) if self.DefaultStoreSingle and self.Sk= uSingle: FileWrite(File, ' %-*s : %6s %10= s =3D %s' % (self.MaxLen, Flag + ' ' + PcdTokenCName, TypeName, '(' + Pcd.D= atumType + ')', Value)) elif self.DefaultStoreSingle and not s= elf.SkuSingle: FileWrite(File, ' %-*s : %6s %10= s %10s =3D %s' % (self.MaxLen, Flag + ' ' + PcdTokenCName, TypeName, '(' + = Pcd.DatumType + ')', '(' + SkuIdName + ')', Value)) elif not self.DefaultStoreSingle and s= elf.SkuSingle: @@ -1229,10 +1254,15 @@ class PcdReport(object): else: FileWrite(File, ' %-*s : %6s %10= s %10s %10s =3D %s' % (self.MaxLen, ' ', TypeName, '(' + Pcd.DatumType + ')= ', '(' + SkuIdName + ')', '(' + DefaultStore + ')', '{')) for Array in ArrayList: FileWrite(File, '%s' % (Array)) else: + if Pcd.DatumType in TAB_PCD_CLEAN_NUME= RIC_TYPES: + if Value.startswith(('0x', '0X')): + Value =3D '{} ({:d})'.format(V= alue, int(Value, 0)) + else: + Value =3D "0x{:X} ({})".format= (int(Value, 0), Value) if self.DefaultStoreSingle and self.Sk= uSingle: FileWrite(File, ' %-*s : %6s %10= s =3D %s' % (self.MaxLen, ' ', TypeName, '(' + Pcd.DatumType + ')', Value)) elif self.DefaultStoreSingle and not s= elf.SkuSingle: FileWrite(File, ' %-*s : %6s %10= s %10s =3D %s' % (self.MaxLen, ' ', TypeName, '(' + Pcd.DatumType + ')', '(= ' + SkuIdName + ')', Value)) elif not self.DefaultStoreSingle and s= elf.SkuSingle: @@ -1256,10 +1286,15 @@ class PcdReport(object): else: FileWrite(File, ' %-*s : %6s %10s %10s = =3D %s' % (self.MaxLen, Flag + ' ' + PcdTokenCName, TypeName, '(' + Pcd.Dat= umType + ')', '(' + SkuIdName + ')', "{")) for Array in ArrayList: FileWrite(File, '%s' % (Array)) else: + if Pcd.DatumType in TAB_PCD_CLEAN_NUMERIC_TYPE= S: + if Value.startswith(('0x', '0X')): + Value =3D '{} ({:d})'.format(Value, in= t(Value, 0)) + else: + Value =3D "0x{:X} ({})".format(int(Val= ue, 0), Value) if self.SkuSingle: FileWrite(File, ' %-*s : %6s %10s =3D %s= ' % (self.MaxLen, Flag + ' ' + PcdTokenCName, TypeName, '(' + Pcd.DatumType= + ')', Value)) else: FileWrite(File, ' %-*s : %6s %10s %10s = =3D %s' % (self.MaxLen, Flag + ' ' + PcdTokenCName, TypeName, '(' + Pcd.Dat= umType + ')', '(' + SkuIdName + ')', Value)) else: @@ -1269,10 +1304,15 @@ class PcdReport(object): else: FileWrite(File, ' %-*s : %6s %10s %10s = =3D %s' % (self.MaxLen, ' ' , TypeName, '(' + Pcd.DatumType + ')', '(' + Sk= uIdName + ')', "{")) for Array in ArrayList: FileWrite(File, '%s' % (Array)) else: + if Pcd.DatumType in TAB_PCD_CLEAN_NUMERIC_TYPE= S: + if Value.startswith(('0x', '0X')): + Value =3D '{} ({:d})'.format(Value, in= t(Value, 0)) + else: + Value =3D "0x{:X} ({})".format(int(Val= ue, 0), Value) if self.SkuSingle: FileWrite(File, ' %-*s : %6s %10s =3D %s= ' % (self.MaxLen, ' ' , TypeName, '(' + Pcd.DatumType + ')', Value)) else: FileWrite(File, ' %-*s : %6s %10s %10s = =3D %s' % (self.MaxLen, ' ' , TypeName, '(' + Pcd.DatumType + ')', '(' + Sk= uIdName + ')', Value)) if TypeName in ('DYNVPD', 'DEXVPD'): --=20 2.6.1.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel