From: Yunhua Feng Date: Thu, 24 May 2018 02:25:21 +0000 (+0800) Subject: BaseTools: Display both Hex and integer value format of PCD value X-Git-Tag: edk2-stable201903~1637 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=179c2f97f949509ec55f0ec7cb84480fb0c015a7 BaseTools: Display both Hex and integer value format of PCD value 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 --- diff --git a/BaseTools/Source/Python/build/BuildReport.py b/BaseTools/Source/Python/build/BuildReport.py index ad05c4a3ad..61ea645f5c 100644 --- a/BaseTools/Source/Python/build/BuildReport.py +++ b/BaseTools/Source/Python/build/BuildReport.py @@ -1140,6 +1140,11 @@ class PcdReport(object): for Array in ArrayList: FileWrite(File, '%s' % (Array)) else: + if Pcd.DatumType in TAB_PCD_CLEAN_NUMERIC_TYPES: + if Value.startswith(('0x', '0X')): + Value = '{} ({:d})'.format(Value, int(Value, 0)) + else: + Value = "0x{:X} ({})".format(int(Value, 0), Value) FileWrite(File, ' %*s = %s' % (self.MaxLen + 19, 'DSC DEFAULT', Value)) if not InfMatch and InfDefaultValue is not None: Value = InfDefaultValue.strip() @@ -1149,6 +1154,11 @@ class PcdReport(object): for Array in ArrayList: FileWrite(File, '%s' % (Array)) else: + if Pcd.DatumType in TAB_PCD_CLEAN_NUMERIC_TYPES: + if Value.startswith(('0x', '0X')): + Value = '{} ({:d})'.format(Value, int(Value, 0)) + else: + Value = "0x{:X} ({})".format(int(Value, 0), Value) FileWrite(File, ' %*s = %s' % (self.MaxLen + 19, 'INF DEFAULT', Value)) if not DecMatch and DecDefaultValue is not None: @@ -1159,6 +1169,11 @@ class PcdReport(object): for Array in ArrayList: FileWrite(File, '%s' % (Array)) else: + if Pcd.DatumType in TAB_PCD_CLEAN_NUMERIC_TYPES: + if Value.startswith(('0x', '0X')): + Value = '{} ({:d})'.format(Value, int(Value, 0)) + else: + Value = "0x{:X} ({})".format(int(Value, 0), Value) FileWrite(File, ' %*s = %s' % (self.MaxLen + 19, 'DEC DEFAULT', Value)) if IsStructure: self.PrintStructureInfo(File, Pcd.DefaultValues) @@ -1174,6 +1189,11 @@ class PcdReport(object): for Array in ArrayList: FileWrite(File, '%s' % (Array)) else: + if Pcd.DatumType in TAB_PCD_CLEAN_NUMERIC_TYPES: + if Value.startswith(('0x','0X')): + Value = '{} ({:d})'.format(Value, int(Value, 0)) + else: + Value = "0x{:X} ({})".format(int(Value, 0), Value) FileWrite(File, ' %-*s : %6s %10s = %s' % (self.MaxLen, Flag + ' ' + PcdTokenCName, TypeName, '(' + Pcd.DatumType + ')', Value)) if IsStructure: OverrideValues = Pcd.SkuOverrideValues @@ -1210,6 +1230,11 @@ class PcdReport(object): for Array in ArrayList: FileWrite(File, '%s' % (Array)) else: + if Pcd.DatumType in TAB_PCD_CLEAN_NUMERIC_TYPES: + if Value.startswith(('0x', '0X')): + Value = '{} ({:d})'.format(Value, int(Value, 0)) + else: + Value = "0x{:X} ({})".format(int(Value, 0), Value) if self.DefaultStoreSingle and self.SkuSingle: FileWrite(File, ' %-*s : %6s %10s = %s' % (self.MaxLen, Flag + ' ' + PcdTokenCName, TypeName, '(' + Pcd.DatumType + ')', Value)) elif self.DefaultStoreSingle and not self.SkuSingle: @@ -1231,6 +1256,11 @@ class PcdReport(object): for Array in ArrayList: FileWrite(File, '%s' % (Array)) else: + if Pcd.DatumType in TAB_PCD_CLEAN_NUMERIC_TYPES: + if Value.startswith(('0x', '0X')): + Value = '{} ({:d})'.format(Value, int(Value, 0)) + else: + Value = "0x{:X} ({})".format(int(Value, 0), Value) if self.DefaultStoreSingle and self.SkuSingle: FileWrite(File, ' %-*s : %6s %10s = %s' % (self.MaxLen, ' ', TypeName, '(' + Pcd.DatumType + ')', Value)) elif self.DefaultStoreSingle and not self.SkuSingle: @@ -1258,6 +1288,11 @@ class PcdReport(object): for Array in ArrayList: FileWrite(File, '%s' % (Array)) else: + if Pcd.DatumType in TAB_PCD_CLEAN_NUMERIC_TYPES: + if Value.startswith(('0x', '0X')): + Value = '{} ({:d})'.format(Value, int(Value, 0)) + else: + Value = "0x{:X} ({})".format(int(Value, 0), Value) if self.SkuSingle: FileWrite(File, ' %-*s : %6s %10s = %s' % (self.MaxLen, Flag + ' ' + PcdTokenCName, TypeName, '(' + Pcd.DatumType + ')', Value)) else: @@ -1271,6 +1306,11 @@ class PcdReport(object): for Array in ArrayList: FileWrite(File, '%s' % (Array)) else: + if Pcd.DatumType in TAB_PCD_CLEAN_NUMERIC_TYPES: + if Value.startswith(('0x', '0X')): + Value = '{} ({:d})'.format(Value, int(Value, 0)) + else: + Value = "0x{:X} ({})".format(int(Value, 0), Value) if self.SkuSingle: FileWrite(File, ' %-*s : %6s %10s = %s' % (self.MaxLen, ' ' , TypeName, '(' + Pcd.DatumType + ')', Value)) else: