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.93; helo=mga11.intel.com; envelope-from=zhiqiangx.zhao@intel.com; receiver=edk2-devel@lists.01.org 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 A98B421A07A80 for ; Wed, 26 Sep 2018 03:06:31 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Sep 2018 03:06:30 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,305,1534834800"; d="scan'208";a="236045257" Received: from tiano-zzq.ccr.corp.intel.com ([10.239.49.19]) by orsmga004.jf.intel.com with ESMTP; 26 Sep 2018 03:05:50 -0700 From: Zhaozh1x To: edk2-devel@lists.01.org Cc: Zhaozh1x , Liming Gao , Yonghong Zhu , Bob Feng Date: Wed, 26 Sep 2018 18:05:42 +0800 Message-Id: <20180926100542.20556-1-zhiqiangx.zhao@intel.com> X-Mailer: git-send-email 2.14.1.windows.1 Subject: [PATCH] BaseTools: Convert string value of void* pcd in command line to array. 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: Wed, 26 Sep 2018 10:06:31 -0000 For void* type pcd in command line, if its value is string, then convert the string value to array format. For example, build --pcd gUefiOvmfPkgTokenSpaceGuid.PcdTest="c", convert the pcd value from "c" to "{0x63,0x00}". Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: ZhiqiangX Zhao Cc: Liming Gao Cc: Yonghong Zhu Cc: Bob Feng --- BaseTools/Source/Python/Workspace/DscBuildData.py | 38 ++++++++++++++++++----- 1 file changed, 30 insertions(+), 8 deletions(-) diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/Source/Python/Workspace/DscBuildData.py index ac0f0bee47..0bb2c17732 100644 --- a/BaseTools/Source/Python/Workspace/DscBuildData.py +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py @@ -1299,16 +1299,29 @@ class DscBuildData(PlatformBuildClassObject): if isinstance(self._DecPcds.get((Pcd.TokenCName, Pcd.TokenSpaceGuidCName), None), StructurePcd): self._DecPcds.get((Pcd.TokenCName, Pcd.TokenSpaceGuidCName)).PcdValueFromComm = NoFiledValues[(Pcd.TokenSpaceGuidCName, Pcd.TokenCName)][0] else: - Pcd.PcdValueFromComm = NoFiledValues[(Pcd.TokenSpaceGuidCName, Pcd.TokenCName)][0] - Pcd.DefaultValue = NoFiledValues[(Pcd.TokenSpaceGuidCName, Pcd.TokenCName)][0] + if Pcd.DatumType in TAB_PCD_NUMERIC_TYPES: + Pcd.PcdValueFromComm = NoFiledValues[(Pcd.TokenSpaceGuidCName, Pcd.TokenCName)][0] + Pcd.DefaultValue = NoFiledValues[(Pcd.TokenSpaceGuidCName, Pcd.TokenCName)][0] + else: + Pcd.PcdValueFromComm = StringToArray(NoFiledValues[(Pcd.TokenSpaceGuidCName, Pcd.TokenCName)][0]) + Pcd.DefaultValue = StringToArray(NoFiledValues[(Pcd.TokenSpaceGuidCName, Pcd.TokenCName)][0]) for sku in Pcd.SkuInfoList: SkuInfo = Pcd.SkuInfoList[sku] if SkuInfo.DefaultValue: - SkuInfo.DefaultValue = NoFiledValues[(Pcd.TokenSpaceGuidCName, Pcd.TokenCName)][0] + if Pcd.DatumType in TAB_PCD_NUMERIC_TYPES: + SkuInfo.DefaultValue = NoFiledValues[(Pcd.TokenSpaceGuidCName, Pcd.TokenCName)][0] + else: + SkuInfo.DefaultValue = StringToArray(NoFiledValues[(Pcd.TokenSpaceGuidCName, Pcd.TokenCName)][0]) else: - SkuInfo.HiiDefaultValue = NoFiledValues[(Pcd.TokenSpaceGuidCName, Pcd.TokenCName)][0] + if Pcd.DatumType in TAB_PCD_NUMERIC_TYPES: + SkuInfo.HiiDefaultValue = NoFiledValues[(Pcd.TokenSpaceGuidCName, Pcd.TokenCName)][0] + else: + SkuInfo.HiiDefaultValue = StringToArray(NoFiledValues[(Pcd.TokenSpaceGuidCName, Pcd.TokenCName)][0]) for defaultstore in SkuInfo.DefaultStoreDict: - SkuInfo.DefaultStoreDict[defaultstore] = NoFiledValues[(Pcd.TokenSpaceGuidCName, Pcd.TokenCName)][0] + if Pcd.DatumType in TAB_PCD_NUMERIC_TYPES: + SkuInfo.DefaultStoreDict[defaultstore] = NoFiledValues[(Pcd.TokenSpaceGuidCName, Pcd.TokenCName)][0] + else: + SkuInfo.DefaultStoreDict[defaultstore] = StringToArray(NoFiledValues[(Pcd.TokenSpaceGuidCName, Pcd.TokenCName)][0]) if Pcd.Type in [self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_EX_HII], self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_HII]]: if Pcd.DatumType == TAB_VOID: if not Pcd.MaxDatumSize: @@ -1320,17 +1333,26 @@ class DscBuildData(PlatformBuildClassObject): else: PcdInDec = self.DecPcds.get((Name, Guid)) if PcdInDec: - PcdInDec.PcdValueFromComm = NoFiledValues[(Guid, Name)][0] + if PcdInDec.DatumType in TAB_PCD_NUMERIC_TYPES: + PcdInDec.PcdValueFromComm = NoFiledValues[(Guid, Name)][0] + else: + PcdInDec.PcdValueFromComm = StringToArray(NoFiledValues[(Guid, Name)][0]) if PcdInDec.Type in [self._PCD_TYPE_STRING_[MODEL_PCD_FIXED_AT_BUILD], self._PCD_TYPE_STRING_[MODEL_PCD_PATCHABLE_IN_MODULE], self._PCD_TYPE_STRING_[MODEL_PCD_FEATURE_FLAG], self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC], self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_EX]]: self.Pcds[Name, Guid] = copy.deepcopy(PcdInDec) - self.Pcds[Name, Guid].DefaultValue = NoFiledValues[( Guid, Name)][0] + if PcdInDec.DatumType in TAB_PCD_NUMERIC_TYPES: + self.Pcds[Name, Guid].DefaultValue = NoFiledValues[( Guid, Name)][0] + else: + self.Pcds[Name, Guid].DefaultValue = StringToArray(NoFiledValues[( Guid, Name)][0]) if PcdInDec.Type in [self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC], self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_EX]]: - self.Pcds[Name, Guid].SkuInfoList = {TAB_DEFAULT:SkuInfoClass(TAB_DEFAULT, self.SkuIds[TAB_DEFAULT][0], '', '', '', '', '', NoFiledValues[( Guid, Name)][0])} + if PcdInDec.DatumType in TAB_PCD_NUMERIC_TYPES: + self.Pcds[Name, Guid].SkuInfoList = {TAB_DEFAULT:SkuInfoClass(TAB_DEFAULT, self.SkuIds[TAB_DEFAULT][0], '', '', '', '', '', NoFiledValues[( Guid, Name)][0])} + else: + self.Pcds[Name, Guid].SkuInfoList = {TAB_DEFAULT:SkuInfoClass(TAB_DEFAULT, self.SkuIds[TAB_DEFAULT][0], '', '', '', '', '', StringToArray(NoFiledValues[( Guid, Name)][0]))} return AllPcds def OverrideByFdfOverAll(self,AllPcds): -- 2.14.1.windows.1