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.120; helo=mga04.intel.com; envelope-from=liming.gao@intel.com; receiver=edk2-devel@lists.01.org Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (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 E7E9B22361E49 for ; Wed, 7 Feb 2018 19:01:25 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Feb 2018 19:07:10 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,476,1511856000"; d="scan'208";a="16843453" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga006.jf.intel.com with ESMTP; 07 Feb 2018 19:07:09 -0800 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 7 Feb 2018 19:07:09 -0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.125]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.116]) with mapi id 14.03.0319.002; Thu, 8 Feb 2018 11:07:07 +0800 From: "Gao, Liming" To: "Feng, Bob C" , "edk2-devel@lists.01.org" Thread-Topic: [Patch] BaseTool: Fixed Pcd issues. Thread-Index: AQHTn7esW7OF3LD8REqCgURjD826SaOZ1FJw Date: Thu, 8 Feb 2018 03:07:07 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14E1C9935@SHSMSX104.ccr.corp.intel.com> References: <20180207020159.12692-1-bob.c.feng@intel.com> In-Reply-To: <20180207020159.12692-1-bob.c.feng@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] BaseTool: Fixed Pcd issues. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Feb 2018 03:01:26 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Liming Gao >-----Original Message----- >From: Feng, Bob C >Sent: Wednesday, February 07, 2018 10:02 AM >To: edk2-devel@lists.01.org >Cc: Feng, Bob C ; Gao, Liming >Subject: [Patch] BaseTool: Fixed Pcd issues. > >1. Check variable offset when merging Hii Pcds >2. Fixed the issue of Hii value inherit with default store. >3. Error handling for incorrect structure pcd declare. > >Contributed-under: TianoCore Contribution Agreement 1.1 >Signed-off-by: Bob Feng >Cc: Liming Gao >--- > BaseTools/Source/Python/AutoGen/GenVar.py | 19 ++- > .../Source/Python/Workspace/BuildClassObject.py | 1 + > BaseTools/Source/Python/Workspace/DecBuildData.py | 7 +- > BaseTools/Source/Python/Workspace/DscBuildData.py | 152 +++++++++++- >--------- > 4 files changed, 100 insertions(+), 79 deletions(-) > >diff --git a/BaseTools/Source/Python/AutoGen/GenVar.py >b/BaseTools/Source/Python/AutoGen/GenVar.py >index 1389d7ff62..d222e6ed5e 100644 >--- a/BaseTools/Source/Python/AutoGen/GenVar.py >+++ b/BaseTools/Source/Python/AutoGen/GenVar.py >@@ -102,14 +102,31 @@ class VariableMgr(object): > data =3D value_list[0] > value_list =3D [] > for data_byte in pack(data_flag,int(data,16) if >data.upper().startswith('0X') else int(data)): > value_list +=3D [hex(unpack("B",data_byte)[0])] > newvalue[int(item.var_offset,16) if >item.var_offset.upper().startswith("0X") else int(item.var_offset)] =3D >value_list >- newvaluestr =3D "{" + ",".join(reduce(lambda x,y: x+y, [newva= lue[k] for k >in sorted(newvalue.keys())] )) +"}" >+ try: >+ newvaluestr =3D "{" + ",".join(self.assemble_variable(new= value)) +"}" >+ except: >+ EdkLogger.error("build", AUTOGEN_ERROR, "Variable offset = conflict >in PCDs: %s \n" % (" and ".join([item.pcdname for item in >sku_var_info_offset_list]))) > n =3D sku_var_info_offset_list[0] > indexedvarinfo[key] =3D >[var_info(n.pcdindex,n.pcdname,n.defaultstoragename,n.skuname,n.var_na >me, n.var_guid, "0x00",n.var_attribute,newvaluestr , newvaluestr , "VOID*= ")] > self.VarInfo =3D [item[0] for item in indexedvarinfo.values()] >+ >+ def assemble_variable(self, valuelist): >+ ordered_value =3D [valuelist[k] for k in sorted(valuelist.keys())= ] >+ ordered_offset =3D sorted(valuelist.keys()) >+ var_value =3D [] >+ num =3D 0 >+ for offset in ordered_offset: >+ if offset < len(var_value): >+ raise >+ for _ in xrange(offset - len(var_value)): >+ var_value.append('0x00') >+ var_value +=3D ordered_value[num] >+ num +=3D1 >+ return var_value > def process_variable_data(self): > > var_data =3D dict() > > indexedvarinfo =3D collections.OrderedDict() >diff --git a/BaseTools/Source/Python/Workspace/BuildClassObject.py >b/BaseTools/Source/Python/Workspace/BuildClassObject.py >index 0e1161c96f..f499cbd58b 100644 >--- a/BaseTools/Source/Python/Workspace/BuildClassObject.py >+++ b/BaseTools/Source/Python/Workspace/BuildClassObject.py >@@ -112,10 +112,11 @@ class StructurePcd(PcdClassObject): > def __init__(self, StructuredPcdIncludeFile=3DNone, Packages=3DNone, >Name=3DNone, Guid=3DNone, Type=3DNone, DatumType=3DNone, Value=3DNone, >Token=3DNone, MaxDatumSize=3DNone, SkuInfoList=3DNone, IsOverrided=3DFalse= , >GuidValue=3DNone, validateranges=3DNone, validlists=3DNone, >expressions=3DNone,default_store =3D TAB_DEFAULT_STORES_DEFAULT): > if SkuInfoList is None: SkuInfoList=3D{} > if validateranges is None: validateranges=3D[] > if validlists is None: validlists=3D[] > if expressions is None : expressions=3D[] >+ if Packages is None : Packages =3D [] > super(StructurePcd, self).__init__(Name, Guid, Type, DatumType, V= alue, >Token, MaxDatumSize, SkuInfoList, IsOverrided, GuidValue, validateranges, >validlists, expressions) > self.StructuredPcdIncludeFile =3D [] if StructuredPcdIncludeFile = is None else >StructuredPcdIncludeFile > self.PackageDecs =3D Packages > self.DefaultStoreName =3D [default_store] > self.DefaultValues =3D collections.OrderedDict({}) >diff --git a/BaseTools/Source/Python/Workspace/DecBuildData.py >b/BaseTools/Source/Python/Workspace/DecBuildData.py >index 2266b0b7a6..99c3bf14f1 100644 >--- a/BaseTools/Source/Python/Workspace/DecBuildData.py >+++ b/BaseTools/Source/Python/Workspace/DecBuildData.py >@@ -387,10 +387,12 @@ class DecBuildData(PackageBuildClassObject): > struct_pcd.PkgPath =3D self.MetaFile.File > else: > struct_pcd.AddDefaultValue(item.TokenCName, >item.DefaultValue,self.MetaFile.File,LineNo) > > struct_pcd.PackageDecs =3D dep_pkgs >+ if not struct_pcd.StructuredPcdIncludeFile: >+ EdkLogger.error("build", PCD_STRUCTURE_PCD_ERROR, "The >structure Pcd %s.%s header file is not found in %s line %s \n" % >(struct_pcd.TokenSpaceGuidCName, >struct_pcd.TokenCName,self.MetaFile.File,LineNo )) > > str_pcd_set.append(struct_pcd) > > return str_pcd_set > >@@ -421,15 +423,10 @@ class DecBuildData(PackageBuildClassObject): > Setting,LineNo =3D PcdDict[self._Arch, PcdCName, TokenSpaceGu= id] > if Setting =3D=3D None: > continue > > DefaultValue, DatumType, TokenNumber =3D AnalyzePcdData(Setti= ng) >- if DatumType not in [TAB_UINT8, TAB_UINT16, TAB_UINT32, >TAB_UINT64, TAB_VOID, "BOOLEAN"]: >- StructPattern =3D re.compile(r'[_a-zA-Z][0-9A-Za-z_]*$') >- if StructPattern.match(DatumType) =3D=3D None: >- EdkLogger.error('build', FORMAT_INVALID, "DatumType o= nly >support BOOLEAN, UINT8, UINT16, UINT32, UINT64, VOID* or a valid struct >name.", File=3Dself.MetaFile, Line=3DLineNo) >- > validateranges, validlists, expressions =3D >self._RawData.GetValidExpression(TokenSpaceGuid, PcdCName) > PcdObj =3D PcdClassObject( > PcdCName, > TokenSpaceGuid, > self._PCD_TYPE_STRING_[Type], >diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py >b/BaseTools/Source/Python/Workspace/DscBuildData.py >index 6e3cd0f3f1..87e79e8f92 100644 >--- a/BaseTools/Source/Python/Workspace/DscBuildData.py >+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py >@@ -1520,10 +1520,11 @@ class DscBuildData(PlatformBuildClassObject): > # the flexible array member. The flexible array member must = be the >last field > # in a structure. The size formula for this case is: > # OFFSET_OF(FlexbleArrayField) + sizeof(FlexibleArray[0]) * >(HighestIndex + 1) > # > CApp =3D CApp + ' Size =3D sizeof(%s);\n' % (Pcd.DatumType) >+ CApp =3D CApp + "// Default Value in Dec \n" > for FieldList in [Pcd.DefaultValues]: > if not FieldList: > continue > for FieldName in FieldList: > FieldName =3D "." + FieldName >@@ -1547,35 +1548,38 @@ class DscBuildData(PlatformBuildClassObject): > while '[' in FieldName: > 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]) > for skuname in self.SkuIdMgr.GetSkuChain(SkuName): > inherit_OverrideValues =3D Pcd.SkuOverrideValues[skuname] >- for FieldList in [inherit_OverrideValues.get(DefaultStore= Name)]: >- if not FieldList: >- continue >- for FieldName in FieldList: >- FieldName =3D "." + FieldName >- IsArray =3D >self.IsFieldValueAnArray(FieldList[FieldName.strip(".")][0]) >- if IsArray: >- try: >- Value =3D ValueExpressionEx(FieldList[Fie= ldName.strip(".")][0], >"VOID*", self._GuidDict)(True) >- except BadExpression: >- EdkLogger.error('Build', FORMAT_INVALID, = "Invalid value >format for %s. From %s Line %d " % >- (".".join((Pcd.TokenSpace= GuidCName, >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]); >- 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: >- 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]) >+ storeset =3D [DefaultStoreName] if DefaultStoreName =3D= =3D 'STANDARD' >else ['STANDARD', DefaultStoreName] >+ for defaultstorenameitem in storeset: >+ CApp =3D CApp + "// SkuName: %s, DefaultStoreName: %= s \n" % >(skuname, defaultstorenameitem) >+ for FieldList in >[inherit_OverrideValues.get(defaultstorenameitem)]: >+ if not FieldList: >+ continue >+ for FieldName in FieldList: >+ FieldName =3D "." + FieldName >+ IsArray =3D >self.IsFieldValueAnArray(FieldList[FieldName.strip(".")][0]) >+ if IsArray: >+ try: >+ Value =3D >ValueExpressionEx(FieldList[FieldName.strip(".")][0], "VOID*", >self._GuidDict)(True) >+ except BadExpression: >+ EdkLogger.error('Build', FORMAT_INVAL= ID, "Invalid value >format for %s. From %s Line %d " % >+ (".".join((Pcd.TokenS= paceGuidCName, >Pcd.TokenCName, FieldName.strip('.'))), FieldList[FieldName.strip(".")][1]= , >FieldList[FieldName.strip(".")][2])) >+ Value, ValueSize =3D ParseFieldValue(Valu= e) >+ 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 + Field= Name.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: >+ FieldName =3D FieldName.rsplit('[', 1= )[0] >+ CApp =3D CApp + ' __FLEXIBLE_SIZE(Si= ze, %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 skuname =3D=3D SkuName: > break > > # > # Allocate and zero buffer for the PCD >@@ -1592,10 +1596,11 @@ class DscBuildData(PlatformBuildClassObject): > CApp =3D CApp + ' memcpy (Pcd, OriginalPcd, OriginalSize);\n= ' > > # > # Assign field values in PCD > # >+ CApp =3D CApp + "// Default value in Dec \n" > for FieldList in [Pcd.DefaultValues]: > if not FieldList: > continue > for FieldName in FieldList: > IsArray =3D self.IsFieldValueAnArray(FieldList[FieldN= ame][0]) >@@ -1624,60 +1629,60 @@ class DscBuildData(PlatformBuildClassObject): > CApp =3D CApp + ' Pcd->%s =3D %dULL; // From= %s Line %d >Value %s\n' % (FieldName, Value, FieldList[FieldName][1], >FieldList[FieldName][2], FieldList[FieldName][0]) > else: > CApp =3D CApp + ' Pcd->%s =3D %d; // From %s= Line %d >Value %s\n' % (FieldName, Value, FieldList[FieldName][1], >FieldList[FieldName][2], FieldList[FieldName][0]) > for skuname in self.SkuIdMgr.GetSkuChain(SkuName): > inherit_OverrideValues =3D Pcd.SkuOverrideValues[skuname] >- for FieldList in >[Pcd.DefaultFromDSC,inherit_OverrideValues.get(DefaultStoreName)]: >- if not FieldList: >- continue >- if Pcd.DefaultFromDSC and FieldList =3D=3D Pcd.Defaul= tFromDSC: >- IsArray =3D self.IsFieldValueAnArray(FieldList) >- if IsArray: >- try: >- FieldList =3D ValueExpressionEx(FieldList= , "VOID*")(True) >- except BadExpression: >- EdkLogger.error("Build", FORMAT_INVALID, = "Invalid value >format for %s.%s, from DSC: %s" % >- (Pcd.TokenSpaceGuidCName,= Pcd.TokenCName, >FieldList)) >- >- Value, ValueSize =3D ParseFieldValue (FieldList) >- if isinstance(Value, str): >- CApp =3D CApp + ' Pcd =3D %s; // From DSC De= fault Value %s\n' % >(Value, Pcd.DefaultFromDSC) >- elif IsArray: >- # >- # Use memcpy() to copy value into field >- # >- CApp =3D CApp + ' Value =3D %s; // From = DSC Default >Value %s\n' % (self.IntToCString(Value, ValueSize), Pcd.DefaultFromDSC) >- CApp =3D CApp + ' memcpy (Pcd, Value, %d);\n= ' % (ValueSize) >- continue >- >- for FieldName in FieldList: >- IsArray =3D self.IsFieldValueAnArray(FieldList[Fi= eldName][0]) >- if IsArray: >+ storeset =3D [DefaultStoreName] if DefaultStoreName =3D= =3D 'STANDARD' >else ['STANDARD', DefaultStoreName] >+ for defaultstorenameitem in storeset: >+ CApp =3D CApp + "// SkuName: %s, DefaultStoreName: %= s \n" % >(skuname, defaultstorenameitem) >+ for FieldList in >[Pcd.DefaultFromDSC,inherit_OverrideValues.get(defaultstorenameitem)]: >+ if not FieldList: >+ continue >+ if Pcd.DefaultFromDSC and FieldList =3D=3D Pcd.De= faultFromDSC: >+ IsArray =3D self.IsFieldValueAnArray(FieldLis= t) >+ if IsArray: >+ try: >+ FieldList =3D ValueExpressionEx(Field= List, "VOID*")(True) >+ except BadExpression: >+ EdkLogger.error("Build", FORMAT_INVAL= ID, "Invalid value >format for %s.%s, from DSC: %s" % >+ (Pcd.TokenSpaceGuidCN= ame, Pcd.TokenCName, >FieldList)) >+ Value, ValueSize =3D ParseFieldValue (FieldLi= st) >+ if isinstance(Value, str): >+ CApp =3D CApp + ' Pcd =3D %s; // From DS= C Default Value %s\n' % >(Value, Pcd.DefaultFromDSC) >+ elif IsArray: >+ # >+ # Use memcpy() to copy value into field >+ # >+ CApp =3D CApp + ' Value =3D %s; // F= rom DSC Default >Value %s\n' % (self.IntToCString(Value, ValueSize), Pcd.DefaultFromDSC) >+ CApp =3D CApp + ' memcpy (Pcd, Value, %d= );\n' % (ValueSize) >+ continue >+ for FieldName in FieldList: >+ IsArray =3D self.IsFieldValueAnArray(FieldLis= t[FieldName][0]) >+ if IsArray: >+ try: >+ FieldList[FieldName][0] =3D >ValueExpressionEx(FieldList[FieldName][0], "VOID*", self._GuidDict)(True) >+ except BadExpression: >+ EdkLogger.error('Build', FORMAT_INVAL= ID, "Invalid value >format for %s. From %s Line %d " % >+ (".".join((Pcd.TokenS= paceGuidCName, >Pcd.TokenCName, FieldName)), FieldList[FieldName][1], >FieldList[FieldName][2])) > try: >- FieldList[FieldName][0] =3D >ValueExpressionEx(FieldList[FieldName][0], "VOID*", self._GuidDict)(True) >- except BadExpression: >- EdkLogger.error('Build', FORMAT_INVALID, = "Invalid value >format for %s. From %s Line %d " % >- (".".join((Pcd.TokenSpace= GuidCName, >Pcd.TokenCName, FieldName)), FieldList[FieldName][1], >FieldList[FieldName][2])) >- >- try: >- Value, ValueSize =3D ParseFieldValue (FieldLi= st[FieldName][0]) >- except Exception: >- EdkLogger.error('Build', FORMAT_INVALID, "Inv= alid value >format for %s. From %s Line %d " % >(".".join((Pcd.TokenSpaceGuidCName,Pcd.TokenCName,FieldName)),FieldLis >t[FieldName][1], FieldList[FieldName][2])) >- if isinstance(Value, str): >- CApp =3D CApp + ' Pcd->%s =3D %s; // From %s= Line %d >Value %s\n' % (FieldName, Value, FieldList[FieldName][1], >FieldList[FieldName][2], FieldList[FieldName][0]) >- elif 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' % >(self.IntToCString(Value, ValueSize), FieldList[FieldName][1], >FieldList[FieldName][2], FieldList[FieldName][0]) >- CApp =3D CApp + ' memcpy (&Pcd->%s[0], Value= , (FieldSize > 0 >&& FieldSize < %d) ? FieldSize : %d);\n' % (FieldName, ValueSize, ValueSiz= e) >- else: >- if ValueSize > 4: >- CApp =3D CApp + ' Pcd->%s =3D %dULL; // = >>From %s Line %d >Value %s\n' % (FieldName, Value, FieldList[FieldName][1], >FieldList[FieldName][2], FieldList[FieldName][0]) >+ Value, ValueSize =3D ParseFieldValue (Fie= ldList[FieldName][0]) >+ except Exception: >+ EdkLogger.error('Build', FORMAT_INVALID, = "Invalid value >format for %s. From %s Line %d " % >(".".join((Pcd.TokenSpaceGuidCName,Pcd.TokenCName,FieldName)),FieldLis >t[FieldName][1], FieldList[FieldName][2])) >+ if isinstance(Value, str): >+ CApp =3D CApp + ' Pcd->%s =3D %s; // Fro= m %s Line %d >Value %s\n' % (FieldName, Value, FieldList[FieldName][1], >FieldList[FieldName][2], FieldList[FieldName][0]) >+ elif 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; // F= rom %s Line %d >Value %s\n' % (self.IntToCString(Value, ValueSize), FieldList[FieldName][1= ], >FieldList[FieldName][2], FieldList[FieldName][0]) >+ CApp =3D CApp + ' memcpy (&Pcd->%s[0], V= alue, (FieldSize > 0 >&& FieldSize < %d) ? FieldSize : %d);\n' % (FieldName, ValueSize, ValueSiz= e) > else: >- CApp =3D CApp + ' Pcd->%s =3D %d; // Fro= m %s Line %d >Value %s\n' % (FieldName, Value, FieldList[FieldName][1], >FieldList[FieldName][2], FieldList[FieldName][0]) >+ if ValueSize > 4: >+ CApp =3D CApp + ' Pcd->%s =3D %dULL;= // From %s Line %d >Value %s\n' % (FieldName, Value, FieldList[FieldName][1], >FieldList[FieldName][2], FieldList[FieldName][0]) >+ else: >+ CApp =3D CApp + ' Pcd->%s =3D %d; //= From %s Line %d >Value %s\n' % (FieldName, Value, FieldList[FieldName][1], >FieldList[FieldName][2], FieldList[FieldName][0]) > if skuname =3D=3D SkuName: > break > # > # Set new PCD value and size > # >@@ -2290,10 +2295,11 @@ class DscBuildData(PlatformBuildClassObject): > None, > IsDsc=3DTrue) > for pcd in Pcds.values(): > SkuInfoObj =3D pcd.SkuInfoList.values()[0] > pcdDecObject =3D self._DecPcds[pcd.TokenCName, >pcd.TokenSpaceGuidCName] >+ pcd.DatumType =3D pcdDecObject.DatumType > # Only fix the value while no value provided in DSC file. > for sku in pcd.SkuInfoList.values(): > if (sku.DefaultValue =3D=3D "" or sku.DefaultValue=3D=3DN= one): > sku.DefaultValue =3D pcdDecObject.DefaultValue > if 'DEFAULT' not in pcd.SkuInfoList.keys() and 'COMMON' not i= n >pcd.SkuInfoList.keys(): >-- >2.14.3.windows.1