From nobody Fri Nov 1 04:34:27 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 Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1523402250410845.7077071237352; Tue, 10 Apr 2018 16:17:30 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 178DB2261817E; Tue, 10 Apr 2018 16:17:28 -0700 (PDT) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (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 B3F6922618159 for ; Tue, 10 Apr 2018 16:17:26 -0700 (PDT) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Apr 2018 16:17:25 -0700 Received: from jcarsey-desk1.amr.corp.intel.com ([10.7.159.141]) by orsmga003.jf.intel.com with ESMTP; 10 Apr 2018 16:17:25 -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.88; helo=mga01.intel.com; envelope-from=jaben.carsey@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.48,434,1517904000"; d="scan'208";a="42343787" From: Jaben Carsey To: edk2-devel@lists.01.org Date: Tue, 10 Apr 2018 16:17:20 -0700 Message-Id: <38adb39f1ac019d1a1dbc4363317816170f11361.1523402167.git.jaben.carsey@intel.com> X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: References: In-Reply-To: References: Subject: [edk2] [PATCH v1 1/5] BaseTools: use existing shared variable 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: 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" Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey --- BaseTools/Source/Python/AutoGen/GenVar.py | 15 ++++---- BaseTools/Source/Python/Common/Misc.py | 2 +- BaseTools/Source/Python/Workspace/DscBuildData.py | 38 ++++++++++---------- 3 files changed, 28 insertions(+), 27 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/GenVar.py b/BaseTools/Source/P= ython/AutoGen/GenVar.py index d222e6ed5e7e..7a29a0edca45 100644 --- a/BaseTools/Source/Python/AutoGen/GenVar.py +++ b/BaseTools/Source/Python/AutoGen/GenVar.py @@ -20,6 +20,7 @@ import copy from Common.VariableAttributes import VariableAttributes from Common.Misc import * import collections +import Common.DataType as DataType =20 var_info =3D collections.namedtuple("uefi_var", "pcdindex,pcdname,defaults= toragename,skuname,var_name, var_guid, var_offset,var_attribute,pcd_default= _value, default_value, data_type") NvStorageHeaderSize =3D 28 @@ -141,7 +142,7 @@ class VariableMgr(object): default_data_buffer =3D "" others_data_buffer =3D "" tail =3D None - default_sku_default =3D indexedvarinfo.get(index).get(("DEFAUL= T","STANDARD")) + default_sku_default =3D indexedvarinfo.get(index).get(("DEFAUL= T",DataType.TAB_DEFAULT_STORES_DEFAULT)) =20 if default_sku_default.data_type not in ["UINT8","UINT16","UIN= T32","UINT64","BOOLEAN"]: var_max_len =3D max([len(var_item.default_value.split(",")= ) for var_item in sku_var_info.values()]) @@ -154,13 +155,13 @@ class VariableMgr(object): for item in default_data_buffer: default_data_array +=3D unpack("B",item) =20 - if ("DEFAULT","STANDARD") not in var_data: - var_data[("DEFAULT","STANDARD")] =3D collections.OrderedDi= ct() - var_data[("DEFAULT","STANDARD")][index] =3D (default_data_buff= er,sku_var_info[("DEFAULT","STANDARD")]) + if ("DEFAULT",DataType.TAB_DEFAULT_STORES_DEFAULT) not in var_= data: + var_data[("DEFAULT",DataType.TAB_DEFAULT_STORES_DEFAULT)] = =3D collections.OrderedDict() + var_data[("DEFAULT",DataType.TAB_DEFAULT_STORES_DEFAULT)][inde= x] =3D (default_data_buffer,sku_var_info[("DEFAULT",DataType.TAB_DEFAULT_ST= ORES_DEFAULT)]) =20 for (skuid,defaultstoragename) in indexedvarinfo.get(index): tail =3D None - if (skuid,defaultstoragename) =3D=3D ("DEFAULT","STANDARD"= ): + if (skuid,defaultstoragename) =3D=3D ("DEFAULT",DataType.T= AB_DEFAULT_STORES_DEFAULT): continue other_sku_other =3D indexedvarinfo.get(index).get((skuid,d= efaultstoragename)) =20 @@ -189,7 +190,7 @@ class VariableMgr(object): if not var_data: return [] =20 - pcds_default_data =3D var_data.get(("DEFAULT","STANDARD"),{}) + pcds_default_data =3D var_data.get(("DEFAULT",DataType.TAB_DEFAULT= _STORES_DEFAULT),{}) NvStoreDataBuffer =3D "" var_data_offset =3D collections.OrderedDict() offset =3D NvStorageHeaderSize @@ -219,7 +220,7 @@ class VariableMgr(object): =20 data_delta_structure_buffer =3D "" for skuname,defaultstore in var_data: - if (skuname,defaultstore) =3D=3D ("DEFAULT","STANDARD"): + if (skuname,defaultstore) =3D=3D ("DEFAULT",DataType.TAB_DEFAU= LT_STORES_DEFAULT): continue pcds_sku_data =3D var_data.get((skuname,defaultstore)) delta_data_set =3D [] diff --git a/BaseTools/Source/Python/Common/Misc.py b/BaseTools/Source/Pyth= on/Common/Misc.py index 23c1a4a0b236..5ffd8cd0223d 100644 --- a/BaseTools/Source/Python/Common/Misc.py +++ b/BaseTools/Source/Python/Common/Misc.py @@ -1922,7 +1922,7 @@ class DefaultStore(): return (str(minvalue), self.DefaultStores[str(minvalue)]) def GetMin(self,DefaultSIdList): if not DefaultSIdList: - return "STANDARD" + return TAB_DEFAULT_STORES_DEFAULT storeidset =3D {storeid for storeid, storename in self.DefaultStor= es.values() if storename in DefaultSIdList} if not storeidset: return "" diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/= Source/Python/Workspace/DscBuildData.py index 6766f059b0f7..fcd3132860d5 100644 --- a/BaseTools/Source/Python/Workspace/DscBuildData.py +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py @@ -947,10 +947,10 @@ class DscBuildData(PlatformBuildClassObject): for pcd in HiiPcd: for skuid in pcd.SkuInfoList: skuobj =3D pcd.SkuInfoList.get(skuid) - if "STANDARD" not in skuobj.DefaultStoreDict: + if TAB_DEFAULT_STORES_DEFAULT not in skuobj.DefaultStoreDi= ct: PcdDefaultStoreSet =3D set([defaultstorename for defa= ultstorename in skuobj.DefaultStoreDict]) mindefaultstorename =3D DefaultStoreMgr.GetMin(PcdDefa= ultStoreSet) - skuobj.DefaultStoreDict['STANDARD'] =3D copy.deepcopy(= skuobj.DefaultStoreDict[mindefaultstorename]) + skuobj.DefaultStoreDict[TAB_DEFAULT_STORES_DEFAULT] = =3D copy.deepcopy(skuobj.DefaultStoreDict[mindefaultstorename]) return Pcds =20 def RecoverCommandLinePcd(self): @@ -1325,7 +1325,7 @@ class DscBuildData(PlatformBuildClassObject): str_pcd_obj_str.DefaultFromDSC =3D {skuname:{defau= ltstore: str_pcd_obj.SkuInfoList[skuname].DefaultStoreDict.get(defaultstore= , str_pcd_obj.SkuInfoList[skuname].DefaultValue) for defaultstore in Defaul= tStores} for skuname in str_pcd_obj.SkuInfoList} for str_pcd_data in StrPcdSet[str_pcd]: if str_pcd_data[3] in SkuIds: - str_pcd_obj_str.AddOverrideValue(str_pcd_data[2], = str(str_pcd_data[6]), 'DEFAULT' if str_pcd_data[3] =3D=3D 'COMMON' else str= _pcd_data[3],'STANDARD' if str_pcd_data[4] =3D=3D 'COMMON' else str_pcd_dat= a[4], self.MetaFile.File if self.WorkspaceDir not in self.MetaFile.File els= e self.MetaFile.File[len(self.WorkspaceDir) if self.WorkspaceDir.endswith(o= s.path.sep) else len(self.WorkspaceDir)+1:],LineNo=3Dstr_pcd_data[5]) + str_pcd_obj_str.AddOverrideValue(str_pcd_data[2], = str(str_pcd_data[6]), 'DEFAULT' if str_pcd_data[3] =3D=3D 'COMMON' else str= _pcd_data[3],TAB_DEFAULT_STORES_DEFAULT if str_pcd_data[4] =3D=3D 'COMMON' = else str_pcd_data[4], self.MetaFile.File if self.WorkspaceDir not in self.M= etaFile.File else self.MetaFile.File[len(self.WorkspaceDir) if self.Workspa= ceDir.endswith(os.path.sep) else len(self.WorkspaceDir)+1:],LineNo=3Dstr_pc= d_data[5]) S_pcd_set[str_pcd[1], str_pcd[0]] =3D str_pcd_obj_str else: EdkLogger.error('build', PARSER_ERROR, @@ -1359,7 +1359,7 @@ class DscBuildData(PlatformBuildClassObject): NoDefault =3D True break nextskuid =3D self.SkuIdMgr.GetNextSkuId(nextskuid) - stru_pcd.SkuOverrideValues[skuid] =3D copy.deepcopy(st= ru_pcd.SkuOverrideValues[nextskuid]) if not NoDefault else copy.deepcopy({d= efaultstorename: stru_pcd.DefaultValues for defaultstorename in DefaultStor= es} if DefaultStores else {'STANDARD':stru_pcd.DefaultValues}) + stru_pcd.SkuOverrideValues[skuid] =3D copy.deepcopy(st= ru_pcd.SkuOverrideValues[nextskuid]) if not NoDefault else copy.deepcopy({d= efaultstorename: stru_pcd.DefaultValues for defaultstorename in DefaultStor= es} if DefaultStores else {TAB_DEFAULT_STORES_DEFAULT:stru_pcd.DefaultValue= s}) if not NoDefault: stru_pcd.ValueChain[(skuid,'')]=3D (nextskuid,'') if stru_pcd.Type in [self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_= HII], self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_EX_HII]]: @@ -1744,10 +1744,10 @@ class DscBuildData(PlatformBuildClassObject): CApp =3D CApp + ' UINT32 FieldSize;\n' CApp =3D CApp + ' CHAR8 *Value;\n' =20 - CApp =3D CApp + "// SkuName: %s, DefaultStoreName: %s \n" % ('DEF= AULT', 'STANDARD') + CApp =3D CApp + "// SkuName: %s, DefaultStoreName: %s \n" % ('DEF= AULT', TAB_DEFAULT_STORES_DEFAULT) inherit_OverrideValues =3D Pcd.SkuOverrideValues[SkuName] - if (SkuName,DefaultStoreName) =3D=3D ('DEFAULT','STANDARD'): - pcddefaultvalue =3D Pcd.DefaultFromDSC.get('DEFAULT',{}).get('= STANDARD', Pcd.DefaultValue) if Pcd.DefaultFromDSC else Pcd.DefaultValue + if (SkuName,DefaultStoreName) =3D=3D ('DEFAULT',TAB_DEFAULT_STORES= _DEFAULT): + pcddefaultvalue =3D Pcd.DefaultFromDSC.get('DEFAULT',{}).get(T= AB_DEFAULT_STORES_DEFAULT, Pcd.DefaultValue) if Pcd.DefaultFromDSC else Pcd= .DefaultValue else: if not Pcd.DscRawValue: # handle the case that structure pcd is not appear in DSC @@ -1766,14 +1766,14 @@ class DscBuildData(PlatformBuildClassObject): (Pcd.TokenSpaceGuidCName, Pcd.Toke= nCName, FieldList)) Value, ValueSize =3D ParseFieldValue (FieldList) =20 - if (SkuName,DefaultStoreName) =3D=3D ('DEFAULT','STANDARD'= ): + if (SkuName,DefaultStoreName) =3D=3D ('DEFAULT',TAB_DEFAUL= T_STORES_DEFAULT): if isinstance(Value, str): - CApp =3D CApp + ' Pcd =3D %s; // From DSC Default= Value %s\n' % (Value, Pcd.DefaultFromDSC.get('DEFAULT',{}).get('STANDARD',= Pcd.DefaultValue) if Pcd.DefaultFromDSC else Pcd.DefaultValue) + CApp =3D CApp + ' Pcd =3D %s; // From DSC Default= Value %s\n' % (Value, Pcd.DefaultFromDSC.get('DEFAULT',{}).get(TAB_DEFAULT= _STORES_DEFAULT, Pcd.DefaultValue) if Pcd.DefaultFromDSC else Pcd.DefaultVa= lue) elif IsArray: # # Use memcpy() to copy value into field # - CApp =3D CApp + ' Value =3D %s; // From DSC D= efault Value %s\n' % (self.IntToCString(Value, ValueSize), Pcd.DefaultFromD= SC.get('DEFAULT',{}).get('STANDARD', Pcd.DefaultValue) if Pcd.DefaultFromDS= C else Pcd.DefaultValue) + CApp =3D CApp + ' Value =3D %s; // From DSC D= efault Value %s\n' % (self.IntToCString(Value, ValueSize), Pcd.DefaultFromD= SC.get('DEFAULT',{}).get(TAB_DEFAULT_STORES_DEFAULT, Pcd.DefaultValue) if P= cd.DefaultFromDSC else Pcd.DefaultValue) CApp =3D CApp + ' memcpy (Pcd, Value, %d);\n' % (= ValueSize) else: if isinstance(Value, str): @@ -1785,7 +1785,7 @@ class DscBuildData(PlatformBuildClassObject): CApp =3D CApp + ' Value =3D %s; // From DSC D= efault Value %s\n' % (self.IntToCString(Value, ValueSize), Pcd.DscRawValue.= get(SkuName,{}).get(DefaultStoreName)) CApp =3D CApp + ' memcpy (Pcd, Value, %d);\n' % (= ValueSize) continue - if (SkuName,DefaultStoreName) =3D=3D ('DEFAULT','STANDARD') or= (( (SkuName,'') not in Pcd.ValueChain) and ( (SkuName,DefaultStoreName) no= t in Pcd.ValueChain )): + if (SkuName,DefaultStoreName) =3D=3D ('DEFAULT',TAB_DEFAULT_ST= ORES_DEFAULT) or (( (SkuName,'') not in Pcd.ValueChain) and ( (SkuName,Defa= ultStoreName) not in Pcd.ValueChain )): for FieldName in FieldList: IsArray =3D IsFieldValueAnArray(FieldList[FieldName][0= ]) if IsArray: @@ -1941,7 +1941,7 @@ class DscBuildData(PlatformBuildClassObject): if Pcd.Type not in [self._PCD_TYPE_STRING_[MODEL_PCD_FIXED_AT_= BUILD], self._PCD_TYPE_STRING_[MODEL_PCD_PATCHABLE_IN_MODU= LE]]: for skuname in self.SkuIdMgr.GetSkuChain(SkuName): - storeset =3D [DefaultStoreName] if DefaultStoreName = =3D=3D 'STANDARD' else ['STANDARD', DefaultStoreName] + storeset =3D [DefaultStoreName] if DefaultStoreName = =3D=3D TAB_DEFAULT_STORES_DEFAULT else [TAB_DEFAULT_STORES_DEFAULT, Default= StoreName] for defaultstorenameitem in storeset: CApp =3D CApp + "// SkuName: %s, DefaultStoreName= : %s \n" % (skuname, defaultstorenameitem) CApp =3D CApp + self.GenerateInitValueStatement(Pc= d,skuname,defaultstorenameitem) @@ -1949,7 +1949,7 @@ class DscBuildData(PlatformBuildClassObject): break else: CApp =3D CApp + "// SkuName: %s, DefaultStoreName: STANDA= RD \n" % self.SkuIdMgr.SystemSkuId - CApp =3D CApp + self.GenerateInitValueStatement(Pcd,self.S= kuIdMgr.SystemSkuId,"STANDARD") + CApp =3D CApp + self.GenerateInitValueStatement(Pcd,self.S= kuIdMgr.SystemSkuId,TAB_DEFAULT_STORES_DEFAULT) CApp =3D CApp + self.GenerateCommandLineValueStatement(Pcd) # # Set new PCD value and size @@ -1991,7 +1991,7 @@ class DscBuildData(PlatformBuildClassObject): CApp =3D CApp + self.GenerateCommandLineValue(Pcd) if not Pcd.SkuOverrideValues or Pcd.Type in [self._PCD_TYPE_ST= RING_[MODEL_PCD_FIXED_AT_BUILD], self._PCD_TYPE_STRING_[MODEL_PCD_PATCHABLE_IN_MODU= LE]]: - CApp =3D CApp + self.GenerateInitValueFunction(Pcd,self.Sk= uIdMgr.SystemSkuId, 'STANDARD') + CApp =3D CApp + self.GenerateInitValueFunction(Pcd,self.Sk= uIdMgr.SystemSkuId, TAB_DEFAULT_STORES_DEFAULT) else: for SkuName in self.SkuIdMgr.SkuOverrideOrder(): if SkuName not in Pcd.SkuOverrideValues: @@ -2000,7 +2000,7 @@ class DscBuildData(PlatformBuildClassObject): CApp =3D CApp + self.GenerateInitValueFunction(Pcd= ,SkuName,DefaultStoreName) if not Pcd.SkuOverrideValues or Pcd.Type in [self._PCD_TYPE_ST= RING_[MODEL_PCD_FIXED_AT_BUILD], self._PCD_TYPE_STRING_[MODEL_PCD_PATCHABLE_IN_MODU= LE]]: - InitByteValue, CApp =3D self.GenerateInitializeFunc(self.S= kuIdMgr.SystemSkuId, 'STANDARD', Pcd, InitByteValue, CApp) + InitByteValue, CApp =3D self.GenerateInitializeFunc(self.S= kuIdMgr.SystemSkuId, TAB_DEFAULT_STORES_DEFAULT, Pcd, InitByteValue, CApp) else: for SkuName in self.SkuIdMgr.SkuOverrideOrder(): if SkuName not in Pcd.SkuOverrideValues: @@ -2016,7 +2016,7 @@ class DscBuildData(PlatformBuildClassObject): CApp =3D CApp + '{\n' for Pcd in StructuredPcds.values(): if not Pcd.SkuOverrideValues or Pcd.Type in [self._PCD_TYPE_ST= RING_[MODEL_PCD_FIXED_AT_BUILD],self._PCD_TYPE_STRING_[MODEL_PCD_PATCHABLE_= IN_MODULE]]: - CApp =3D CApp + ' Initialize_%s_%s_%s_%s();\n' % (self.Sk= uIdMgr.SystemSkuId, 'STANDARD', Pcd.TokenSpaceGuidCName, Pcd.TokenCName) + CApp =3D CApp + ' Initialize_%s_%s_%s_%s();\n' % (self.Sk= uIdMgr.SystemSkuId, TAB_DEFAULT_STORES_DEFAULT, Pcd.TokenSpaceGuidCName, Pc= d.TokenCName) else: for SkuName in self.SkuIdMgr.SkuOverrideOrder(): if SkuName not in Pcd.SkuOverrideValues: @@ -2340,14 +2340,14 @@ class DscBuildData(PlatformBuildClassObject): if Pcd.Type in [self._PCD_TYPE_STRING_[MODEL_PCD_FIXED_AT_BUILD], = self._PCD_TYPE_STRING_[MODEL_PCD_PATCHABLE_IN_MODULE]]: if self.SkuIdMgr.SystemSkuId not in Pcd.DscRawValue: Pcd.DscRawValue[self.SkuIdMgr.SystemSkuId] =3D {} - Pcd.DscRawValue[self.SkuIdMgr.SystemSkuId]['STANDARD'] =3D Pcd= .DefaultValue + Pcd.DscRawValue[self.SkuIdMgr.SystemSkuId][TAB_DEFAULT_STORES_= DEFAULT] =3D Pcd.DefaultValue for skuname in Pcd.SkuInfoList: Pcd.DscRawValue[skuname] =3D {} if Pcd.Type in [self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_HII],= self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_EX_HII]]: for defaultstore in Pcd.SkuInfoList[skuname].DefaultStoreD= ict: Pcd.DscRawValue[skuname][defaultstore] =3D Pcd.SkuInfo= List[skuname].DefaultStoreDict[defaultstore] else: - Pcd.DscRawValue[skuname]['STANDARD'] =3D Pcd.SkuInfoList[s= kuname].DefaultValue + Pcd.DscRawValue[skuname][TAB_DEFAULT_STORES_DEFAULT] =3D P= cd.SkuInfoList[skuname].DefaultValue def CompletePcdValues(self,PcdSet): Pcds =3D {} DefaultStoreObj =3D DefaultStore(self._GetDefaultStores()) @@ -2412,7 +2412,7 @@ class DscBuildData(PlatformBuildClassObject): SkuName =3D 'DEFAULT' if SkuName =3D=3D 'COMMON' else SkuName DefaultStore =3D DefaultStore.upper() if DefaultStore =3D=3D "COMMON": - DefaultStore =3D "STANDARD" + DefaultStore =3D TAB_DEFAULT_STORES_DEFAULT if SkuName not in AvailableSkuIdSet: EdkLogger.error('build', PARAMETER_INVALID, 'Sku %s is not= defined in [SkuIds] section' % SkuName, File=3Dself.MetaFile, Line=3DD= ummy5) --=20 2.16.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel