From nobody Sat Apr 20 01:46:59 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 1528176646349704.4098184384874; Mon, 4 Jun 2018 22:30:46 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 145C52110D52A; Mon, 4 Jun 2018 22:30:45 -0700 (PDT) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (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 A915E21130E51 for ; Mon, 4 Jun 2018 22:30:43 -0700 (PDT) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Jun 2018 22:30:43 -0700 Received: from shwdeopenpsi168.ccr.corp.intel.com ([10.239.158.129]) by orsmga005.jf.intel.com with ESMTP; 04 Jun 2018 22:30:41 -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=192.55.52.93; helo=mga11.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,477,1520924400"; d="scan'208";a="229972154" From: Yonghong Zhu To: edk2-devel@lists.01.org Date: Tue, 5 Jun 2018 13:30:39 +0800 Message-Id: <1528176639-8332-1-git-send-email-yonghong.zhu@intel.com> X-Mailer: git-send-email 2.6.1.windows.1 Subject: [edk2] [Patch] BaseTools: Sort PCD by token space first then by PcdCName 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 Sort PCD by token space first, then by PcdCName in the build report. 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 | 330 ++++++++++++++---------= ---- 1 file changed, 167 insertions(+), 163 deletions(-) diff --git a/BaseTools/Source/Python/build/BuildReport.py b/BaseTools/Sourc= e/Python/build/BuildReport.py index 3c495a6..ad05c4a 100644 --- a/BaseTools/Source/Python/build/BuildReport.py +++ b/BaseTools/Source/Python/build/BuildReport.py @@ -925,194 +925,198 @@ class PcdReport(object): # For module PCD sub-section # FileWrite(File, gSubSectionStart) FileWrite(File, TAB_BRG_PCD) FileWrite(File, gSubSectionSep) - + AllPcdDict =3D {} for Key in PcdDict: + AllPcdDict[Key] =3D {} + for Type in PcdDict[Key]: + for Pcd in PcdDict[Key][Type]: + AllPcdDict[Key][(Pcd.TokenCName, Type)] =3D Pcd + for Key in sorted(AllPcdDict): # # Group PCD by their token space GUID C Name # First =3D True - for Type in PcdDict[Key]: + for PcdTokenCName, Type in sorted(AllPcdDict[Key]): # # Group PCD by their usage type # + Pcd =3D AllPcdDict[Key][(PcdTokenCName, Type)] TypeName, DecType =3D gPcdTypeMap.get(Type, ("", Type)) - for Pcd in PcdDict[Key][Type]: - PcdTokenCName =3D Pcd.TokenCName - MixedPcdFlag =3D False - if GlobalData.MixedPcd: - for PcdKey in GlobalData.MixedPcd: - if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName) i= n GlobalData.MixedPcd[PcdKey]: - PcdTokenCName =3D PcdKey[0] - MixedPcdFlag =3D True - if MixedPcdFlag and not ModulePcdSet: - continue - # - # Get PCD default value and their override relationship - # - DecDefaultValue =3D self.DecPcdDefault.get((Pcd.TokenC= Name, Pcd.TokenSpaceGuidCName, DecType)) - DscDefaultValue =3D self.DscPcdDefault.get((Pcd.TokenC= Name, Pcd.TokenSpaceGuidCName)) - DscDefaultValBak =3D DscDefaultValue - DscDefaultValue =3D self.FdfPcdSet.get((Pcd.TokenCName= , Key), DscDefaultValue) - if DscDefaultValue !=3D DscDefaultValBak: - try: - DscDefaultValue =3D ValueExpressionEx(DscDefau= ltValue, Pcd.DatumType, self._GuidDict)(True) - except BadExpression, DscDefaultValue: - EdkLogger.error('BuildReport', FORMAT_INVALID,= "PCD Value: %s, Type: %s" %(DscDefaultValue, Pcd.DatumType)) - - InfDefaultValue =3D None - =20 - PcdValue =3D DecDefaultValue - if DscDefaultValue: - PcdValue =3D DscDefaultValue - if ModulePcdSet is not None: - if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName, Type)= not in ModulePcdSet: - continue - InfDefault, PcdValue =3D ModulePcdSet[Pcd.TokenCNa= me, Pcd.TokenSpaceGuidCName, Type] - Pcd.DefaultValue =3D PcdValue - if InfDefault =3D=3D "": - InfDefault =3D None - - BuildOptionMatch =3D False - if GlobalData.BuildOptionPcd: - for pcd in GlobalData.BuildOptionPcd: - if (Pcd.TokenSpaceGuidCName, Pcd.TokenCName) = =3D=3D (pcd[0], pcd[1]): - if pcd[2]: - continue - PcdValue =3D pcd[3] - Pcd.DefaultValue =3D PcdValue - BuildOptionMatch =3D True - break + MixedPcdFlag =3D False + if GlobalData.MixedPcd: + for PcdKey in GlobalData.MixedPcd: + if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName) in Gl= obalData.MixedPcd[PcdKey]: + PcdTokenCName =3D PcdKey[0] + MixedPcdFlag =3D True + if MixedPcdFlag and not ModulePcdSet: + continue + # + # Get PCD default value and their override relationship + # + DecDefaultValue =3D self.DecPcdDefault.get((Pcd.TokenCName= , Pcd.TokenSpaceGuidCName, DecType)) + DscDefaultValue =3D self.DscPcdDefault.get((Pcd.TokenCName= , Pcd.TokenSpaceGuidCName)) + DscDefaultValBak =3D DscDefaultValue + DscDefaultValue =3D self.FdfPcdSet.get((Pcd.TokenCName, Ke= y), DscDefaultValue) + if DscDefaultValue !=3D DscDefaultValBak: + try: + DscDefaultValue =3D ValueExpressionEx(DscDefaultVa= lue, Pcd.DatumType, self._GuidDict)(True) + except BadExpression, DscDefaultValue: + EdkLogger.error('BuildReport', FORMAT_INVALID, "PC= D Value: %s, Type: %s" %(DscDefaultValue, Pcd.DatumType)) + + InfDefaultValue =3D None + + PcdValue =3D DecDefaultValue + if DscDefaultValue: + PcdValue =3D DscDefaultValue + if ModulePcdSet is not None: + if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName, Type) not= in ModulePcdSet: + continue + InfDefault, PcdValue =3D ModulePcdSet[Pcd.TokenCName, = Pcd.TokenSpaceGuidCName, Type] + Pcd.DefaultValue =3D PcdValue + if InfDefault =3D=3D "": + InfDefault =3D None + + BuildOptionMatch =3D False + if GlobalData.BuildOptionPcd: + for pcd in GlobalData.BuildOptionPcd: + if (Pcd.TokenSpaceGuidCName, Pcd.TokenCName) =3D= =3D (pcd[0], pcd[1]): + if pcd[2]: + continue + PcdValue =3D pcd[3] + Pcd.DefaultValue =3D PcdValue + BuildOptionMatch =3D True + break =20 - if First: - if ModulePcdSet is None: - FileWrite(File, "") - FileWrite(File, Key) - First =3D False + if First: + if ModulePcdSet is None: + FileWrite(File, "") + FileWrite(File, Key) + First =3D False =20 =20 - if Pcd.DatumType in TAB_PCD_CLEAN_NUMERIC_TYPES: - PcdValueNumber =3D int(PcdValue.strip(), 0) - if DecDefaultValue is None: - DecMatch =3D True - else: - DecDefaultValueNumber =3D int(DecDefaultValue.= strip(), 0) - DecMatch =3D (DecDefaultValueNumber =3D=3D Pcd= ValueNumber) + if Pcd.DatumType in TAB_PCD_CLEAN_NUMERIC_TYPES: + PcdValueNumber =3D int(PcdValue.strip(), 0) + if DecDefaultValue is None: + DecMatch =3D True + else: + DecDefaultValueNumber =3D int(DecDefaultValue.stri= p(), 0) + DecMatch =3D (DecDefaultValueNumber =3D=3D PcdValu= eNumber) =20 - if InfDefaultValue is None: - InfMatch =3D True - else: - InfDefaultValueNumber =3D int(InfDefaultValue.= strip(), 0) - InfMatch =3D (InfDefaultValueNumber =3D=3D Pcd= ValueNumber) + if InfDefaultValue is None: + InfMatch =3D True + else: + InfDefaultValueNumber =3D int(InfDefaultValue.stri= p(), 0) + InfMatch =3D (InfDefaultValueNumber =3D=3D PcdValu= eNumber) =20 - if DscDefaultValue is None: - DscMatch =3D True - else: - DscDefaultValueNumber =3D int(DscDefaultValue.= strip(), 0) - DscMatch =3D (DscDefaultValueNumber =3D=3D Pcd= ValueNumber) + if DscDefaultValue is None: + DscMatch =3D True else: - if DecDefaultValue is None: - DecMatch =3D True - else: - DecMatch =3D (DecDefaultValue.strip() =3D=3D P= cdValue.strip()) + DscDefaultValueNumber =3D int(DscDefaultValue.stri= p(), 0) + DscMatch =3D (DscDefaultValueNumber =3D=3D PcdValu= eNumber) + else: + if DecDefaultValue is None: + DecMatch =3D True + else: + DecMatch =3D (DecDefaultValue.strip() =3D=3D PcdVa= lue.strip()) =20 - if InfDefaultValue is None: - InfMatch =3D True - else: - InfMatch =3D (InfDefaultValue.strip() =3D=3D P= cdValue.strip()) + if InfDefaultValue is None: + InfMatch =3D True + else: + InfMatch =3D (InfDefaultValue.strip() =3D=3D PcdVa= lue.strip()) =20 - if DscDefaultValue is None: - DscMatch =3D True + if DscDefaultValue is None: + DscMatch =3D True + else: + DscMatch =3D (DscDefaultValue.strip() =3D=3D PcdVa= lue.strip()) + + IsStructure =3D False + if GlobalData.gStructurePcd and (self.Arch in GlobalData.g= StructurePcd) and ((Pcd.TokenCName, Pcd.TokenSpaceGuidCName) in GlobalData.= gStructurePcd[self.Arch]): + IsStructure =3D True + if TypeName in ('DYNVPD', 'DEXVPD'): + SkuInfoList =3D Pcd.SkuInfoList + Pcd =3D GlobalData.gStructurePcd[self.Arch][(Pcd.Token= CName, Pcd.TokenSpaceGuidCName)] + Pcd.DatumType =3D Pcd.StructName + if TypeName in ('DYNVPD', 'DEXVPD'): + Pcd.SkuInfoList =3D SkuInfoList + if Pcd.PcdFieldValueFromComm: + BuildOptionMatch =3D True + DecMatch =3D False + elif Pcd.SkuOverrideValues: + DscOverride =3D False + if not Pcd.SkuInfoList: + OverrideValues =3D Pcd.SkuOverrideValues + if OverrideValues: + Keys =3D OverrideValues.keys() + Data =3D OverrideValues[Keys[0]] + Struct =3D Data.values()[0] + DscOverride =3D self.ParseStruct(Struct) else: - DscMatch =3D (DscDefaultValue.strip() =3D=3D P= cdValue.strip()) - - IsStructure =3D False - if GlobalData.gStructurePcd and (self.Arch in GlobalDa= ta.gStructurePcd) and ((Pcd.TokenCName, Pcd.TokenSpaceGuidCName) in GlobalD= ata.gStructurePcd[self.Arch]): - IsStructure =3D True - if TypeName in ('DYNVPD', 'DEXVPD'): - SkuInfoList =3D Pcd.SkuInfoList - Pcd =3D GlobalData.gStructurePcd[self.Arch][(Pcd.T= okenCName, Pcd.TokenSpaceGuidCName)] - Pcd.DatumType =3D Pcd.StructName - if TypeName in ('DYNVPD', 'DEXVPD'): - Pcd.SkuInfoList =3D SkuInfoList - if Pcd.PcdFieldValueFromComm: - BuildOptionMatch =3D True + SkuList =3D sorted(Pcd.SkuInfoList.keys()) + for Sku in SkuList: + SkuInfo =3D Pcd.SkuInfoList[Sku] + if TypeName in ('DYNHII', 'DEXHII'): + if SkuInfo.DefaultStoreDict: + DefaultStoreList =3D sorted(SkuInf= o.DefaultStoreDict.keys()) + for DefaultStore in DefaultStoreLi= st: + OverrideValues =3D Pcd.SkuOver= rideValues[Sku] + DscOverride =3D self.ParseStru= ct(OverrideValues[DefaultStore]) + if DscOverride: + break + else: + OverrideValues =3D Pcd.SkuOverrideValu= es[Sku] + if OverrideValues: + Keys =3D OverrideValues.keys() + OverrideFieldStruct =3D self.Overr= ideFieldValue(Pcd, OverrideValues[Keys[0]]) + DscOverride =3D self.ParseStruct(O= verrideFieldStruct) + if DscOverride: + break + if DscOverride: + DscMatch =3D True DecMatch =3D False - elif Pcd.SkuOverrideValues: - DscOverride =3D False - if not Pcd.SkuInfoList: - OverrideValues =3D Pcd.SkuOverrideValues - if OverrideValues: - Keys =3D OverrideValues.keys() - Data =3D OverrideValues[Keys[0]] - Struct =3D Data.values()[0] - DscOverride =3D self.ParseStruct(Struc= t) - else: - SkuList =3D sorted(Pcd.SkuInfoList.keys()) - for Sku in SkuList: - SkuInfo =3D Pcd.SkuInfoList[Sku] - if TypeName in ('DYNHII', 'DEXHII'): - if SkuInfo.DefaultStoreDict: - DefaultStoreList =3D sorted(Sk= uInfo.DefaultStoreDict.keys()) - for DefaultStore in DefaultSto= reList: - OverrideValues =3D Pcd.Sku= OverrideValues[Sku] - DscOverride =3D self.Parse= Struct(OverrideValues[DefaultStore]) - if DscOverride: - break - else: - OverrideValues =3D Pcd.SkuOverride= Values[Sku] - if OverrideValues: - Keys =3D OverrideValues.keys() - OverrideFieldStruct =3D self.O= verrideFieldValue(Pcd, OverrideValues[Keys[0]]) - DscOverride =3D self.ParseStru= ct(OverrideFieldStruct) - if DscOverride: - break - if DscOverride: - DscMatch =3D True - DecMatch =3D False - - # - # Report PCD item according to their override relation= ship - # - if DecMatch and InfMatch: - self.PrintPcdValue(File, Pcd, PcdTokenCName, TypeN= ame, IsStructure, DscMatch, DscDefaultValBak, InfMatch, InfDefaultValue, De= cMatch, DecDefaultValue, ' ') - elif BuildOptionMatch: - self.PrintPcdValue(File, Pcd, PcdTokenCName, TypeN= ame, IsStructure, DscMatch, DscDefaultValBak, InfMatch, InfDefaultValue, De= cMatch, DecDefaultValue, '*B') - else: - if DscMatch: - if (Pcd.TokenCName, Key) in self.FdfPcdSet: - self.PrintPcdValue(File, Pcd, PcdTokenCNam= e, TypeName, IsStructure, DscMatch, DscDefaultValBak, InfMatch, InfDefaultV= alue, DecMatch, DecDefaultValue, '*F') - else: - self.PrintPcdValue(File, Pcd, PcdTokenCNam= e, TypeName, IsStructure, DscMatch, DscDefaultValBak, InfMatch, InfDefaultV= alue, DecMatch, DecDefaultValue, '*P') + + # + # Report PCD item according to their override relationship + # + if DecMatch and InfMatch: + self.PrintPcdValue(File, Pcd, PcdTokenCName, TypeName,= IsStructure, DscMatch, DscDefaultValBak, InfMatch, InfDefaultValue, DecMat= ch, DecDefaultValue, ' ') + elif BuildOptionMatch: + self.PrintPcdValue(File, Pcd, PcdTokenCName, TypeName,= IsStructure, DscMatch, DscDefaultValBak, InfMatch, InfDefaultValue, DecMat= ch, DecDefaultValue, '*B') + else: + if DscMatch: + if (Pcd.TokenCName, Key) in self.FdfPcdSet: + self.PrintPcdValue(File, Pcd, PcdTokenCName, T= ypeName, IsStructure, DscMatch, DscDefaultValBak, InfMatch, InfDefaultValue= , DecMatch, DecDefaultValue, '*F') else: - self.PrintPcdValue(File, Pcd, PcdTokenCName, T= ypeName, IsStructure, DscMatch, DscDefaultValBak, InfMatch, InfDefaultValue= , DecMatch, DecDefaultValue, '*M') + self.PrintPcdValue(File, Pcd, PcdTokenCName, T= ypeName, IsStructure, DscMatch, DscDefaultValBak, InfMatch, InfDefaultValue= , DecMatch, DecDefaultValue, '*P') + else: + self.PrintPcdValue(File, Pcd, PcdTokenCName, TypeN= ame, IsStructure, DscMatch, DscDefaultValBak, InfMatch, InfDefaultValue, De= cMatch, DecDefaultValue, '*M') =20 - if ModulePcdSet is None: - if IsStructure: - continue - if not TypeName in ('PATCH', 'FLAG', 'FIXED'): - continue - if not BuildOptionMatch: - ModuleOverride =3D self.ModulePcdOverride.get(= (Pcd.TokenCName, Pcd.TokenSpaceGuidCName), {}) - for ModulePath in ModuleOverride: - ModuleDefault =3D ModuleOverride[ModulePat= h] - if Pcd.DatumType in TAB_PCD_CLEAN_NUMERIC_= TYPES: - ModulePcdDefaultValueNumber =3D int(Mo= duleDefault.strip(), 0) - Match =3D (ModulePcdDefaultValueNumber= =3D=3D PcdValueNumber) - else: - Match =3D (ModuleDefault.strip() =3D= =3D PcdValue.strip()) - if Match: - continue - IsByteArray, ArrayList =3D ByteArrayForamt= (ModuleDefault.strip()) - if IsByteArray: - FileWrite(File, ' *M %-*s =3D %s' % (s= elf.MaxLen + 19, ModulePath, '{')) - for Array in ArrayList: - FileWrite(File, '%s' % (Array)) - else: - FileWrite(File, ' *M %-*s =3D %s' % (s= elf.MaxLen + 19, ModulePath, ModuleDefault.strip())) + if ModulePcdSet is None: + if IsStructure: + continue + if not TypeName in ('PATCH', 'FLAG', 'FIXED'): + continue + if not BuildOptionMatch: + ModuleOverride =3D self.ModulePcdOverride.get((Pcd= .TokenCName, Pcd.TokenSpaceGuidCName), {}) + for ModulePath in ModuleOverride: + ModuleDefault =3D ModuleOverride[ModulePath] + if Pcd.DatumType in TAB_PCD_CLEAN_NUMERIC_TYPE= S: + ModulePcdDefaultValueNumber =3D int(Module= Default.strip(), 0) + Match =3D (ModulePcdDefaultValueNumber =3D= =3D PcdValueNumber) + else: + Match =3D (ModuleDefault.strip() =3D=3D Pc= dValue.strip()) + if Match: + continue + IsByteArray, ArrayList =3D ByteArrayForamt(Mod= uleDefault.strip()) + if IsByteArray: + FileWrite(File, ' *M %-*s =3D %s' % (s= elf.MaxLen + 15, ModulePath, '{')) + for Array in ArrayList: + FileWrite(File, '%s' % (Array)) + else: + FileWrite(File, ' *M %-*s =3D %s' % (s= elf.MaxLen + 15, ModulePath, ModuleDefault.strip())) =20 if ModulePcdSet is None: FileWrite(File, gSectionEnd) else: if not ReportSubType and ModulePcdSet: --=20 2.6.1.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel