From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Permerror (SPF Permanent Error: Two or more type TXT spf records found.) identity=mailfrom; client-ip=134.134.136.31; helo=mga06.intel.com; envelope-from=zhiqiangx.zhao@intel.com; receiver=edk2-devel@lists.01.org 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 0EF3B21A02937 for ; Mon, 3 Sep 2018 23:59:46 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Sep 2018 23:59:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,328,1531810800"; d="scan'208";a="77779694" Received: from tiano-zzq.ccr.corp.intel.com ([10.239.49.10]) by FMSMGA003.fm.intel.com with ESMTP; 03 Sep 2018 23:59:44 -0700 From: Zhaozh1x To: edk2-devel@lists.01.org Cc: Zhaozh1x , Liming Gao , Yonghong Zhu , Bob Feng Date: Tue, 4 Sep 2018 14:59:39 +0800 Message-Id: <20180904065939.7960-1-zhiqiangx.zhao@intel.com> X-Mailer: git-send-email 2.14.1.windows.1 Subject: [PATCH] BaseTools: Check PcdNvStoreDefaultValueBuffer. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Sep 2018 06:59:47 -0000 Build tool should report warning if a platform defines [DefaultStores] but forgets to defined PcdNvStoreDefaultValueBuffer as PcdsDynamicExVpd in dsc file. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: ZhiqiangX Zhao Cc: Liming Gao Cc: Yonghong Zhu Cc: Bob Feng --- BaseTools/Source/Python/AutoGen/AutoGen.py | 7 ++++++- BaseTools/Source/Python/Workspace/BuildClassObject.py | 4 +++- BaseTools/Source/Python/Workspace/DscBuildData.py | 9 ++++++++- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py index eb1b283889..61cefae5a5 100644 --- a/BaseTools/Source/Python/AutoGen/AutoGen.py +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py @@ -1452,7 +1452,10 @@ class PlatformAutoGen(AutoGen): for skuname in PcdNvStoreDfBuffer.SkuInfoList: PcdNvStoreDfBuffer.SkuInfoList[skuname].DefaultValue = vardump PcdNvStoreDfBuffer.MaxDatumSize = str(len(vardump.split(","))) - + else: + #If the end user define [DefaultStores] and [XXX.Menufacturing] in DSC, but forget to configure PcdNvStoreDefaultValueBuffer to PcdsDynamicVpd + if [Pcd for Pcd in self._DynamicPcdList if Pcd.UserDefinedDefaultStoresFlag]: + EdkLogger.warn("build", "PcdNvStoreDefaultValueBuffer should be defined as PcdsDynamicExVpd in dsc file since the DefaultStores is enabled for this platform.\n%s" %self.Platform.MetaFile.Path) PlatformPcds = sorted(self._PlatformPcds.keys()) # # Add VPD type PCD into VpdFile and determine whether the VPD PCD need to be fixed up. @@ -2091,6 +2094,8 @@ class PlatformAutoGen(AutoGen): ToPcd.DatumType = FromPcd.DatumType if FromPcd.SkuInfoList: ToPcd.SkuInfoList = FromPcd.SkuInfoList + if FromPcd.UserDefinedDefaultStoresFlag: + ToPcd.UserDefinedDefaultStoresFlag = FromPcd.UserDefinedDefaultStoresFlag # Add Flexible PCD format parse if ToPcd.DefaultValue: try: diff --git a/BaseTools/Source/Python/Workspace/BuildClassObject.py b/BaseTools/Source/Python/Workspace/BuildClassObject.py index 88465c59ea..a5e0f4122e 100644 --- a/BaseTools/Source/Python/Workspace/BuildClassObject.py +++ b/BaseTools/Source/Python/Workspace/BuildClassObject.py @@ -41,7 +41,7 @@ import collections # @var Phase: To store value for Phase, default is "DXE" # class PcdClassObject(object): - def __init__(self, Name = None, Guid = None, Type = None, DatumType = None, Value = None, Token = None, MaxDatumSize = None, SkuInfoList = {}, IsOverrided = False, GuidValue = None, validateranges = [], validlists = [], expressions = [], IsDsc = False): + def __init__(self, Name = None, Guid = None, Type = None, DatumType = None, Value = None, Token = None, MaxDatumSize = None, SkuInfoList = {}, IsOverrided = False, GuidValue = None, validateranges = [], validlists = [], expressions = [], IsDsc = False, UserDefinedDefaultStoresFlag = False): self.TokenCName = Name self.TokenSpaceGuidCName = Guid self.TokenSpaceGuidValue = GuidValue @@ -67,6 +67,7 @@ class PcdClassObject(object): self.PcdValueFromComm = "" self.PcdValueFromFdf = "" self.DefinitionPosition = ("","") + self.UserDefinedDefaultStoresFlag = UserDefinedDefaultStoresFlag ## Get the maximum number of bytes def GetPcdMaxSize(self): @@ -225,6 +226,7 @@ class StructurePcd(PcdClassObject): self.PcdValueFromComm = PcdObject.PcdValueFromComm if PcdObject.PcdValueFromComm else self.PcdValueFromComm self.PcdValueFromFdf = PcdObject.PcdValueFromFdf if PcdObject.PcdValueFromFdf else self.PcdValueFromFdf self.DefinitionPosition = PcdObject.DefinitionPosition if PcdObject.DefinitionPosition else self.DefinitionPosition + self.UserDefinedDefaultStoresFlag = PcdObject.UserDefinedDefaultStoresFlag if PcdObject.UserDefinedDefaultStoresFlag else self.UserDefinedDefaultStoresFlag if isinstance(PcdObject, StructurePcd): self.StructuredPcdIncludeFile = PcdObject.StructuredPcdIncludeFile if PcdObject.StructuredPcdIncludeFile else self.StructuredPcdIncludeFile self.PackageDecs = PcdObject.PackageDecs if PcdObject.PackageDecs else self.PackageDecs diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/Source/Python/Workspace/DscBuildData.py index 748452623f..69f6e33ee5 100644 --- a/BaseTools/Source/Python/Workspace/DscBuildData.py +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py @@ -2517,6 +2517,7 @@ class DscBuildData(PlatformBuildClassObject): VariableAttrs = {} Pcds = OrderedDict() + UserDefinedDefaultStores = [] # # tdict is a special dict kind of type, used for selecting correct # PCD settings for certain ARCH and SKU @@ -2534,6 +2535,9 @@ class DscBuildData(PlatformBuildClassObject): DefaultStore = DefaultStore.upper() if DefaultStore == TAB_COMMON: DefaultStore = TAB_DEFAULT_STORES_DEFAULT + else: + #The end user define [DefaultStores] and [SKUID_IDENTIFIER.Menufacturing] in DSC + UserDefinedDefaultStores.append((PcdCName, TokenSpaceGuid)) if SkuName not in AvailableSkuIdSet: EdkLogger.error('build', PARAMETER_INVALID, 'Sku %s is not defined in [SkuIds] section' % SkuName, File=self.MetaFile, Line=Dummy5) @@ -2596,7 +2600,7 @@ class DscBuildData(PlatformBuildClassObject): pcdObject.SkuInfoList[SkuName] = SkuInfo else: SkuInfo = SkuInfoClass(SkuName, self.SkuIds[SkuName][0], VariableName, VariableGuid, VariableOffset, DefaultValue, VariableAttribute=VarAttribute, DefaultStore={DefaultStore:DefaultValue}) - Pcds[PcdCName, TokenSpaceGuid] = PcdClassObject( + PcdClassObj = PcdClassObject( PcdCName, TokenSpaceGuid, self._PCD_TYPE_STRING_[Type], @@ -2611,6 +2615,9 @@ class DscBuildData(PlatformBuildClassObject): pcdDecObject.validlists, pcdDecObject.expressions, IsDsc=True) + if (PcdCName, TokenSpaceGuid) in UserDefinedDefaultStores: + PcdClassObj.UserDefinedDefaultStoresFlag = True + Pcds[PcdCName, TokenSpaceGuid] = PcdClassObj for pcd in Pcds.values(): -- 2.14.1.windows.1