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.151; helo=mga17.intel.com; envelope-from=yonghong.zhu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) (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 B3C3021A09130 for ; Mon, 27 Aug 2018 17:49:20 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Aug 2018 17:49:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,297,1531810800"; d="scan'208";a="66456040" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by fmsmga008.fm.intel.com with ESMTP; 27 Aug 2018 17:49:20 -0700 Received: from fmsmsx117.amr.corp.intel.com (10.18.116.17) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 27 Aug 2018 17:49:20 -0700 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by fmsmsx117.amr.corp.intel.com (10.18.116.17) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 27 Aug 2018 17:49:19 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.240]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.205]) with mapi id 14.03.0319.002; Tue, 28 Aug 2018 08:49:18 +0800 From: "Zhu, Yonghong" To: "Zhu, Yonghong" , "edk2-devel@lists.01.org" CC: "Fan, ZhijuX" , "Gao, Liming" , "Zhu, Yonghong" Thread-Topic: [edk2] [PATCH] BaseTools: Add check only VOID* type Pcd need the maxsize info Thread-Index: AQHUPaopMvHTyaWrA0OEknNe/0YqYqTUVoJg Date: Tue, 28 Aug 2018 00:49:18 +0000 Message-ID: References: <1535335399-11496-1-git-send-email-yonghong.zhu@intel.com> In-Reply-To: <1535335399-11496-1-git-send-email-yonghong.zhu@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH] BaseTools: Add check only VOID* type Pcd need the maxsize info 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, 28 Aug 2018 00:49:20 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Yonghong Zhu =20 Best Regards, Zhu Yonghong -----Original Message----- From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Yong= hong Zhu Sent: Monday, August 27, 2018 10:03 AM To: edk2-devel@lists.01.org Cc: Fan, ZhijuX ; Gao, Liming Subject: [edk2] [PATCH] BaseTools: Add check only VOID* type Pcd need the m= axsize info From: zhijufan Add check for the datum type keyword "VOID*", only the VOID* type Pcd need = the additional maxsize info. Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhiju.Fan --- BaseTools/Source/Python/Common/Misc.py | 53 +++++++------------ .../Source/Python/Workspace/DscBuildData.py | 2 +- .../Source/Python/Workspace/MetaFileParser.py | 4 ++ 3 files changed, 23 insertions(+), 36 deletions(-) diff --git a/BaseTools/Source/Python/Common/Misc.py b/BaseTools/Source/Pyth= on/Common/Misc.py index 74a5f0bca5..5a63c83a2a 100644 --- a/BaseTools/Source/Python/Common/Misc.py +++ b/BaseTools/Source/Python/Common/Misc.py @@ -1432,9 +1432,9 @@ def ParseFieldValue (Value): ## AnalyzeDscPcd # # Analyze DSC PCD value, since there is no data type info in DSC -# This= fuction is used to match functions (AnalyzePcdData) used for retrieving PC= D value from database +# This function is used to match functions (AnalyzePcdData) used for=20 +retrieving PCD value from database # 1. Feature flag: TokenSpace.PcdCName|PcdValue -# 2. Fix and Patch:Toke= nSpace.PcdCName|PcdValue[|MaxSize] +# 2. Fix and Patch:TokenSpace.PcdCName|PcdValue[|VOID*[|MaxSize]] # 3. Dynamic default: # TokenSpace.PcdCName|PcdValue[|VOID*[|MaxSize]] # TokenSpace.PcdCName|PcdValue @@ -1442,7 +1442,7 @@ def ParseFieldValue (Value): # TokenSpace.PcdCName|VpdOffset[|VpdValue] # TokenSpace.PcdCName|VpdOffset[|MaxSize[|VpdValue]] # 5. Dynamic HII: -# TokenSpace.PcdCName|HiiString|VaiableGuid|VariableOffset[|HiiValue] +# TokenSpace.PcdCName|HiiString|VariableGuid|VariableOffset[|HiiValue] # PCD value needs to be located in such kind of string, and the PCD value= might be an expression in which # there might have "|" operator, also in string value. # @@ -1458,42 +1458,20 @@ def AnalyzeDscPcd(Setting, PcdType, DataType=3D''): FieldList =3D AnalyzePcdExpression(Setting) =20 IsValid =3D True - if PcdType in (MODEL_PCD_FIXED_AT_BUILD, MODEL_PCD_PATCHABLE_IN_MODULE= , MODEL_PCD_FEATURE_FLAG): + if PcdType in (MODEL_PCD_FIXED_AT_BUILD, MODEL_PCD_PATCHABLE_IN_MODULE= , MODEL_PCD_DYNAMIC_DEFAULT, MODEL_PCD_DYNAMIC_EX_DEFAULT): Value =3D FieldList[0] Size =3D '' - if len(FieldList) > 1: - if FieldList[1].upper().startswith("0X") or FieldList[1].isdig= it(): - Size =3D FieldList[1] - else: - DataType =3D FieldList[1] - - if len(FieldList) > 2: - Size =3D FieldList[2] - if DataType =3D=3D "": - IsValid =3D (len(FieldList) <=3D 1) - else: - IsValid =3D (len(FieldList) <=3D 3) -# Value, Size =3D ParseFieldValue(Value) - if Size: - try: - int(Size, 16) if Size.upper().startswith("0X") else int(Si= ze) - except: + if len(FieldList) > 1 and FieldList[1]: + DataType =3D FieldList[1] + if FieldList[1] !=3D TAB_VOID: IsValid =3D False - Size =3D -1 - return [str(Value), '', str(Size)], IsValid, 0 - elif PcdType in (MODEL_PCD_DYNAMIC_DEFAULT, MODEL_PCD_DYNAMIC_EX_DEFAU= LT): - Value =3D FieldList[0] - Size =3D Type =3D '' - if len(FieldList) > 1: - Type =3D FieldList[1] - else: - Type =3D DataType if len(FieldList) > 2: Size =3D FieldList[2] - if DataType =3D=3D "": - IsValid =3D (len(FieldList) <=3D 1) - else: - IsValid =3D (len(FieldList) <=3D 3) + if IsValid: + if DataType =3D=3D "": + IsValid =3D (len(FieldList) <=3D 1) + else: + IsValid =3D (len(FieldList) <=3D 3) =20 if Size: try: @@ -1501,7 +1479,12 @@ def AnalyzeDscPcd(Setting, PcdType, DataType=3D''): except: IsValid =3D False Size =3D -1 - return [Value, Type, str(Size)], IsValid, 0 + return [str(Value), DataType, str(Size)], IsValid, 0 + elif PcdType =3D=3D MODEL_PCD_FEATURE_FLAG: + Value =3D FieldList[0] + Size =3D '' + IsValid =3D (len(FieldList) <=3D 1) + return [Value, DataType, str(Size)], IsValid, 0 elif PcdType in (MODEL_PCD_DYNAMIC_VPD, MODEL_PCD_DYNAMIC_EX_VPD): VpdOffset =3D FieldList[0] Value =3D Size =3D '' diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/= Source/Python/Workspace/DscBuildData.py index a4ad53ee15..748452623f 100644 --- a/BaseTools/Source/Python/Workspace/DscBuildData.py +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py @@ -897,7 +897,7 @@ class DscBuildData(PlatformBuildClassObject): if not Valid: EdkLogger.error('build', FORMAT_INVALID, ErrStr, File=3Dse= lf.MetaFile, Line=3DLineNo, ExtraData=3D"%s.%s" % (TokenSpaceGuid, Pcd= CName)) - if PcdType in (MODEL_PCD_DYNAMIC_DEFAULT, MODEL_PCD_DYNAMIC_EX= _DEFAULT): + if PcdType in (MODEL_PCD_DYNAMIC_DEFAULT, MODEL_PCD_DYNAMIC_EX= _DEFAULT, MODEL_PCD_FIXED_AT_BUILD, MODEL_PCD_PATCHABLE_IN_MODULE): if self._DecPcds[PcdCName, TokenSpaceGuid].DatumType.strip= () !=3D ValueList[1].strip(): EdkLogger.error('build', FORMAT_INVALID, "Pcd datumtyp= e used in DSC file is not the same as its declaration in DEC file.", File= =3Dself.MetaFile, Line=3DLineNo, ExtraData=3D"%s.%s|%s" % (TokenSpaceGuid, = PcdCName, Setting)) diff --git a/BaseTools/Source/Python/Workspace/MetaFile= Parser.py b/BaseTools/Source/Python/Workspace/MetaFileParser.py index 2b1ab40439..2a026b93b0 100644 --- a/BaseTools/Source/Python/Workspace/MetaFileParser.py +++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py @@ -1611,6 +1611,10 @@ class DscParser(MetaFileParser): =20 ValList, Valid, Index =3D AnalyzeDscPcd(self._ValueList[2], self._= ItemType) if not Valid: + if self._ItemType in (MODEL_PCD_DYNAMIC_DEFAULT, MODEL_PCD_DYN= AMIC_EX_DEFAULT, MODEL_PCD_FIXED_AT_BUILD, MODEL_PCD_PATCHABLE_IN_MODULE): + if ValList[1] !=3D TAB_VOID and ValList[2]: + EdkLogger.error('build', FORMAT_INVALID, "Pcd format i= ncorrect. Only VOID* type PCD need the maxsize info.", File=3Dself._FileWit= hError, + Line=3Dself._LineIndex + 1,=20 + ExtraData=3D"%s.%s|%s" % (self._ValueList[0], self._ValueList[1],=20 + self._ValueList[2])) EdkLogger.error('build', FORMAT_INVALID, "Pcd format incorrect= .", File=3Dself._FileWithError, Line=3Dself._LineIndex + 1, ExtraData=3D"%s.%s|%s" % (self._ValueList[0], = self._ValueList[1], self._ValueList[2])) PcdValue =3D ValList[Index] -- 2.18.0.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel