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=liming.gao@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 98209210D9791 for ; Mon, 28 Jan 2019 19:35:19 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Jan 2019 19:35:19 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,535,1539673200"; d="scan'208";a="314385215" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by fmsmga006.fm.intel.com with ESMTP; 28 Jan 2019 19:35:18 -0800 Received: from fmsmsx158.amr.corp.intel.com (10.18.116.75) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.408.0; Mon, 28 Jan 2019 19:35:09 -0800 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by fmsmsx158.amr.corp.intel.com (10.18.116.75) with Microsoft SMTP Server (TLS) id 14.3.408.0; Mon, 28 Jan 2019 19:35:10 -0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.102]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.172]) with mapi id 14.03.0415.000; Tue, 29 Jan 2019 11:33:55 +0800 From: "Gao, Liming" To: "Feng, Bob C" , "edk2-devel@lists.01.org" Thread-Topic: [Patch V2] BaseTools: Enable CODE format in DEC file Thread-Index: AQHUtJK0/wE/T1gl2UaDT+DIg6hQN6XFnVhQ Date: Tue, 29 Jan 2019 03:33:55 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14E3D1BCF@SHSMSX104.ccr.corp.intel.com> References: <20190125094516.368-1-bob.c.feng@intel.com> In-Reply-To: <20190125094516.368-1-bob.c.feng@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZDJkZTE1MzgtZjA1ZC00ZjIwLWE0OWYtYjY2NmViMGUwZDVjIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiUVhJQnh2TEJNbDJWWVowUVNRWW9sV01tMU52ZFdUVEpYcWthb2xNY2hkNUFtSXRXZ0w3Q21ld3RPZWVGRHY2TCJ9 dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [Patch V2] BaseTools: Enable CODE format in DEC file 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, 29 Jan 2019 03:35:19 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Bob: I have no comments on this patch. Reviewed-by: Liming Gao =20 Besides, please make sure the build report list the value from DEC file w= hen the value is specified in DEC file. Thanks Liming > -----Original Message----- > From: Feng, Bob C > Sent: Friday, January 25, 2019 5:45 PM > To: edk2-devel@lists.01.org > Cc: Feng, Bob C ; Gao, Liming > Subject: [Patch V2] BaseTools: Enable CODE format in DEC file >=20 > BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1292. > Enable CODE format in DEC File. >=20 > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Bob Feng > Cc: Liming Gao > --- > .../Source/Python/Workspace/DscBuildData.py | 38 +++---- > .../Source/Python/Workspace/MetaFileParser.py | 99 ++++++++++++------- > BaseTools/Source/Python/build/BuildReport.py | 2 +- > 3 files changed, 86 insertions(+), 53 deletions(-) >=20 > diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTool= s/Source/Python/Workspace/DscBuildData.py > index 0dad04212e..4c3c9b8d34 100644 > --- a/BaseTools/Source/Python/Workspace/DscBuildData.py > +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py > @@ -1786,20 +1786,21 @@ class DscBuildData(PlatformBuildClassObject): > Value =3D ValueExpressionEx(FieldList[FieldName.= strip(".")][0], TAB_VOID, self._GuidDict)(True) > except BadExpression: > EdkLogger.error('Build', FORMAT_INVALID, "Invali= d value format for %s. From %s Line %d " % > (".".join((Pcd.TokenSpaceGuidCNa= me, Pcd.TokenCName, FieldName.strip('.'))), > FieldList[FieldName.strip(".")][1], FieldList[FieldName.strip(".")][2])) > Value, ValueSize =3D ParseFieldValue(Value) > - CApp =3D CApp + ' __FLEXIBLE_SIZE(*Size, %s, %s, %d= / __ARRAY_ELEMENT_SIZE(%s, %s) + ((%d %% > __ARRAY_ELEMENT_SIZE(%s, %s)) ? 1 : 0)); // From %s Line %d Value %s \n'= % (Pcd.DatumType, FieldName.strip("."), ValueSize, > Pcd.DatumType, FieldName.strip("."), ValueSize, Pcd.DatumType, FieldName.= strip("."), FieldList[FieldName.strip(".")][1], > FieldList[FieldName.strip(".")][2], FieldList[FieldName.strip(".")][0]); > + if not Pcd.IsArray: > + CApp =3D CApp + ' __FLEXIBLE_SIZE(*Size, %s, %s= , %d / __ARRAY_ELEMENT_SIZE(%s, %s) + ((%d %% > __ARRAY_ELEMENT_SIZE(%s, %s)) ? 1 : 0)); // From %s Line %d Value %s \n'= % (Pcd.DatumType, FieldName.strip("."), ValueSize, > Pcd.DatumType, FieldName.strip("."), ValueSize, Pcd.DatumType, FieldName.= strip("."), FieldList[FieldName.strip(".")][1], > FieldList[FieldName.strip(".")][2], FieldList[FieldName.strip(".")][0]); > else: > NewFieldName =3D '' > FieldName_ori =3D FieldName.strip('.') > while '[' in FieldName: > NewFieldName =3D NewFieldName + FieldName.split(= '[', 1)[0] + '[0]' > ArrayIndex =3D int(FieldName.split('[', 1)[1].sp= lit(']', 1)[0]) > FieldName =3D FieldName.split(']', 1)[1] > FieldName =3D NewFieldName + FieldName > - while '[' in FieldName: > + while '[' in FieldName and not Pcd.IsArray: > FieldName =3D FieldName.rsplit('[', 1)[0] > CApp =3D CApp + ' __FLEXIBLE_SIZE(*Size, %s, %s= , %d); // From %s Line %d Value %s\n' % (Pcd.DatumType, > FieldName.strip("."), ArrayIndex + 1, FieldList[FieldName_ori][1], FieldL= ist[FieldName_ori][2], FieldList[FieldName_ori][0]) > for skuname in Pcd.SkuOverrideValues: > if skuname =3D=3D TAB_COMMON: > continue > @@ -1817,20 +1818,21 @@ class DscBuildData(PlatformBuildClassObject): > Value =3D ValueExpressionEx(FieldLis= t[FieldName.strip(".")][0], TAB_VOID, self._GuidDict)(True) > except BadExpression: > EdkLogger.error('Build', FORMAT_INVA= LID, "Invalid value format for %s. From %s Line %d " % > (".".join((Pcd.Token= SpaceGuidCName, Pcd.TokenCName, FieldName.strip('.'))), > FieldList[FieldName.strip(".")][1], FieldList[FieldName.strip(".")][2])) > Value, ValueSize =3D ParseFieldValue(Val= ue) > - CApp =3D CApp + ' __FLEXIBLE_SIZE(*Size= , %s, %s, %d / __ARRAY_ELEMENT_SIZE(%s, %s) + ((%d %% > __ARRAY_ELEMENT_SIZE(%s, %s)) ? 1 : 0)); // From %s Line %d Value %s\n' %= (Pcd.DatumType, FieldName.strip("."), ValueSize, > Pcd.DatumType, FieldName.strip("."), ValueSize, Pcd.DatumType, FieldName.= strip("."), FieldList[FieldName.strip(".")][1], > FieldList[FieldName.strip(".")][2], FieldList[FieldName.strip(".")][0]); > + if not Pcd.IsArray: > + CApp =3D CApp + ' __FLEXIBLE_SIZE(*= Size, %s, %s, %d / __ARRAY_ELEMENT_SIZE(%s, %s) + > ((%d %% __ARRAY_ELEMENT_SIZE(%s, %s)) ? 1 : 0)); // From %s Line %d Value= %s\n' % (Pcd.DatumType, FieldName.strip("."), ValueSize, > Pcd.DatumType, FieldName.strip("."), ValueSize, Pcd.DatumType, FieldName.= strip("."), FieldList[FieldName.strip(".")][1], > FieldList[FieldName.strip(".")][2], FieldList[FieldName.strip(".")][0]); > else: > NewFieldName =3D '' > FieldName_ori =3D FieldName.strip('.') > while '[' in FieldName: > NewFieldName =3D NewFieldName + Fiel= dName.split('[', 1)[0] + '[0]' > ArrayIndex =3D int(FieldName.split('= [', 1)[1].split(']', 1)[0]) > FieldName =3D FieldName.split(']', 1= )[1] > FieldName =3D NewFieldName + FieldName > - while '[' in FieldName: > + while '[' in FieldName and not Pcd.IsArr= ay: > FieldName =3D FieldName.rsplit('[', = 1)[0] > CApp =3D CApp + ' __FLEXIBLE_SIZE(*= Size, %s, %s, %d); // From %s Line %d Value %s \n' % > (Pcd.DatumType, FieldName.strip("."), ArrayIndex + 1, FieldList[FieldName= _ori][1], FieldList[FieldName_ori][2], FieldList[FieldName_ori][0]) > if Pcd.PcdFieldValueFromFdf: > CApp =3D CApp + "// From fdf \n" > for FieldName in Pcd.PcdFieldValueFromFdf: > @@ -1841,11 +1843,12 @@ class DscBuildData(PlatformBuildClassObject): > Value =3D ValueExpressionEx(Pcd.PcdFieldValueFromFdf= [FieldName.strip(".")][0], TAB_VOID, self._GuidDict)(True) > except BadExpression: > EdkLogger.error('Build', FORMAT_INVALID, "Invalid va= lue format for %s. From %s Line %d " % > (".".join((Pcd.TokenSpaceGuidCName, = Pcd.TokenCName, FieldName.strip('.'))), > Pcd.PcdFieldValueFromFdf[FieldName.strip(".")][1], Pcd.PcdFieldValueFromF= df[FieldName.strip(".")][2])) > Value, ValueSize =3D ParseFieldValue(Value) > - CApp =3D CApp + ' __FLEXIBLE_SIZE(*Size, %s, %s, %d / _= _ARRAY_ELEMENT_SIZE(%s, %s) + ((%d %% > __ARRAY_ELEMENT_SIZE(%s, %s)) ? 1 : 0)); // From %s Line %d Value %s\n' %= (Pcd.DatumType, FieldName.strip("."), ValueSize, > Pcd.DatumType, FieldName.strip("."), ValueSize, Pcd.DatumType, FieldName.= strip("."), Pcd.PcdFieldValueFromFdf[FieldName.strip(".")][1], > Pcd.PcdFieldValueFromFdf[FieldName.strip(".")][2], Pcd.PcdFieldValueFromF= df[FieldName.strip(".")][0]); > + if not Pcd.IsArray: > + CApp =3D CApp + ' __FLEXIBLE_SIZE(*Size, %s, %s, %d= / __ARRAY_ELEMENT_SIZE(%s, %s) + ((%d %% > __ARRAY_ELEMENT_SIZE(%s, %s)) ? 1 : 0)); // From %s Line %d Value %s\n' %= (Pcd.DatumType, FieldName.strip("."), ValueSize, > Pcd.DatumType, FieldName.strip("."), ValueSize, Pcd.DatumType, FieldName.= strip("."), Pcd.PcdFieldValueFromFdf[FieldName.strip(".")][1], > Pcd.PcdFieldValueFromFdf[FieldName.strip(".")][2], Pcd.PcdFieldValueFromF= df[FieldName.strip(".")][0]); > else: > NewFieldName =3D '' > FieldName_ori =3D FieldName.strip('.') > while '[' in FieldName: > NewFieldName =3D NewFieldName + FieldName.split('[',= 1)[0] + '[0]' > @@ -1865,20 +1868,21 @@ class DscBuildData(PlatformBuildClassObject): > Value =3D ValueExpressionEx(Pcd.PcdFieldValueFromCom= m[FieldName.strip(".")][0], TAB_VOID, self._GuidDict)(True) > except BadExpression: > EdkLogger.error('Build', FORMAT_INVALID, "Invalid va= lue format for %s. From %s Line %d " % > (".".join((Pcd.TokenSpaceGuidCName, = Pcd.TokenCName, FieldName.strip('.'))), > Pcd.PcdFieldValueFromComm[FieldName.strip(".")][1], Pcd.PcdFieldValueFrom= Comm[FieldName.strip(".")][2])) > Value, ValueSize =3D ParseFieldValue(Value) > - CApp =3D CApp + ' __FLEXIBLE_SIZE(*Size, %s, %s, %d / _= _ARRAY_ELEMENT_SIZE(%s, %s) + ((%d %% > __ARRAY_ELEMENT_SIZE(%s, %s)) ? 1 : 0)); // From %s Line %d Value %s\n' %= (Pcd.DatumType, FieldName.strip("."), ValueSize, > Pcd.DatumType, FieldName.strip("."), ValueSize, Pcd.DatumType, FieldName.= strip("."), > Pcd.PcdFieldValueFromComm[FieldName.strip(".")][1], Pcd.PcdFieldValueFrom= Comm[FieldName.strip(".")][2], > Pcd.PcdFieldValueFromComm[FieldName.strip(".")][0]); > + if not Pcd.IsArray: > + CApp =3D CApp + ' __FLEXIBLE_SIZE(*Size, %s, %s, %d= / __ARRAY_ELEMENT_SIZE(%s, %s) + ((%d %% > __ARRAY_ELEMENT_SIZE(%s, %s)) ? 1 : 0)); // From %s Line %d Value %s\n' %= (Pcd.DatumType, FieldName.strip("."), ValueSize, > Pcd.DatumType, FieldName.strip("."), ValueSize, Pcd.DatumType, FieldName.= strip("."), > Pcd.PcdFieldValueFromComm[FieldName.strip(".")][1], Pcd.PcdFieldValueFrom= Comm[FieldName.strip(".")][2], > Pcd.PcdFieldValueFromComm[FieldName.strip(".")][0]); > else: > NewFieldName =3D '' > FieldName_ori =3D FieldName.strip('.') > while '[' in FieldName: > NewFieldName =3D NewFieldName + FieldName.split('[',= 1)[0] + '[0]' > ArrayIndex =3D int(FieldName.split('[', 1)[1].split(= ']', 1)[0]) > FieldName =3D FieldName.split(']', 1)[1] > FieldName =3D NewFieldName + FieldName > - while '[' in FieldName: > + while '[' in FieldName and not Pcd.IsArray: > FieldName =3D FieldName.rsplit('[', 1)[0] > CApp =3D CApp + ' __FLEXIBLE_SIZE(*Size, %s, %s, %d= ); // From %s Line %d Value %s \n' % (Pcd.DatumType, > FieldName.strip("."), ArrayIndex + 1, Pcd.PcdFieldValueFromComm[FieldName= _ori][1], Pcd.PcdFieldValueFromComm[FieldName_ori][2], > Pcd.PcdFieldValueFromComm[FieldName_ori][0]) > if Pcd.GetPcdMaxSize(): > CApp =3D CApp + " *Size =3D (%d > *Size ? %d : *Size); // T= he Pcd maxsize is %d \n" % (Pcd.GetPcdMaxSize(), > Pcd.GetPcdMaxSize(), Pcd.GetPcdMaxSize()) > CApp =3D CApp + "}\n" > @@ -1905,14 +1909,15 @@ class DscBuildData(PlatformBuildClassObject): > PcdDefValue =3D Pcd.SkuInfoList.get(skuname).DefaultValu= e > else: > PcdDefValue =3D Pcd.DefaultValue > if lastoneisEmpty: > if "{CODE(" not in PcdDefValue: > - sizebasevalue_plus =3D "(%s / sizeof(%s) + 1)" % ((D= scBuildData.GetStructurePcdMaxSize(Pcd), "".join(r_datatype))) > - sizebasevalue =3D "(%s / sizeof(%s))" % ((DscBuildDa= ta.GetStructurePcdMaxSize(Pcd), "".join(r_datatype))) > + sizebasevalue_plus =3D "(%s / sizeof(%s) + 1)" % ((D= scBuildData.GetStructurePcdMaxSize(Pcd), Pcd.BaseDatumType)) > + sizebasevalue =3D "(%s / sizeof(%s))" % ((DscBuildDa= ta.GetStructurePcdMaxSize(Pcd), Pcd.BaseDatumType)) > sizeof =3D "sizeof(%s)" % Pcd.BaseDatumType > - CApp =3D ' Size =3D %s %% %s ? %s : %s ;\n' % ( (Ds= cBuildData.GetStructurePcdMaxSize(Pcd), sizeof, > sizebasevalue_plus, sizebasevalue)) > + CApp =3D ' int ArraySize =3D %s %% %s ? %s : %s ;\n= ' % ( (DscBuildData.GetStructurePcdMaxSize(Pcd), sizeof, > sizebasevalue_plus, sizebasevalue)) > + CApp +=3D ' Size =3D ArraySize * sizeof(%s); \n' % = Pcd.BaseDatumType > else: > CApp =3D " Size =3D 0;\n" > else: > CApp =3D ' Size =3D sizeof(%s);\n' % ("".join(r_datatyp= e) ) > else: > @@ -1968,21 +1973,21 @@ class DscBuildData(PlatformBuildClassObject): > except BadExpression: > EdkLogger.error("Build", FORMAT_INVALID, "Invalid value = format for %s.%s, from DEC: %s" % > (Pcd.TokenSpaceGuidCName, Pcd.TokenCName= , DefaultValueFromDec)) > DefaultValueFromDec =3D StringToArray(DefaultValueFromDec) > Value, ValueSize =3D ParseFieldValue (DefaultValueFromDec) > - if isinstance(Value, str): > - CApp =3D CApp + ' Pcd =3D %s; // From DEC Default Value %s\= n' % (Value, Pcd.DefaultValueFromDec) > - elif IsArray: > + if IsArray: > # > # Use memcpy() to copy value into field > # > if "{CODE(" in Pcd.DefaultValueFromDec: > CApp =3D CApp + ' memcpy (Pcd, %s_%s_INIT_Value, sizeof= (%s_%s_INIT_Value));\n' % (Pcd.TokenSpaceGuidCName, > Pcd.TokenCName,Pcd.TokenSpaceGuidCName, Pcd.TokenCName) > else: > CApp =3D CApp + ' Value =3D %s; // From DEC Default= Value %s\n' % (DscBuildData.IntToCString(Value, ValueSize), > Pcd.DefaultValueFromDec) > CApp =3D CApp + ' memcpy (Pcd, Value, %d);\n' % (ValueS= ize) > + elif isinstance(Value, str): > + CApp =3D CApp + ' Pcd =3D %s; // From DEC Default Value %s\= n' % (Value, Pcd.DefaultValueFromDec) > for index in Pcd.DefaultValues: > FieldList =3D Pcd.DefaultValues[index] > if not FieldList: > continue > for FieldName in FieldList: > @@ -1998,22 +2003,21 @@ class DscBuildData(PlatformBuildClassObject): > Value, ValueSize =3D ParseFieldValue (FieldList[Fiel= dName][0]) > except Exception: > EdkLogger.error('Build', FORMAT_INVALID, "Invalid va= lue format for %s. From %s Line %d " % > (".".join((Pcd.TokenSpaceGuidCName, Pcd.TokenCName, FieldName)), FieldLis= t[FieldName][1], FieldList[FieldName][2])) >=20 > indicator =3D self.GetIndicator(index, FieldName,Pcd) > - if isinstance(Value, str): > - CApp =3D CApp + ' %s =3D %s; // From %s Line %d Val= ue %s\n' % (indicator, Value, FieldList[FieldName][1], > FieldList[FieldName][2], FieldList[FieldName][0]) > - elif IsArray: > + if IsArray: > # > # Use memcpy() to copy value into field > # > CApp =3D CApp + ' FieldSize =3D __FIELD_SIZE(%s, %s= );\n' % (Pcd.DatumType, FieldName) > CApp =3D CApp + ' Value =3D %s; // From %s Line= %d Value %s\n' % (DscBuildData.IntToCString(Value, ValueSize), > FieldList[FieldName][1], FieldList[FieldName][2], FieldList[FieldName][0]= ) > CApp =3D CApp + ' __STATIC_ASSERT((__FIELD_SIZE(%s,= %s) >=3D %d) || (__FIELD_SIZE(%s, %s) =3D=3D 0), "Input buffer > exceeds the buffer array"); // From %s Line %d Value %s\n' % (Pcd.DatumTy= pe, FieldName, ValueSize, Pcd.DatumType, FieldName, > FieldList[FieldName][1], FieldList[FieldName][2], FieldList[FieldName][0]= ) > CApp =3D CApp + ' memcpy (&Pcd->%s, Value, (FieldSi= ze > 0 && FieldSize < %d) ? FieldSize : %d);\n' % (FieldName, > ValueSize, ValueSize) > CApp =3D CApp + ' memcpy (&%s, Value, (FieldSize > = 0 && FieldSize < %d) ? FieldSize : %d);\n' % (indicator, > ValueSize, ValueSize) > - > + elif isinstance(Value, str): > + CApp =3D CApp + ' %s =3D %s; // From %s Line %d Val= ue %s\n' % (indicator, Value, FieldList[FieldName][1], > FieldList[FieldName][2], FieldList[FieldName][0]) > else: > if '[' in FieldName and ']' in FieldName: > Index =3D int(FieldName.split('[')[1].split(']')= [0]) > CApp =3D CApp + ' __STATIC_ASSERT((%d < __ARRAY= _SIZE(Pcd->%s)) || (__ARRAY_SIZE(Pcd->%s) =3D=3D 0), "array > index exceeds the array number"); // From %s Line %d Index of %s\n' % (In= dex, FieldName.split('[')[0], FieldName.split('[')[0], > FieldList[FieldName][1], FieldList[FieldName][2], FieldName) > if ValueSize > 4: > diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py b/BaseTo= ols/Source/Python/Workspace/MetaFileParser.py > index 6df0d3cdf8..45cdf1a238 100644 > --- a/BaseTools/Source/Python/Workspace/MetaFileParser.py > +++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py > @@ -190,10 +190,14 @@ class MetaFileParser(object): > self._PostProcessed =3D False > # Different version of meta-file has different way to parse. > self._Version =3D 0 > self._GuidDict =3D {} # for Parser PCD value {GUID(gTokeSpaceGu= idName)} >=20 > + self._PcdCodeValue =3D "" > + self._PcdDataTypeCODE =3D False > + self._CurrentPcdName =3D "" > + > ## Store the parsed data in table > def _Store(self, *Args): > return self._Table.Insert(*Args) >=20 > ## Virtual method for starting parse > @@ -481,10 +485,43 @@ class MetaFileParser(object): > Macros.update(ComSpeMacroDict) > Macros.update(SpeSpeMacroDict) >=20 > return Macros >=20 > + def ProcessMultipleLineCODEValue(self,Content): > + CODEBegin =3D False > + CODELine =3D "" > + continuelinecount =3D 0 > + newContent =3D [] > + for Index in range(0, len(Content)): > + Line =3D Content[Index] > + if CODEBegin: > + CODELine =3D CODELine + Line > + continuelinecount +=3D1 > + if ")}" in Line: > + newContent.append(CODELine) > + for _ in range(continuelinecount): > + newContent.append("") > + CODEBegin =3D False > + CODELine =3D "" > + continuelinecount =3D 0 > + else: > + if not Line: > + newContent.append(Line) > + continue > + if "{CODE(" not in Line: > + newContent.append(Line) > + continue > + elif CODEPattern.findall(Line): > + newContent.append(Line) > + continue > + else: > + CODEBegin =3D True > + CODELine =3D Line > + > + return newContent > + > _SectionParser =3D {} >=20 > ## INF file parser class > # > # @param FilePath The path of platform description file > @@ -901,13 +938,10 @@ class DscParser(MetaFileParser): > # Map the ID between the original table and new table to track > # the owner item > # > self._IdMapping =3D {-1:-1} >=20 > - self._PcdCodeValue =3D "" > - self._PcdDataTypeCODE =3D False > - self._CurrentPcdName =3D "" > self._Content =3D None >=20 > ## Parser starter > def Start(self): > Content =3D '' > @@ -1134,42 +1168,10 @@ class DscParser(MetaFileParser): > ## Parse Edk style of library modules > @ParseMacro > def _LibraryInstanceParser(self): > self._ValueList[0] =3D self._CurrentLine >=20 > - def ProcessMultipleLineCODEValue(self,Content): > - CODEBegin =3D False > - CODELine =3D "" > - continuelinecount =3D 0 > - newContent =3D [] > - for Index in range(0, len(Content)): > - Line =3D Content[Index] > - if CODEBegin: > - CODELine =3D CODELine + Line > - continuelinecount +=3D1 > - if ")}" in Line: > - newContent.append(CODELine) > - for _ in range(continuelinecount): > - newContent.append("") > - CODEBegin =3D False > - CODELine =3D "" > - continuelinecount =3D 0 > - else: > - if not Line: > - newContent.append(Line) > - continue > - if "{CODE(" not in Line: > - newContent.append(Line) > - continue > - elif CODEPattern.findall(Line): > - newContent.append(Line) > - continue > - else: > - CODEBegin =3D True > - CODELine =3D Line > - > - return newContent >=20 > def _DecodeCODEData(self): > pass > ## PCD sections parser > # > @@ -1772,18 +1774,22 @@ class DecParser(MetaFileParser): >=20 > self._CurrentStructurePcdName =3D "" > self._include_flag =3D False > self._package_flag =3D False >=20 > + self._RestofValue =3D "" > + > ## Parser starter > def Start(self): > Content =3D '' > try: > Content =3D open(str(self.MetaFile), 'r').readlines() > except: > EdkLogger.error("Parser", FILE_READ_FAILURE, ExtraData=3Dsel= f.MetaFile) >=20 > + Content =3D self.ProcessMultipleLineCODEValue(Content) > + > self._DefinesCount =3D 0 > for Index in range(0, len(Content)): > Line, Comment =3D CleanString2(Content[Index]) > self._CurrentLine =3D Line > self._LineIndex =3D Index > @@ -1977,10 +1983,11 @@ class DecParser(MetaFileParser): > # [PcdsDynamicEx > # [PcdsDynamic] > # > @ParseMacro > def _PcdParser(self): > + > if self._CurrentStructurePcdName: > self._ValueList[0] =3D self._CurrentStructurePcdName >=20 > if "|" not in self._CurrentLine: > if "" =3D=3D self._CurrentLine: > @@ -2022,11 +2029,33 @@ class DecParser(MetaFileParser): > EdkLogger.error('Parser', FORMAT_INVALID, "Pcd N= ame does not match: %s and %s " % > (self._CurrentStructurePcdName, TAB_SPLIT.join(PcdNames[:2])), > File=3Dself.MetaFile, Line=3Dself._LineI= ndex + 1) > self._ValueList[1] =3D TAB_SPLIT.join(PcdNames[2:]) > self._ValueList[2] =3D PcdTockens[1] > if not self._CurrentStructurePcdName: > + if self._PcdDataTypeCODE: > + if ")}" in self._CurrentLine: > + ValuePart,RestofValue =3D self._CurrentLine.split(")= }") > + self._PcdCodeValue =3D self._PcdCodeValue + "\n " + = ValuePart > + self._CurrentLine =3D "|".join((self._CurrentPcdName= , self._PcdCodeValue,RestofValue)) > + self._PcdDataTypeCODE =3D False > + self._PcdCodeValue =3D "" > + else: > + self._PcdCodeValue =3D self._PcdCodeValue + "\n " + = self._CurrentLine > + self._ValueList =3D None > + return > TokenList =3D GetSplitValueList(self._CurrentLine, TAB_VALUE= _SPLIT, 1) > + self._CurrentPcdName =3D TokenList[0] > + if len(TokenList) =3D=3D 2 and TokenList[1].strip().startswi= th("{CODE"): > + if ")}" in self._CurrentLine: > + self._PcdDataTypeCODE =3D False > + self._PcdCodeValue =3D "" > + else: > + self._PcdDataTypeCODE =3D True > + self._PcdCodeValue =3D TokenList[1].strip() > + self._ValueList =3D None > + return > + > self._ValueList[0:1] =3D GetSplitValueList(TokenList[0], TAB= _SPLIT) > ValueRe =3D re.compile(r'^[a-zA-Z_][a-zA-Z0-9_]*') > # check PCD information > if self._ValueList[0] =3D=3D '' or self._ValueList[1] =3D=3D= '': > EdkLogger.error('Parser', FORMAT_INVALID, "No token spac= e GUID or PCD name specified", > diff --git a/BaseTools/Source/Python/build/BuildReport.py b/BaseTools/Sou= rce/Python/build/BuildReport.py > index ae37a6ce0e..4ae98698f3 100644 > --- a/BaseTools/Source/Python/build/BuildReport.py > +++ b/BaseTools/Source/Python/build/BuildReport.py > @@ -147,11 +147,11 @@ def FileWrite(File, String, Wrapper=3DFalse): >=20 > def ByteArrayForamt(Value): > IsByteArray =3D False > SplitNum =3D 16 > ArrayList =3D [] > - if Value.startswith('{') and Value.endswith('}'): > + if Value.startswith('{') and Value.endswith('}') and not Value.start= swith("{CODE("): > Value =3D Value[1:-1] > ValueList =3D Value.split(',') > if len(ValueList) >=3D SplitNum: > IsByteArray =3D True > if IsByteArray: > -- > 2.20.1.windows.1