From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.136; helo=mga12.intel.com; envelope-from=yonghong.zhu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) (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 D38FF211616B7 for ; Tue, 5 Jun 2018 17:47:28 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Jun 2018 17:47:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,481,1520924400"; d="scan'208";a="47060873" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by orsmga008.jf.intel.com with ESMTP; 05 Jun 2018 17:47:28 -0700 Received: from fmsmsx113.amr.corp.intel.com (10.18.116.7) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 5 Jun 2018 17:47:27 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by FMSMSX113.amr.corp.intel.com (10.18.116.7) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 5 Jun 2018 17:47:27 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.51]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.116]) with mapi id 14.03.0319.002; Wed, 6 Jun 2018 08:47:25 +0800 From: "Zhu, Yonghong" To: "Zhu, Yonghong" , "edk2-devel@lists.01.org" CC: "Feng, YunhuaX" , "Gao, Liming" , "Zhu, Yonghong" Thread-Topic: [edk2] [Patch] BaseTools: Display both Hex and integer value format of PCD value Thread-Index: AQHT/Mn+6eIktoNgjkuOuOwUANhbsqRSZiRQ Date: Wed, 6 Jun 2018 00:47:25 +0000 Message-ID: References: <1528202249-1272-1-git-send-email-yonghong.zhu@intel.com> In-Reply-To: <1528202249-1272-1-git-send-email-yonghong.zhu@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [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: , X-List-Received-Date: Wed, 06 Jun 2018 00:47:29 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Yonghong Zhu =20 Best Regards, Zhu Yonghong -----Original Message----- From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Yong= hong Zhu Sent: Tuesday, June 05, 2018 8:37 PM To: edk2-devel@lists.01.org Cc: Feng, YunhuaX ; Gao, Liming Subject: [edk2] [Patch] BaseTools: Display both Hex and integer value forma= t of PCD value From: Yunhua Feng If the PCD's datum type is UINT8, UINT16, UINT32 or UINT64, then in the rep= ort 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 --- 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),=20 + Value) 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),=20 + Value) 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),=20 + Value) 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),=20 + Value) 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}=20 + ({})".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}=20 + ({})".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}=20 + ({})".format(int(Value, 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}=20 + ({})".format(int(Value, 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'): -- 2.6.1.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel