From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (NAM11-CO1-obe.outbound.protection.outlook.com [40.107.220.125]) by mx.groups.io with SMTP id smtpd.web12.394.1617900211389268179 for ; Thu, 08 Apr 2021 09:43:31 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@microsoft.com header.s=selector2 header.b=OaFfHezS; spf=pass (domain: microsoft.com, ip: 40.107.220.125, mailfrom: bret.barkelew@microsoft.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CTNy1OXXgSaBwUY5O2rqRcBrXsSYLA4TCZA62+ad5NxFsjWXPGX9W3Npx6XlEz1Mbh7QFOCOfoPRxxTiRKj/YVUlzUWNRLJnlezHHT7NpGOernTMJp3kATkQaM4MfpZUQowIf1AE/WdbOjJuwGK4V4Dq/KE8kiJ6sg0L0Ll2ufPmeFyUgGagQg6ywfXqazUDhk5aB17tdFNbfPSdtvrBV73kQQcmSLOjf7Vw4uYSDhJMg/hO/jxVm66IwHOxM7QKSTLPQ1KXep2JyvX2b8Biy+oHedM5dLHpbgRflnJ5X2UNEj5PQ0g68svyuUA5IOiKGPN+4yQPQr8QA8UsqpZV+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=LsViFu+FSrLz1OKGNXaL2EtAG/6O4IvYhfeBlmC1M14=; b=XoEK4A+LdOE4oWfsT5DhUJqvCoQPi7CR6VGBl+8uLoI2otgpEbm3ADmB3O3mlAAOXOuhIsKwXetaihOq1WQZ3juD/rHeuuxeMBXzHte9Xr4bETg+BRbsb9WGurOgOIT8bgJjgjJeH6fy/xXOzJOsGuckZq369yJJOnBF+VPhLriGWnA616/d79jqOa4Z8jHWaWZRzaxQTpUIwww/chXJvveKr4BvfAPuxAfrqlCQb0bdA8k9Ad6IoKFDJ+MSl0RdrvLW4tPq0VY01JIDY1q/LaZChCJe6SKWLZmvBAu4BWoIhG112vo1gjlZZsvJuskEPu+WL6q+6U5QpGNmrk2u5g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microsoft.com; dmarc=pass action=none header.from=microsoft.com; dkim=pass header.d=microsoft.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=LsViFu+FSrLz1OKGNXaL2EtAG/6O4IvYhfeBlmC1M14=; b=OaFfHezSk2i9VIN0qkhnIdCj6fu3vQH4C+X/LwBxOb0+SrTlTPkxrRvs6seC/dBg9QqznLADFfpV8/PCm25Kjnr+7vJYF0Hv1eQbzB9EEjVDkVs6S4baBul0STwVIVqIXnHSOh4fg00H4eKg9LbBBA+n88ELW7+Zt8UwMjX5JWA= Received: from MW4PR21MB1907.namprd21.prod.outlook.com (2603:10b6:303:71::8) by MW4PR21MB1860.namprd21.prod.outlook.com (2603:10b6:303:7a::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4042.3; Thu, 8 Apr 2021 16:43:24 +0000 Received: from MW4PR21MB1907.namprd21.prod.outlook.com ([fe80::adcb:b821:ee26:3348]) by MW4PR21MB1907.namprd21.prod.outlook.com ([fe80::adcb:b821:ee26:3348%7]) with mapi id 15.20.4042.006; Thu, 8 Apr 2021 16:43:24 +0000 From: "Bret Barkelew" To: "Chen, Yuwei" , "devel@edk2.groups.io" CC: "Liang, MingyueX" , "Feng, Bob C" , Liming Gao Subject: Re: [EXTERNAL] [edk2-devel] [PATCH 1/1] BaseTools/Ecc: Update structpcd parsing method. Thread-Topic: [EXTERNAL] [edk2-devel] [PATCH 1/1] BaseTools/Ecc: Update structpcd parsing method. Thread-Index: AQHXJsUz2RCERSIT3kaLyOYWA1O7NKqf3qVHgAhdxUCAAqKMnA== Date: Thu, 8 Apr 2021 16:43:24 +0000 Message-ID: References: <20210401070352.1743-1-yuwei.chen@intel.com> , In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Enabled=True;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SiteId=72f988bf-86f1-41af-91ab-2d7cd011db47;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SetDate=2021-04-01T16:43:07.3182999Z;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_ContentBits=0;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Method=Privileged authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=microsoft.com; x-originating-ip: [174.21.70.23] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 095b9953-b64a-449d-d6ea-08d8faad6d49 x-ms-traffictypediagnostic: MW4PR21MB1860: x-ld-processed: 72f988bf-86f1-41af-91ab-2d7cd011db47,ExtAddr x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:1091; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: FlxI/LNdWbKQZ7Nvn2mC1+gIk81unp9a9IEmrq3HV616JD9zkKgltOzbbwpnv+yvytcMMXqUjvU2/QG4YmO4sKAnxoIyc1dKGbmenLN+ge4gvfGEEF8U+/xRGXGW3ikMGRNl7FtLgF3X+lSyCIQvAJJ9rScSQRqpFUR+7Q5EDoEwOQTfOoOB0tvFg6j2Xzf2cHXiOqGUa1b+pRthbI5EPg1z02jxky5+HfSw4gdLbdlFGWqf16dvGKr/8gvSWyIt62byzyskzS+slWFlBIUSMec+dTKIBEVfhVp2ZI7jys0OOBxZnA8mxLcsfeaCFzTMWRYAx3b8uC2KqP6d9sYbCsq4DDv0Hn/K4wJeIgfEVHy1J498qOgliC8aBdE+UtVY9miJO7pj710eVeDlPpv/AdVjtty4jV2321WUPoNj/6r/KFO+mrHvIVmGfLDEm89Zd7o4m/NkYbheplPTFFYNkH7XwBjzw4zYV5qkU/SVLxpY1ceGM5sjkJuQGQlVK9+lTO6WKg0rp3496RzTMLxM9A15nlDlP1US2ivHM2Latdqh9Auqt1tBwm6RWb6fqjyRa9sRUYgrUmjm+hWKTmbtkD7Sr+3aEZcJJdaY95YBBOSiItfYULfKU6vZkO/pOm18kq6u77aURyep/bsE+xW3zvWvmKfn8sffWwoSuRjpSfcm7KDHfPlmOheX9EMXq/sRLWL5lq9fV0k3qdoIQFPb7M86On0DS9Bmdw0EwBKgDZ4= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MW4PR21MB1907.namprd21.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(136003)(376002)(396003)(346002)(39860400002)(83380400001)(86362001)(9686003)(55016002)(66446008)(66556008)(26005)(2906002)(15650500001)(52536014)(8990500004)(38100700001)(4326008)(186003)(53546011)(5660300002)(30864003)(82960400001)(33656002)(71200400001)(6506007)(966005)(8676002)(7696005)(10290500003)(8936002)(76116006)(54906003)(66476007)(316002)(478600001)(110136005)(66946007)(166002)(64756008)(82950400001)(579004)(559001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: =?Windows-1252?Q?nOF6PodJ8NDV6uiGnvjI8334qMuTluDQYDGzOJm3NrjSClRpGn0pyABR?= =?Windows-1252?Q?1JBMA5vGFcqTQZjtoaaPZux00U4694Uob63NOmx9cEiWy1iQUBNvcskw?= =?Windows-1252?Q?iAdPlWFE+EZYJtgcxWOWoUnvGrPOixVyFa661shLsAX2kli1Kbu08HND?= =?Windows-1252?Q?u2XUTeOgf6cv8DLsL+VAoo4PCLtRw6cojrjWCgbhMPtC05wwbYI++i2+?= =?Windows-1252?Q?+u5UW+yC0pKrmGO6XowrqdlaPdmOB2R3o+OjkTi/RSSNdm4cUCtFMZEN?= =?Windows-1252?Q?fuYsmH6ovq/c0XCra+gr2cKJZegGVplaoCIPjM54ay2HrRbzcYKPQYJ2?= =?Windows-1252?Q?RCL6882BtQm2XumC0mV/OC6Intms4CmqotytLOoDBZMs5hVwS04WUhDB?= =?Windows-1252?Q?NWtrqHoruBPxRLSDeP7b1wRF4/YMsqFo8k2bWRAWWXZEGe/XjbeNW4fB?= =?Windows-1252?Q?0WOW3hglqCbU9IKdNot9z7Jt12lcdnXPD2z+DzGFibvTkb4sTOLVJn0E?= =?Windows-1252?Q?dOd0exd3sNNTpoESY3RdIXJIDzaaUJpOIypOLrLZPm/xJ9fn+WQgEXqp?= =?Windows-1252?Q?1KvzsWGWMIQVIAzQq6PvSX+a56H5sZsttRCkMb64KJzKJpsNJsS346q8?= =?Windows-1252?Q?qPempWX5FF2lUM+82NcNmtroVT6tJKUW/9va1U38ZFMz0bxbfeHOM9PD?= =?Windows-1252?Q?/jy+5acT+M/JovFHKL3iHucExPgKmLRyp5FR/sXTELG70+Dk1rvp/3Vf?= =?Windows-1252?Q?3MdSE4MqHOaIwk4H52uPS0fcZz0lGuRmviKGkKPsJqdeG1s6o6B0FKh8?= =?Windows-1252?Q?fhmm+zBd1MLQ2MiQh+wx4JR2+jkeixgQ1f//qegWmqoK5fDv1T5kv/Vu?= =?Windows-1252?Q?zrkzTMvwYWyfqGqavXw1FL5FYYUAWMbsQmTvB6Nis44z1vAVTuawoscs?= =?Windows-1252?Q?8kDZYpmSaVsa7lmLLb4d77l2IEAberYBL/PkbFlHREQMtqrHwwcIZD9N?= =?Windows-1252?Q?KMnsL8zK20zlm1pn+RsO1daAkirJNtbCt8MvYAzt4XmiVFAnrYddJTWw?= =?Windows-1252?Q?nND8/uhab5TVMRVKhhjlVJXFANcCxZnoObq5+0/ZsrmJQq6DvpR2KCwe?= =?Windows-1252?Q?dixoMClN+Xgmc41g42wLzxRIszQbEAe7kmNZ8x+tu1uW828EZznSfpIK?= =?Windows-1252?Q?J8sCmAW/8XeBpf6j+EdWWzOfGG2b53CcfVvjqLiR/5IEt0e3Ir8MCrB5?= =?Windows-1252?Q?kcUC/kkcyqqjBL6Tr4guWncBVQdL8yE/zkuclJNODe661UWXM8M1xSSu?= =?Windows-1252?Q?sFKDW75hmwsF8aRk10XQm1R222UNFD5cuFQxjam3QfQF9MMXnKeBhI90?= =?Windows-1252?Q?bPmrmD8vk3al7qRRXVoYsh5XAc+uybN6T0bd8V5b73dglGkRcVVn1UWd?= =?Windows-1252?Q?Eq11W2JeD3ql/xFGaZ8KEQ=3D=3D?= x-ms-exchange-transport-forked: True MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MW4PR21MB1907.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 095b9953-b64a-449d-d6ea-08d8faad6d49 X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Apr 2021 16:43:24.2348 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: wo0NoC9FEP6Q/jefmgTZvKAqOkysPsgHskjuDm1C7Hom8860eUFJ4H8PJjHBp89AgP4La9UgzEDBUTBq4x5TZg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR21MB1860 Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_MW4PR21MB19075000390207AB161A2E70EF749MW4PR21MB1907namp_" --_000_MW4PR21MB19075000390207AB161A2E70EF749MW4PR21MB1907namp_ Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable Ah! Gotcha. I missed that this was specific to ECC. Thanks! - Bret From: Chen, Christine Sent: Wednesday, April 7, 2021 6:42 PM To: Bret Barkelew; devel@edk2.groups.i= o Cc: Liang, MingyueX; Feng, Bob C; Liming Gao Subject: RE: [EXTERNAL] [edk2-devel] [PATCH 1/1] BaseTools/Ecc: Update str= uctpcd parsing method. Hi Bret, This patch adds the ECC check for structurePcd written in des/dsc file, as= the origin check is only for non-structured Pcd. Best Regards, Yuwei (Christine) From: Bret Barkelew Sent: Friday, April 2, 2021 12:43 AM To: devel@edk2.groups.io; Chen, Christine Cc: Liang, MingyueX ; Feng, Bob C ; Liming Gao Subject: RE: [EXTERNAL] [edk2-devel] [PATCH 1/1] BaseTools/Ecc: Update str= uctpcd parsing method. What does =93update=94 mean in this context? What behavior is changing? - Bret From: Yuwei Chen via groups.io Sent: Thursday, April 1, 2021 12:04 AM To: devel@edk2.groups.io Cc: mliang2x; Feng, Bob C; Liming Gao Subject: [EXTERNAL] [edk2-devel] [PATCH 1/1] BaseTools/Ecc: Update structp= cd parsing method. From: mliang2x > Update the pcdparser method in Dec and DSC files. Signed-off-by: Mingyue Liang > Cc: Bob Feng > Cc: Liming Gao > Cc: Yuwei Chen > --- .../Ecc/MetaFileWorkspace/MetaFileParser.py | 464 ++++++++++-------- 1 file changed, 265 insertions(+), 199 deletions(-) diff --git a/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.= py b/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py index 9c27c8e16a05..588d3dbe6ed5 100644 --- a/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py +++ b/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py @@ -22,7 +22,7 @@ import Ecc.EccToolError as EccToolError from CommonDataClass.DataClass import * from Common.DataType import * from Common.StringUtils import * -from Common.Misc import GuidStructureStringToGuidString, CheckPcdDatum, P= athClass, AnalyzePcdData +from Common.Misc import GuidStructureStringToGuidString, CheckPcdDatum, P= athClass, AnalyzePcdData, AnalyzeDscPcd, AnalyzePcdExpression, ParseFieldVa= lue, StructPattern from Common.Expression import * from CommonDataClass.Exceptions import * @@ -31,6 +31,8 @@ from GenFds.FdfParser import FdfParser from Common.LongFilePathSupport import OpenLongFilePath as open from Common.LongFilePathSupport import CodecOpenLongFilePath +CODEPattern =3D re.compile(r"{CODE\([a-fA-F0-9Xx\{\},\s]*\)}") + ## A decorator used to parse macro definition def ParseMacro(Parser): def MacroParser(self): @@ -174,6 +176,11 @@ class MetaFileParser(object): # UNI object and extra UNI object self._UniObj =3D None self._UniExtraObj =3D None + # StructPcd var + self._PcdCodeValue =3D "" + self._PcdDataTypeCODE =3D False + self._CurrentPcdName =3D "" + self._GuidDict =3D {} # for Parser PCD value {GUID(gTokeSpaceGui= dName)} ## Store the parsed data in table def _Store(self, *Args): @@ -395,6 +402,40 @@ class MetaFileParser(object): Macros.update(self._SectionsMacroDict[(self._SectionType,= Scope1, Scope2)]) return Macros + 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 {} Finished =3D property(_GetFinished, _SetFinished) _Macros =3D property(_GetMacros) @@ -812,6 +853,8 @@ class DscParser(MetaFileParser): Content =3D open(str(self.MetaFile.Path), 'r').readlines() except: EdkLogger.error("Parser", FILE_READ_FAILURE, ExtraData=3Dself= .MetaFile) + + Content =3D self.ProcessMultipleLineCODEValue(Content) # # Insert a record for file # @@ -1018,24 +1061,71 @@ class DscParser(MetaFileParser): # @ParseMacro def _PcdParser(self): + if self._PcdDataTypeCODE: + self._PcdCodeValue =3D self._PcdCodeValue + "\n " + self._Cur= rentLine + if self._CurrentLine.endswith(")}"): + self._CurrentLine =3D "|".join((self._CurrentPcdName, sel= f._PcdCodeValue)) + self._PcdDataTypeCODE =3D False + self._PcdCodeValue =3D "" + else: + self._ValueList =3D None + return TokenList =3D GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLI= T, 1) + self._CurrentPcdName =3D TokenList[0] + if len(TokenList) =3D=3D 2 and TokenList[1].strip().startswith("{= CODE"): + self._PcdDataTypeCODE =3D True + self._PcdCodeValue =3D TokenList[1].strip() + + if self._PcdDataTypeCODE: + if self._CurrentLine.endswith(")}"): + self._PcdDataTypeCODE =3D False + self._PcdCodeValue =3D "" + else: + self._ValueList =3D None + return self._ValueList[0:1] =3D GetSplitValueList(TokenList[0], TAB_SPLI= T) + PcdNameTockens =3D GetSplitValueList(TokenList[0], TAB_SPLIT) + if len(PcdNameTockens) =3D=3D 2: + self._ValueList[0], self._ValueList[1] =3D PcdNameTockens[0],= PcdNameTockens[1] + elif len(PcdNameTockens) =3D=3D 3: + self._ValueList[0], self._ValueList[1] =3D ".".join((PcdNameT= ockens[0], PcdNameTockens[1])), PcdNameTockens[2] + elif len(PcdNameTockens) > 3: + self._ValueList[0], self._ValueList[1] =3D ".".join((PcdNameT= ockens[0], PcdNameTockens[1])), ".".join(PcdNameTockens[2:]) if len(TokenList) =3D=3D 2: self._ValueList[2] =3D TokenList[1] if self._ValueList[0] =3D=3D '' or self._ValueList[1] =3D=3D '': EdkLogger.error('Parser', FORMAT_INVALID, "No token space GUI= D or PCD name specified", ExtraData=3Dself._CurrentLine + " (.|)", - File=3Dself.MetaFile, Line=3Dself._LineIndex+= 1) + File=3Dself.MetaFile, Line=3Dself._LineIndex = + 1) if self._ValueList[2] =3D=3D '': + # + # The PCD values are optional for FIXEDATBUILD, PATCHABLEINMO= DULE, Dynamic/DynamicEx default + # + if self._SectionType in (MODEL_PCD_FIXED_AT_BUILD, MODEL_PCD_= PATCHABLE_IN_MODULE, MODEL_PCD_DYNAMIC_DEFAULT, MODEL_PCD_DYNAMIC_EX_DEFAUL= T): + return EdkLogger.error('Parser', FORMAT_INVALID, "No PCD value given= ", ExtraData=3Dself._CurrentLine + " (.|)", - File=3Dself.MetaFile, Line=3Dself._LineIndex+= 1) + File=3Dself.MetaFile, Line=3Dself._LineIndex = + 1) + + # Validate the datum type of Dynamic Defaul PCD and DynamicEx Def= ault PCD + ValueList =3D GetSplitValueList(self._ValueList[2]) + if len(ValueList) > 1 and ValueList[1] in [TAB_UINT8, TAB_UINT16,= TAB_UINT32, TAB_UINT64] \ + and self._ItemType in [MODEL_PCD_DYNAMIC_DE= FAULT, MODEL_PCD_DYNAMIC_EX_DEFAULT]: + EdkLogger.error('Parser', FORMAT_INVALID, "The datum type '%s= ' of PCD is wrong" % ValueList[1], + ExtraData=3Dself._CurrentLine, File=3Dself.Me= taFile, Line=3Dself._LineIndex + 1) + + # Validate the VariableName of DynamicHii and DynamicExHii for PC= D Entry must not be an empty string + if self._ItemType in [MODEL_PCD_DYNAMIC_HII, MODEL_PCD_DYNAMIC_EX= _HII]: + DscPcdValueList =3D GetSplitValueList(TokenList[1], TAB_VALUE= _SPLIT, 1) + if len(DscPcdValueList[0].replace('L', '').replace('"', '').s= trip()) =3D=3D 0: + EdkLogger.error('Parser', FORMAT_INVALID, "The VariableNa= me field in the HII format PCD entry must not be an empty string", + ExtraData=3Dself._CurrentLine, File=3Dself.Me= taFile, Line=3Dself._LineIndex + 1) # if value are 'True', 'true', 'TRUE' or 'False', 'false', 'FALSE= ', replace with integer 1 or 0. DscPcdValueList =3D GetSplitValueList(TokenList[1], TAB_VALUE_SPL= IT, 1) if DscPcdValueList[0] in ['True', 'true', 'TRUE']: - self._ValueList[2] =3D TokenList[1].replace(DscPcdValueList[0= ], '1', 1); + self._ValueList[2] =3D TokenList[1].replace(DscPcdValueList[0= ], '1', 1) elif DscPcdValueList[0] in ['False', 'false', 'FALSE']: - self._ValueList[2] =3D TokenList[1].replace(DscPcdValueList[0= ], '0', 1); + self._ValueList[2] =3D TokenList[1].replace(DscPcdValueList[0= ], '0', 1) ## [components] section parser @ParseMacro @@ -1502,6 +1592,10 @@ class DecParser(MetaFileParser): self._include_flag =3D False self._package_flag =3D False + self._AllPCDs =3D [] # Only for check duplicate PCD + self._AllPcdDict =3D {} + + ## Parser starter def Start(self): Content =3D '' @@ -1510,6 +1604,7 @@ class DecParser(MetaFileParser): except: EdkLogger.error("Parser", FILE_READ_FAILURE, ExtraData=3Dself= .MetaFile) + Content =3D self.ProcessMultipleLineCODEValue(Content) # # Insert a record for file # @@ -1707,51 +1802,6 @@ class DecParser(MetaFileParser): namelist[2] =3D ".".join((arrayindex,namelist[2])) return namelist - def StructPcdParser(self): - self._ValueList[0] =3D self._CurrentStructurePcdName - - if "|" not in self._CurrentLine: - if "" =3D=3D self._CurrentLine: - self._include_flag =3D True - self._package_flag =3D False - self._ValueList =3D None - return - if "" =3D=3D self._CurrentLine: - self._package_flag =3D True - self._ValueList =3D None - self._include_flag =3D False - return - - if self._include_flag: - self._ValueList[1] =3D "_" + md5(self._Curre= ntLine.encode('utf-8')).hexdigest() - self._ValueList[2] =3D self._CurrentLine - if self._package_flag and "}" !=3D self._CurrentLine: - self._ValueList[1] =3D "_" + md5(self._CurrentL= ine.encode('utf-8')).hexdigest() - self._ValueList[2] =3D self._CurrentLine - if self._CurrentLine =3D=3D "}": - self._package_flag =3D False - self._include_flag =3D False - self._ValueList =3D None - else: - PcdTockens =3D self._CurrentLine.split(TAB_VALUE_SPLIT) - PcdNames =3D self.ParsePcdName(PcdTockens[0].split(TAB_SPLIT)= ) - if len(PcdNames) =3D=3D 2: - if PcdNames[1].strip().endswith("]"): - PcdName =3D PcdNames[1][:PcdNames[1].index('[')] - Index =3D PcdNames[1][PcdNames[1].index('['):] - self._ValueList[0] =3D TAB_SPLIT.join((PcdNames[0], P= cdName)) - self._ValueList[1] =3D Index - self._ValueList[2] =3D PcdTockens[1] - else: - self._CurrentStructurePcdName =3D "" - else: - if self._CurrentStructurePcdName !=3D TAB_SPLIT.join(PcdN= ames[:2]): - EdkLogger.error('Parser', FORMAT_INVALID, "Pcd Name d= oes not match: %s and %s " % ( - self._CurrentStructurePcdName, TAB_SPLIT.join(PcdName= s[:2])), - File=3Dself.MetaFile, Line=3Dself._Li= neIndex + 1) - self._ValueList[1] =3D TAB_SPLIT.join(PcdNames[2:]) - self._ValueList[2] =3D PcdTockens[1] - ## PCD sections parser # # [PcdsFixedAtBuild] @@ -1763,159 +1813,175 @@ class DecParser(MetaFileParser): @ParseMacro def _PcdParser(self): if self._CurrentStructurePcdName: - self.StructPcdParser() - return - TokenList =3D GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLI= T, 1) - self._ValueList[0:1] =3D GetSplitValueList(TokenList[0], TAB_SPLI= T) - # check PCD information - if self._ValueList[0] =3D=3D '' or self._ValueList[1] =3D=3D '': - EdkLogger.error('Parser', FORMAT_INVALID, "No token space GUI= D or PCD name specified", - ExtraData=3Dself._CurrentLine + \ - " (.= |||)", - File=3Dself.MetaFile, Line=3Dself._LineIndex+= 1) - # check PCD datum information - if len(TokenList) < 2 or TokenList[1] =3D=3D '': - EdkLogger.error('Parser', FORMAT_INVALID, "No PCD Datum infor= mation given", - ExtraData=3Dself._CurrentLine + \ - " (.= |||)", - File=3Dself.MetaFile, Line=3Dself._LineIndex+= 1) - - - ValueRe =3D re.compile(r'^\s*L?\".*\|.*\"') - PtrValue =3D ValueRe.findall(TokenList[1]) - - # Has VOID* type string, may contain "|" character in the string. - if len(PtrValue) !=3D 0: - ptrValueList =3D re.sub(ValueRe, '', TokenList[1]) - ValueList =3D GetSplitValueList(ptrValueList) - ValueList[0] =3D PtrValue[0] - else: - ValueList =3D GetSplitValueList(TokenList[1]) - - - # check if there's enough datum information given - if len(ValueList) !=3D 3: - EdkLogger.error('Parser', FORMAT_INVALID, "Invalid PCD Datum = information given", - ExtraData=3Dself._CurrentLine + \ - " (.= |||)", - File=3Dself.MetaFile, Line=3Dself._LineIndex+= 1) - # check default value - if ValueList[0] =3D=3D '': - EdkLogger.error('Parser', FORMAT_INVALID, "Missing DefaultVal= ue in PCD Datum information", - ExtraData=3Dself._CurrentLine + \ - " (.= |||)", - File=3Dself.MetaFile, Line=3Dself._LineIndex+= 1) - # check datum type - if ValueList[1] =3D=3D '': - EdkLogger.error('Parser', FORMAT_INVALID, "Missing DatumType = in PCD Datum information", - ExtraData=3Dself._CurrentLine + \ - " (.= |||)", - File=3Dself.MetaFile, Line=3Dself._LineIndex+= 1) - # check token of the PCD - if ValueList[2] =3D=3D '': - EdkLogger.error('Parser', FORMAT_INVALID, "Missing Token in P= CD Datum information", - ExtraData=3Dself._CurrentLine + \ - " (.= |||)", - File=3Dself.MetaFile, Line=3Dself._LineIndex+= 1) - # check format of default value against the datum type - IsValid, Cause =3D CheckPcdDatum(ValueList[1], ValueList[0]) - if not IsValid: - EdkLogger.error('Parser', FORMAT_INVALID, Cause, ExtraData=3D= self._CurrentLine, - File=3Dself.MetaFile, Line=3Dself._LineIndex+= 1) - if Cause =3D=3D "StructurePcd": - self._CurrentStructurePcdName =3D TAB_SPLIT.join(self._ValueL= ist[0:2]) self._ValueList[0] =3D self._CurrentStructurePcdName - self._ValueList[1] =3D ValueList[1].strip() - if EccGlobalData.gConfig.UniCheckPCDInfo =3D=3D '1' or EccGlobalD= ata.gConfig.UniCheckAll =3D=3D '1' or EccGlobalData.gConfig.CheckAll =3D=3D= '1': - # check Description, Prompt information - PatternDesc =3D re.compile('##\s*([\x21-\x7E\s]*)', re.S) - PatternPrompt =3D re.compile('#\s+@Prompt\s+([\x21-\x7E\s]*)'= , re.S) - Description =3D None - Prompt =3D None - # check @ValidRange, @ValidList and @Expression format valid - ErrorCodeValid =3D '0x0 <=3D %s <=3D 0xFFFFFFFF' - PatternValidRangeIn =3D '(NOT)?\s*(\d+\s*-\s*\d+|0[xX][a-fA-F= 0-9]+\s*-\s*0[xX][a-fA-F0-9]+|LT\s*\d+|LT\s*0[xX][a-fA-F0-9]+|GT\s*\d+|GT\s= *0[xX][a-fA-F0-9]+|LE\s*\d+|LE\s*0[xX][a-fA-F0-9]+|GE\s*\d+|GE\s*0[xX][a-fA= -F0-9]+|XOR\s*\d+|XOR\s*0[xX][a-fA-F0-9]+|EQ\s*\d+|EQ\s*0[xX][a-fA-F0-9]+)' - PatternValidRng =3D re.compile('^' + '(NOT)?\s*' + PatternVal= idRangeIn + '$') - for Comment in self._Comments: - Comm =3D Comment[0].strip() - if not Comm: - continue - if not Description: - Description =3D PatternDesc.findall(Comm) - if not Prompt: - Prompt =3D PatternPrompt.findall(Comm) - if Comm[0] =3D=3D '#': - ValidFormt =3D Comm.lstrip('#') - ValidFormt =3D ValidFormt.lstrip() - if ValidFormt[0:11] =3D=3D '@ValidRange': - ValidFormt =3D ValidFormt[11:] - ValidFormt =3D ValidFormt.lstrip() - try: - ErrorCode, Expression =3D ValidFormt.split('|= ', 1) - except ValueError: - ErrorCode =3D '0x0' - Expression =3D ValidFormt - ErrorCode, Expression =3D ErrorCode.strip(), Expr= ession.strip() - try: - if not eval(ErrorCodeValid % ErrorCode): - EdkLogger.warn('Parser', '@ValidRange Err= orCode(%s) of PCD %s is not valid UINT32 value.' % (ErrorCode, TokenList[0]= )) - except: - EdkLogger.warn('Parser', '@ValidRange ErrorCo= de(%s) of PCD %s is not valid UINT32 value.' % (ErrorCode, TokenList[0])) - if not PatternValidRng.search(Expression): - EdkLogger.warn('Parser', '@ValidRange Express= ion(%s) of PCD %s is incorrect format.' % (Expression, TokenList[0])) - if ValidFormt[0:10] =3D=3D '@ValidList': - ValidFormt =3D ValidFormt[10:] - ValidFormt =3D ValidFormt.lstrip() - try: - ErrorCode, Expression =3D ValidFormt.split('|= ', 1) - except ValueError: - ErrorCode =3D '0x0' - Expression =3D ValidFormt - ErrorCode, Expression =3D ErrorCode.strip(), Expr= ession.strip() - try: - if not eval(ErrorCodeValid % ErrorCode): - EdkLogger.warn('Parser', '@ValidList Erro= rCode(%s) of PCD %s is not valid UINT32 value.' % (ErrorCode, TokenList[0])= ) - except: - EdkLogger.warn('Parser', '@ValidList ErrorCod= e(%s) of PCD %s is not valid UINT32 value.' % (ErrorCode, TokenList[0])) - Values =3D Expression.split(',') - for Value in Values: - Value =3D Value.strip() - try: - eval(Value) - except: - EdkLogger.warn('Parser', '@ValidList Expr= ession of PCD %s include a invalid value(%s).' % (TokenList[0], Value)) - break - if ValidFormt[0:11] =3D=3D '@Expression': - ValidFormt =3D ValidFormt[11:] - ValidFormt =3D ValidFormt.lstrip() - try: - ErrorCode, Expression =3D ValidFormt.split('|= ', 1) - except ValueError: - ErrorCode =3D '0x0' - Expression =3D ValidFormt - ErrorCode, Expression =3D ErrorCode.strip(), Expr= ession.strip() - try: - if not eval(ErrorCodeValid % ErrorCode): - EdkLogger.warn('Parser', '@Expression Err= orCode(%s) of PCD %s is not valid UINT32 value.' % (ErrorCode, TokenList[0]= )) - except: - EdkLogger.warn('Parser', '@Expression ErrorCo= de(%s) of PCD %s is not valid UINT32 value.' % (ErrorCode, TokenList[0])) - if not Expression: - EdkLogger.warn('Parser', '@Expression Express= ion of PCD %s is incorrect format.' % TokenList[0]) - if not Description: - EdkLogger.warn('Parser', 'PCD %s Description information = is not provided.' % TokenList[0]) - if not Prompt: - EdkLogger.warn('Parser', 'PCD %s Prompt information is no= t provided.' % TokenList[0]) - # check Description, Prompt localization information - if self._UniObj: - self._UniObj.CheckPcdInfo(TokenList[0]) + if "|" not in self._CurrentLine: + if "" =3D=3D self._CurrentLine: + self._include_flag =3D True + self._package_flag =3D False + self._ValueList =3D None + return + if "" =3D=3D self._CurrentLine: + self._package_flag =3D True + self._ValueList =3D None + self._include_flag =3D False + return - if ValueList[0] in ['True', 'true', 'TRUE']: - ValueList[0] =3D '1' - elif ValueList[0] in ['False', 'false', 'FALSE']: - ValueList[0] =3D '0' + if self._include_flag: + self._ValueList[1] =3D "_" + md5(self._C= urrentLine.encode('utf-8')).hexdigest() + self._ValueList[2] =3D self._CurrentLine + if self._package_flag and "}" !=3D self._CurrentLine: + self._ValueList[1] =3D "_" + md5(self._Curr= entLine.encode('utf-8')).hexdigest() + self._ValueList[2] =3D self._CurrentLine + if self._CurrentLine =3D=3D "}": + self._package_flag =3D False + self._include_flag =3D False + self._ValueList =3D None + return + else: + PcdTockens =3D self._CurrentLine.split(TAB_VALUE_SPLIT) + PcdNames =3D self.ParsePcdName(PcdTockens[0].split(TAB_SP= LIT)) + if len(PcdNames) =3D=3D 2: + if PcdNames[1].strip().endswith("]"): + PcdName =3D PcdNames[1][:PcdNames[1].index('[')] + Index =3D PcdNames[1][PcdNames[1].index('['):] + self._ValueList[0] =3D TAB_SPLIT.join((PcdNames[0= ],PcdName)) + self._ValueList[1] =3D Index + self._ValueList[2] =3D PcdTockens[1] + else: + self._CurrentStructurePcdName =3D "" + else: + if self._CurrentStructurePcdName !=3D TAB_SPLIT.join(= PcdNames[:2]): + EdkLogger.error('Parser', FORMAT_INVALID, "Pcd Na= me does not match: %s and %s " % (self._CurrentStructurePcdName, TAB_SPLIT.= join(PcdNames[:2])), + File=3Dself.MetaFile, Line=3Dself._LineIn= dex + 1) + self._ValueList[1] =3D TAB_SPLIT.join(PcdNames[2:]) + self._ValueList[2] =3D PcdTockens[1] - self._ValueList[2] =3D ValueList[0].strip() + '|' + ValueList[1].= strip() + '|' + ValueList[2].strip() + if not self._CurrentStructurePcdName: + if self._PcdDataTypeCODE: + if ")}" in self._CurrentLine: + ValuePart, RestofValue =3D self._CurrentLine.split(")= }") + self._PcdCodeValue =3D self._PcdCodeValue + "\n " + V= aluePart + self._CurrentLine =3D "|".join((self._CurrentPcdName,= self._PcdCodeValue, RestofValue)) + self._PcdDataTypeCODE =3D False + self._PcdCodeValue =3D "" + else: + self._PcdCodeValue =3D self._PcdCodeValue + "\n " + s= elf._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().startswit= h("{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 space= GUID or PCD name specified", + ExtraData=3Dself._CurrentLine + \ + " (.|||)", + File=3Dself.MetaFile, Line=3Dself._LineIn= dex+1) + # check format of token space GUID CName + if not ValueRe.match(self._ValueList[0]): + EdkLogger.error('Parser', FORMAT_INVALID, + "The format of the token space GUID CName= is invalid. The correct format is '(a-zA-Z_)[a-zA-Z0-9_]*'", + ExtraData=3Dself._CurrentLine + \ + " (.|||)", + File=3Dself.MetaFile, Line=3Dself._LineIn= dex + 1) + # check format of PCD CName + if not ValueRe.match(self._ValueList[1]): + EdkLogger.error('Parser', FORMAT_INVALID, + "The format of the PCD CName is invalid. = The correct format is '(a-zA-Z_)[a-zA-Z0-9_]*'", + ExtraData=3Dself._CurrentLine + \ + " (.|||)", + File=3Dself.MetaFile, Line=3Dself._LineIn= dex + 1) + + # check PCD datum information + if len(TokenList) < 2 or TokenList[1] =3D=3D '': + EdkLogger.error('Parser', FORMAT_INVALID, "No PCD Datum i= nformation given", + ExtraData=3Dself._CurrentLine + \ + " (.|||)", + File=3Dself.MetaFile, Line=3Dself._LineIn= dex+1) + + + ValueRe =3D re.compile(r'^\s*L?\".*\|.*\"') + PtrValue =3D ValueRe.findall(TokenList[1]) + + # Has VOID* type string, may contain "|" character in the str= ing. + if len(PtrValue) !=3D 0: + ptrValueList =3D re.sub(ValueRe, '', TokenList[1]) + ValueList =3D AnalyzePcdExpression(ptrValueList) + ValueList[0] =3D PtrValue[0] + else: + ValueList =3D AnalyzePcdExpression(TokenList[1]) + + + # check if there's enough datum information given + if len(ValueList) !=3D 3: + EdkLogger.error('Parser', FORMAT_INVALID, "Invalid PCD Da= tum information given", + ExtraData=3Dself._CurrentLine + \ + " (.|||)", + File=3Dself.MetaFile, Line=3Dself._LineIn= dex + 1) + # check default value + if ValueList[0] =3D=3D '': + EdkLogger.error('Parser', FORMAT_INVALID, "Missing Defaul= tValue in PCD Datum information", + ExtraData=3Dself._CurrentLine + \ + " (.|||)", + File=3Dself.MetaFile, Line=3Dself._LineIn= dex + 1) + # check datum type + if ValueList[1] =3D=3D '': + EdkLogger.error('Parser', FORMAT_INVALID, "Missing DatumT= ype in PCD Datum information", + ExtraData=3Dself._CurrentLine + \ + " (.|||)", + File=3Dself.MetaFile, Line=3Dself._LineIn= dex + 1) + # check token of the PCD + if ValueList[2] =3D=3D '': + EdkLogger.error('Parser', FORMAT_INVALID, "Missing Token = in PCD Datum information", + ExtraData=3Dself._CurrentLine + \ + " (.|||)", + File=3Dself.MetaFile, Line=3Dself._LineIn= dex + 1) + + PcdValue =3D ValueList[0] + if PcdValue: + try: + self._GuidDict.update(self._AllPcdDict) + ValueList[0] =3D ValueExpressionEx(ValueList[0], Valu= eList[1], self._GuidDict)(True) + except BadExpression as Value: + EdkLogger.error('Parser', FORMAT_INVALID, Value, Extr= aData=3Dself._CurrentLine, File=3Dself.MetaFile, Line=3Dself._LineIndex + 1= ) + # check format of default value against the datum type + IsValid, Cause =3D CheckPcdDatum(ValueList[1], ValueList[0]) + if not IsValid: + EdkLogger.error('Parser', FORMAT_INVALID, Cause, ExtraDat= a=3Dself._CurrentLine, + File=3Dself.MetaFile, Line=3Dself._LineIn= dex + 1) + + if Cause =3D=3D "StructurePcd": + self._CurrentStructurePcdName =3D TAB_SPLIT.join(self._Va= lueList[0:2]) + self._ValueList[0] =3D self._CurrentStructurePcdName + self._ValueList[1] =3D ValueList[1].strip() + + if ValueList[0] in ['True', 'true', 'TRUE']: + ValueList[0] =3D '1' + elif ValueList[0] in ['False', 'false', 'FALSE']: + ValueList[0] =3D '0' + + # check for duplicate PCD definition + if (self._Scope[0], self._ValueList[0], self._ValueList[1]) i= n self._AllPCDs: + EdkLogger.error('Parser', FORMAT_INVALID, + "The same PCD name and GUID have been alr= eady defined", + ExtraData=3Dself._CurrentLine, File=3Dsel= f.MetaFile, Line=3Dself._LineIndex + 1) + else: + self._AllPCDs.append((self._Scope[0], self._ValueList[0],= self._ValueList[1])) + self._AllPcdDict[TAB_SPLIT.join(self._ValueList[0:2])] = =3D ValueList[0] + + self._ValueList[2] =3D ValueList[0].strip() + '|' + ValueList= [1].strip() + '|' + ValueList[2].strip() _SectionParser =3D { MODEL_META_DATA_HEADER : MetaFileParser._DefineParser, -- 2.26.2.windows.1 --_000_MW4PR21MB19075000390207AB161A2E70EF749MW4PR21MB1907namp_ Content-Type: text/html; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable

Ah! Gotcha. I missed that this was specific to ECC.= Thanks!

 

- Bret

 

 

Hi Bret,

 

This patch adds the ECC check for structurePcd w= ritten in des/dsc file, as the origin check is only for non-structured Pcd.=

 

Best Regards,

Yuwei (Christine)

 

From: Bret Barkelew <Bret.Barkelew@micros= oft.com>
Sent: Friday, April 2, 2021 12:43 AM
To: devel@edk2.groups.io; Chen, Christine <yuwei.chen@intel.com&= gt;
Cc: Liang, MingyueX <mingyuex.liang@intel.com>; Feng, Bob C &= lt;bob.c.feng@intel.com>; Liming Gao <gaoliming@byosoft.com.cn> Subject: RE: [EXTERNAL] [edk2-devel] [PATCH 1/1] BaseTools/Ecc: Upd= ate structpcd parsing method.

 

What does =93update=94 mean in this context? What b= ehavior is changing?

 

- Bret

 

 

From: mliang2x <<= a href=3D"mailto:mingyuex.liang@intel.com">mingyuex.liang@intel.com>=

Update the pcdparser method in Dec and DSC files.

Signed-off-by: Mingyue Liang <mingyuex.liang@intel.com>
Cc: Bob Feng <bob.c.feng@intel.= com>
Cc: Liming Gao <gaoliming@b= yosoft.com.cn>
Cc: Yuwei Chen <yuwei.chen@inte= l.com>
---
 .../Ecc/MetaFileWorkspace/MetaFileParser.py   | 464 ++++++= ++++--------
 1 file changed, 265 insertions(+), 199 deletions(-)

diff --git a/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.= py b/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py
index 9c27c8e16a05..588d3dbe6ed5 100644
--- a/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py
+++ b/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py
@@ -22,7 +22,7 @@ import Ecc.EccToolError as EccToolError
 from CommonDataClass.DataClass import *
 from Common.DataType import *
 from Common.StringUtils import *
-from Common.Misc import GuidStructureStringToGuidString, CheckPcdDatum, P= athClass, AnalyzePcdData
+from Common.Misc import GuidStructureStringToGuidString, CheckPcdDatum, P= athClass, AnalyzePcdData, AnalyzeDscPcd, AnalyzePcdExpression, ParseFieldVa= lue, StructPattern
 from Common.Expression import *
 from CommonDataClass.Exceptions import *
 
@@ -31,6 +31,8 @@ from GenFds.FdfParser import FdfParser
 from Common.LongFilePathSupport import OpenLongFilePath as open
 from Common.LongFilePathSupport import CodecOpenLongFilePath
 
+CODEPattern =3D re.compile(r"{CODE\([a-fA-F0-9Xx\{\},\s]*\)}")<= br> +
 ## A decorator used to parse macro definition
 def ParseMacro(Parser):
     def MacroParser(self):
@@ -174,6 +176,11 @@ class MetaFileParser(object):
         # UNI object and extra UN= I object
         self._UniObj =3D None
         self._UniExtraObj =3D Non= e
+        # StructPcd var
+        self._PcdCodeValue =3D "&= quot;
+        self._PcdDataTypeCODE =3D Fals= e
+        self._CurrentPcdName =3D "= ;"
+        self._GuidDict =3D {}  # = for Parser PCD value {GUID(gTokeSpaceGuidName)}
 
     ## Store the parsed data in table
     def _Store(self, *Args):
@@ -395,6 +402,40 @@ class MetaFileParser(object):
            &n= bsp;    Macros.update(self._SectionsMacroDict[(self._Section= Type, Scope1, Scope2)])
         return Macros
 
+    def ProcessMultipleLineCODEValue(self, Content):
+        CODEBegin =3D False
+        CODELine =3D ""
+        continuelinecount =3D 0
+        newContent =3D []
+        for Index in range(0, len(Cont= ent)):
+            Line = =3D Content[Index]
+            if COD= EBegin:
+            &= nbsp;   CODELine =3D CODELine + Line
+            &= nbsp;   continuelinecount +=3D1
+            &= nbsp;   if ")}" in Line:
+            &= nbsp;       newContent.append(CODELine)
+            &= nbsp;       for _ in range(continuelinecount)= :
+            &= nbsp;           newConten= t.append("")
+            &= nbsp;       CODEBegin =3D False
+            &= nbsp;       CODELine =3D ""
+            &= nbsp;       continuelinecount =3D 0
+            else:<= br> +            &= nbsp;   if not Line:
+            &= nbsp;       newContent.append(Line)
+            &= nbsp;       continue
+            &= nbsp;   if "{CODE(" not in Line:
+            &= nbsp;       newContent.append(Line)
+            &= nbsp;       continue
+            &= nbsp;   elif CODEPattern.findall(Line):
+            &= nbsp;       newContent.append(Line)
+            &= nbsp;       continue
+            &= nbsp;   else:
+            &= nbsp;       CODEBegin =3D True
+            &= nbsp;       CODELine =3D Line
+
+        return newContent
+
+
     _SectionParser  =3D {}
     Finished       = ; =3D property(_GetFinished, _SetFinished)
     _Macros       =   =3D property(_GetMacros)
@@ -812,6 +853,8 @@ class DscParser(MetaFileParser):
             C= ontent =3D open(str(self.MetaFile.Path), 'r').readlines()
         except:
             E= dkLogger.error("Parser", FILE_READ_FAILURE, ExtraData=3Dself.Meta= File)
+
+        Content =3D self.ProcessMultip= leLineCODEValue(Content)
         #
         # Insert a record for fil= e
         #
@@ -1018,24 +1061,71 @@ class DscParser(MetaFileParser):
     #
     @ParseMacro
     def _PcdParser(self):
+        if self._PcdDataTypeCODE:
+            self._= PcdCodeValue =3D self._PcdCodeValue + "\n " + self._CurrentLine +            if sel= f._CurrentLine.endswith(")}"):
+            &= nbsp;   self._CurrentLine =3D "|".join((self._CurrentPc= dName, self._PcdCodeValue))
+            &= nbsp;   self._PcdDataTypeCODE =3D False
+            &= nbsp;   self._PcdCodeValue =3D ""
+            else:<= br> +            &= nbsp;   self._ValueList =3D None
+            &= nbsp;   return
         TokenList =3D GetSplitVal= ueList(self._CurrentLine, TAB_VALUE_SPLIT, 1)
+        self._CurrentPcdName =3D Token= List[0]
+        if len(TokenList) =3D=3D 2 and= TokenList[1].strip().startswith("{CODE"):
+            self._= PcdDataTypeCODE =3D True
+            self._= PcdCodeValue =3D TokenList[1].strip()
+
+        if self._PcdDataTypeCODE:
+            if sel= f._CurrentLine.endswith(")}"):
+            &= nbsp;   self._PcdDataTypeCODE =3D False
+            &= nbsp;   self._PcdCodeValue =3D ""
+            else:<= br> +            &= nbsp;   self._ValueList =3D None
+            &= nbsp;   return
         self._ValueList[0:1] =3D = GetSplitValueList(TokenList[0], TAB_SPLIT)
+        PcdNameTockens =3D GetSplitVal= ueList(TokenList[0], TAB_SPLIT)
+        if len(PcdNameTockens) =3D=3D = 2:
+            self._= ValueList[0], self._ValueList[1] =3D PcdNameTockens[0], PcdNameTockens[1] +        elif len(PcdNameTockens) =3D= =3D 3:
+            self._= ValueList[0], self._ValueList[1] =3D ".".join((PcdNameTockens[0],= PcdNameTockens[1])), PcdNameTockens[2]
+        elif len(PcdNameTockens) > = 3:
+            self._= ValueList[0], self._ValueList[1] =3D ".".join((PcdNameTockens[0],= PcdNameTockens[1])), ".".join(PcdNameTockens[2:])
         if len(TokenList) =3D=3D = 2:
             s= elf._ValueList[2] =3D TokenList[1]
         if self._ValueList[0] =3D= = =3D '' or self._ValueList[1] =3D=3D '':
             E= dkLogger.error('Parser', FORMAT_INVALID, "No token space GUID or PCD n= ame specified",
            &n= bsp;            = ;    ExtraData=3Dself._CurrentLine + " (<TokenSpaceG= uidCName>.<TokenCName>|<PcdValue>)",
-            &= nbsp;           &nbs= p;   File=3Dself.MetaFile, Line=3Dself._LineIndex+1)
+            &= nbsp;           &nbs= p;   File=3Dself.MetaFile, Line=3Dself._LineIndex + 1)
         if self._ValueList[2] =3D= = =3D '':
+            #
+            # The = PCD values are optional for FIXEDATBUILD, PATCHABLEINMODULE, Dynamic/Dynami= cEx default
+            #
+            if sel= f._SectionType in (MODEL_PCD_FIXED_AT_BUILD, MODEL_PCD_PATCHABLE_IN_MODULE,= MODEL_PCD_DYNAMIC_DEFAULT, MODEL_PCD_DYNAMIC_EX_DEFAULT):
+            &= nbsp;   return
             E= dkLogger.error('Parser', FORMAT_INVALID, "No PCD value given",             &n= bsp;            = ;    ExtraData=3Dself._CurrentLine + " (<TokenSpaceG= uidCName>.<TokenCName>|<PcdValue>)",
-            &= nbsp;           &nbs= p;   File=3Dself.MetaFile, Line=3Dself._LineIndex+1)
+            &= nbsp;           &nbs= p;   File=3Dself.MetaFile, Line=3Dself._LineIndex + 1)
+
+        # Validate the datum type of D= ynamic Defaul PCD and DynamicEx Default PCD
+        ValueList =3D GetSplitValueLis= t(self._ValueList[2])
+        if len(ValueList) > 1 and V= alueList[1] in [TAB_UINT8, TAB_UINT16, TAB_UINT32, TAB_UINT64] \
+            &= nbsp;           &nbs= p;     and self._ItemType in [MODEL_PCD_DYNAMIC_DEFAULT= , MODEL_PCD_DYNAMIC_EX_DEFAULT]:
+            EdkLog= ger.error('Parser', FORMAT_INVALID, "The datum type '%s' of PCD is wro= ng" % ValueList[1],
+            &= nbsp;           &nbs= p;   ExtraData=3Dself._CurrentLine, File=3Dself.MetaFile, Line=3D= self._LineIndex + 1)
+
+        # Validate the VariableName of= DynamicHii and DynamicExHii for PCD Entry must not be an empty string
+        if self._ItemType in [MODEL_PC= D_DYNAMIC_HII, MODEL_PCD_DYNAMIC_EX_HII]:
+            DscPcd= ValueList =3D GetSplitValueList(TokenList[1], TAB_VALUE_SPLIT, 1)
+            if len= (DscPcdValueList[0].replace('L', '').replace('"', '').strip()) =3D=3D = 0:
+            &= nbsp;   EdkLogger.error('Parser', FORMAT_INVALID, "The Varia= bleName field in the HII format PCD entry must not be an empty string"= ,
+            &= nbsp;           &nbs= p;   ExtraData=3Dself._CurrentLine, File=3Dself.MetaFile, Line=3D= self._LineIndex + 1)
         # if value are 'True', 't= rue', 'TRUE' or 'False', 'false', 'FALSE', replace with integer 1 or 0.
         DscPcdValueList =3D GetSp= litValueList(TokenList[1], TAB_VALUE_SPLIT, 1)
         if DscPcdValueList[0] in = ['True', 'true', 'TRUE']:
-            self._= ValueList[2] =3D TokenList[1].replace(DscPcdValueList[0], '1', 1);
+            self._= ValueList[2] =3D TokenList[1].replace(DscPcdValueList[0], '1', 1)
         elif DscPcdValueList[0] i= n ['False', 'false', 'FALSE']:
-            self._= ValueList[2] =3D TokenList[1].replace(DscPcdValueList[0], '0', 1);
+            self._= ValueList[2] =3D TokenList[1].replace(DscPcdValueList[0], '0', 1)
 
     ## [components] section parser
     @ParseMacro
@@ -1502,6 +1592,10 @@ class DecParser(MetaFileParser):
         self._include_flag =3D Fa= lse
         self._package_flag =3D Fa= lse
 
+        self._AllPCDs =3D [] # Only fo= r check duplicate PCD
+        self._AllPcdDict =3D {}
+
+
     ## Parser starter
     def Start(self):
         Content =3D ''
@@ -1510,6 +1604,7 @@ class DecParser(MetaFileParser):
         except:
             E= dkLogger.error("Parser", FILE_READ_FAILURE, ExtraData=3Dself.Meta= File)
 
+        Content =3D self.ProcessMultip= leLineCODEValue(Content)
         #
         # Insert a record for fil= e
         #
@@ -1707,51 +1802,6 @@ class DecParser(MetaFileParser):
            &n= bsp;    namelist[2] =3D ".".join((arrayindex,namel= ist[2]))
         return namelist
 
-    def StructPcdParser(self):
-        self._ValueList[0] =3D self._C= urrentStructurePcdName
-
-        if "|" not in self._= CurrentLine:
-            if &qu= ot;<HeaderFiles>" =3D=3D self._CurrentLine:
-            &= nbsp;   self._include_flag =3D True
-            &= nbsp;   self._package_flag =3D False
-            &= nbsp;   self._ValueList =3D None
-            &= nbsp;   return
-            if &qu= ot;<Packages>" =3D=3D self._CurrentLine:
-            &= nbsp;   self._package_flag =3D True
-            &= nbsp;   self._ValueList =3D None
-            &= nbsp;   self._include_flag =3D False
-            &= nbsp;   return
-
-            if sel= f._include_flag:
-            &= nbsp;   self._ValueList[1] =3D "<HeaderFiles>_" += md5(self._CurrentLine.encode('utf-8')).hexdigest()
-            &= nbsp;   self._ValueList[2] =3D self._CurrentLine
-            if sel= f._package_flag and "}" !=3D self._CurrentLine:
-            &= nbsp;   self._ValueList[1] =3D "<Packages>_" + md= 5(self._CurrentLine.encode('utf-8')).hexdigest()
-            &= nbsp;   self._ValueList[2] =3D self._CurrentLine
-            if sel= f._CurrentLine =3D=3D "}":
-            &= nbsp;   self._package_flag =3D False
-            &= nbsp;   self._include_flag =3D False
-            &= nbsp;   self._ValueList =3D None
-        else:
-            PcdToc= kens =3D self._CurrentLine.split(TAB_VALUE_SPLIT)
-            PcdNam= es =3D self.ParsePcdName(PcdTockens[0].split(TAB_SPLIT))
-            if len= (PcdNames) =3D=3D 2:
-            &= nbsp;   if PcdNames[1].strip().endswith("]"):
-            &= nbsp;       PcdName =3D PcdNames[1][:PcdNames= [1].index('[')]
-            &= nbsp;       Index =3D PcdNames[1][PcdNames[1]= .index('['):]
-            &= nbsp;       self._ValueList[0] =3D TAB_SPLIT.= join((PcdNames[0], PcdName))
-            &= nbsp;       self._ValueList[1] =3D Index
-            &= nbsp;       self._ValueList[2] =3D PcdTockens= [1]
-            &= nbsp;   else:
-            &= nbsp;       self._CurrentStructurePcdName =3D= ""
-            else:<= br> -            &= nbsp;   if self._CurrentStructurePcdName !=3D TAB_SPLIT.join(PcdN= ames[:2]):
-            &= nbsp;       EdkLogger.error('Parser', FORMAT_= INVALID, "Pcd Name does not match: %s and %s " % (
-            &= nbsp;       self._CurrentStructurePcdName, TA= B_SPLIT.join(PcdNames[:2])),
-            &= nbsp;           &nbs= p;           File=3Dself.= MetaFile, Line=3Dself._LineIndex + 1)
-            &= nbsp;   self._ValueList[1] =3D TAB_SPLIT.join(PcdNames[2:])
-            &= nbsp;   self._ValueList[2] =3D PcdTockens[1]
-
     ## PCD sections parser
     #
     #   [PcdsFixedAtBuild]
@@ -1763,159 +1813,175 @@ class DecParser(MetaFileParser):
     @ParseMacro
     def _PcdParser(self):
         if self._CurrentStructure= PcdName:
-            self.S= tructPcdParser()
-            return=
-        TokenList =3D GetSplitValueLis= t(self._CurrentLine, TAB_VALUE_SPLIT, 1)
-        self._ValueList[0:1] =3D GetSp= litValueList(TokenList[0], TAB_SPLIT)
-        # check PCD information
-        if self._ValueList[0] =3D=3D '= ' or self._ValueList[1] =3D=3D '':
-            EdkLog= ger.error('Parser', FORMAT_INVALID, "No token space GUID or PCD name s= pecified",
-            &= nbsp;           &nbs= p;   ExtraData=3Dself._CurrentLine + \
-            &= nbsp;           &nbs= p;             = " (<TokenSpaceGuidCName>.<PcdCName>|<DefaultValue>|&= lt;DatumType>|<Token>)",
-            &= nbsp;           &nbs= p;   File=3Dself.MetaFile, Line=3Dself._LineIndex+1)
-        # check PCD datum information<= br> -        if len(TokenList) < 2 or To= kenList[1] =3D=3D '':
-            EdkLog= ger.error('Parser', FORMAT_INVALID, "No PCD Datum information given&qu= ot;,
-            &= nbsp;           &nbs= p;   ExtraData=3Dself._CurrentLine + \
-            &= nbsp;           &nbs= p;             = " (<TokenSpaceGuidCName>.<PcdCName>|<DefaultValue>|&= lt;DatumType>|<Token>)",
-            &= nbsp;           &nbs= p;   File=3Dself.MetaFile, Line=3Dself._LineIndex+1)
-
-
-        ValueRe  =3D re.compile(r= '^\s*L?\".*\|.*\"')
-        PtrValue =3D ValueRe.findall(T= okenList[1])
-
-        # Has VOID* type string, may c= ontain "|" character in the string.
-        if len(PtrValue) !=3D 0:
-            ptrVal= ueList =3D re.sub(ValueRe, '', TokenList[1])
-            ValueL= ist    =3D GetSplitValueList(ptrValueList)
-            ValueL= ist[0] =3D PtrValue[0]
-        else:
-            ValueL= ist =3D GetSplitValueList(TokenList[1])
-
-
-        # check if there's enough datu= m information given
-        if len(ValueList) !=3D 3:
-            EdkLog= ger.error('Parser', FORMAT_INVALID, "Invalid PCD Datum information giv= en",
-            &= nbsp;           &nbs= p;   ExtraData=3Dself._CurrentLine + \
-            &= nbsp;           &nbs= p;             = " (<TokenSpaceGuidCName>.<PcdCName>|<DefaultValue>|&= lt;DatumType>|<Token>)",
-            &= nbsp;           &nbs= p;   File=3Dself.MetaFile, Line=3Dself._LineIndex+1)
-        # check default value
-        if ValueList[0] =3D=3D '':
-            EdkLog= ger.error('Parser', FORMAT_INVALID, "Missing DefaultValue in PCD Datum= information",
-            &= nbsp;           &nbs= p;   ExtraData=3Dself._CurrentLine + \
-            &= nbsp;           &nbs= p;             = " (<TokenSpaceGuidCName>.<PcdCName>|<DefaultValue>|&= lt;DatumType>|<Token>)",
-            &= nbsp;           &nbs= p;   File=3Dself.MetaFile, Line=3Dself._LineIndex+1)
-        # check datum type
-        if ValueList[1] =3D=3D '':
-            EdkLog= ger.error('Parser', FORMAT_INVALID, "Missing DatumType in PCD Datum in= formation",
-            &= nbsp;           &nbs= p;   ExtraData=3Dself._CurrentLine + \
-            &= nbsp;           &nbs= p;             = " (<TokenSpaceGuidCName>.<PcdCName>|<DefaultValue>|&= lt;DatumType>|<Token>)",
-            &= nbsp;           &nbs= p;   File=3Dself.MetaFile, Line=3Dself._LineIndex+1)
-        # check token of the PCD
-        if ValueList[2] =3D=3D '':
-            EdkLog= ger.error('Parser', FORMAT_INVALID, "Missing Token in PCD Datum inform= ation",
-            &= nbsp;           &nbs= p;   ExtraData=3Dself._CurrentLine + \
-            &= nbsp;           &nbs= p;             = " (<TokenSpaceGuidCName>.<PcdCName>|<DefaultValue>|&= lt;DatumType>|<Token>)",
-            &= nbsp;           &nbs= p;   File=3Dself.MetaFile, Line=3Dself._LineIndex+1)
-        # check format of default valu= e against the datum type
-        IsValid, Cause =3D CheckPcdDat= um(ValueList[1], ValueList[0])
-        if not IsValid:
-            EdkLog= ger.error('Parser', FORMAT_INVALID, Cause, ExtraData=3Dself._CurrentLine, -            &= nbsp;           &nbs= p;   File=3Dself.MetaFile, Line=3Dself._LineIndex+1)
-        if Cause =3D=3D "Structur= ePcd":
-            self._= CurrentStructurePcdName =3D TAB_SPLIT.join(self._ValueList[0:2])
             s= elf._ValueList[0] =3D self._CurrentStructurePcdName
-            self._= ValueList[1] =3D ValueList[1].strip()
 
-        if EccGlobalData.gConfig.UniCh= eckPCDInfo =3D=3D '1' or EccGlobalData.gConfig.UniCheckAll =3D=3D '1' or Ec= cGlobalData.gConfig.CheckAll =3D=3D '1':
-            # chec= k Description, Prompt information
-            Patter= nDesc =3D re.compile('##\s*([\x21-\x7E\s]*)', re.S)
-            Patter= nPrompt =3D re.compile('#\s+@Prompt\s+([\x21-\x7E\s]*)', re.S)
-            Descri= ption =3D None
-            Prompt= =3D None
-            # chec= k @ValidRange, @ValidList and @Expression format valid
-            ErrorC= odeValid =3D '0x0 <=3D %s <=3D 0xFFFFFFFF'
-            Patter= nValidRangeIn =3D '(NOT)?\s*(\d+\s*-\s*\d+|0[xX][a-fA-F0-9]+\s*-\s*0[xX][a-= fA-F0-9]+|LT\s*\d+|LT\s*0[xX][a-fA-F0-9]+|GT\s*\d+|GT\s*0[xX][a-fA-F0-9]+|L= E\s*\d+|LE\s*0[xX][a-fA-F0-9]+|GE\s*\d+|GE\s*0[xX][a-fA-F0-9]+|XOR\s*\d+|XO= R\s*0[xX][a-fA-F0-9]+|EQ\s*\d+|EQ\s*0[xX][a-fA-F0-9]+)'
-            Patter= nValidRng =3D re.compile('^' + '(NOT)?\s*' + PatternValidRangeIn + '$')
-            for Co= mment in self._Comments:
-            &= nbsp;   Comm =3D Comment[0].strip()
-            &= nbsp;   if not Comm:
-            &= nbsp;       continue
-            &= nbsp;   if not Description:
-            &= nbsp;       Description =3D PatternDesc.finda= ll(Comm)
-            &= nbsp;   if not Prompt:
-            &= nbsp;       Prompt =3D PatternPrompt.findall(= Comm)
-            &= nbsp;   if Comm[0] =3D=3D '#':
-            &= nbsp;       ValidFormt =3D Comm.lstrip('#') -            &= nbsp;       ValidFormt =3D ValidFormt.lstrip(= )
-            &= nbsp;       if ValidFormt[0:11] =3D=3D '@Vali= dRange':
-            &= nbsp;           ValidForm= t =3D ValidFormt[11:]
-            &= nbsp;           ValidForm= t =3D ValidFormt.lstrip()
-            &= nbsp;           try:
-            &= nbsp;           &nbs= p;   ErrorCode, Expression =3D ValidFormt.split('|', 1)
-            &= nbsp;           except Va= lueError:
-            &= nbsp;           &nbs= p;   ErrorCode =3D '0x0'
-            &= nbsp;           &nbs= p;   Expression =3D ValidFormt
-            &= nbsp;           ErrorCode= , Expression =3D ErrorCode.strip(), Expression.strip()
-            &= nbsp;           try:
-            &= nbsp;           &nbs= p;   if not eval(ErrorCodeValid % ErrorCode):
-            &= nbsp;           &nbs= p;       EdkLogger.warn('Parser', '@ValidRang= e ErrorCode(%s) of PCD %s is not valid UINT32 value.' % (ErrorCode, TokenLi= st[0]))
-            &= nbsp;           except: -            &= nbsp;           &nbs= p;   EdkLogger.warn('Parser', '@ValidRange ErrorCode(%s) of PCD %= s is not valid UINT32 value.' % (ErrorCode, TokenList[0]))
-            &= nbsp;           if not Pa= tternValidRng.search(Expression):
-            &= nbsp;           &nbs= p;   EdkLogger.warn('Parser', '@ValidRange Expression(%s) of PCD = %s is incorrect format.' % (Expression, TokenList[0]))
-            &= nbsp;       if ValidFormt[0:10] =3D=3D '@Vali= dList':
-            &= nbsp;           ValidForm= t =3D ValidFormt[10:]
-            &= nbsp;           ValidForm= t =3D ValidFormt.lstrip()
-            &= nbsp;           try:
-            &= nbsp;           &nbs= p;   ErrorCode, Expression =3D ValidFormt.split('|', 1)
-            &= nbsp;           except Va= lueError:
-            &= nbsp;           &nbs= p;   ErrorCode =3D '0x0'
-            &= nbsp;           &nbs= p;   Expression =3D ValidFormt
-            &= nbsp;           ErrorCode= , Expression =3D ErrorCode.strip(), Expression.strip()
-            &= nbsp;           try:
-            &= nbsp;           &nbs= p;   if not eval(ErrorCodeValid % ErrorCode):
-            &= nbsp;           &nbs= p;       EdkLogger.warn('Parser', '@ValidList= ErrorCode(%s) of PCD %s is not valid UINT32 value.' % (ErrorCode, TokenLis= t[0]))
-            &= nbsp;           except: -            &= nbsp;           &nbs= p;   EdkLogger.warn('Parser', '@ValidList ErrorCode(%s) of PCD %s= is not valid UINT32 value.' % (ErrorCode, TokenList[0]))
-            &= nbsp;           Values = =3D Expression.split(',')
-            &= nbsp;           for Value= in Values:
-            &= nbsp;           &nbs= p;   Value =3D Value.strip()
-            &= nbsp;           &nbs= p;   try:
-            &= nbsp;           &nbs= p;       eval(Value)
-            &= nbsp;           &nbs= p;   except:
-            &= nbsp;           &nbs= p;       EdkLogger.warn('Parser', '@ValidList= Expression of PCD %s include a invalid value(%s).' % (TokenList[0], Value)= )
-            &= nbsp;           &nbs= p;       break
-            &= nbsp;       if ValidFormt[0:11] =3D=3D '@Expr= ession':
-            &= nbsp;           ValidForm= t =3D ValidFormt[11:]
-            &= nbsp;           ValidForm= t =3D ValidFormt.lstrip()
-            &= nbsp;           try:
-            &= nbsp;           &nbs= p;   ErrorCode, Expression =3D ValidFormt.split('|', 1)
-            &= nbsp;           except Va= lueError:
-            &= nbsp;           &nbs= p;   ErrorCode =3D '0x0'
-            &= nbsp;           &nbs= p;   Expression =3D ValidFormt
-            &= nbsp;           ErrorCode= , Expression =3D ErrorCode.strip(), Expression.strip()
-            &= nbsp;           try:
-            &= nbsp;           &nbs= p;   if not eval(ErrorCodeValid % ErrorCode):
-            &= nbsp;           &nbs= p;       EdkLogger.warn('Parser', '@Expressio= n ErrorCode(%s) of PCD %s is not valid UINT32 value.' % (ErrorCode, TokenLi= st[0]))
-            &= nbsp;           except: -            &= nbsp;           &nbs= p;   EdkLogger.warn('Parser', '@Expression ErrorCode(%s) of PCD %= s is not valid UINT32 value.' % (ErrorCode, TokenList[0]))
-            &= nbsp;           if not Ex= pression:
-            &= nbsp;           &nbs= p;   EdkLogger.warn('Parser', '@Expression Expression of PCD %s i= s incorrect format.' % TokenList[0])
-            if not= Description:
-            &= nbsp;   EdkLogger.warn('Parser', 'PCD %s Description information = is not provided.' % TokenList[0])
-            if not= Prompt:
-            &= nbsp;   EdkLogger.warn('Parser', 'PCD %s Prompt information is no= t provided.' % TokenList[0])
-            # chec= k Description, Prompt localization information
-            if sel= f._UniObj:
-            &= nbsp;   self._UniObj.CheckPcdInfo(TokenList[0])
+            if &qu= ot;|" not in self._CurrentLine:
+            &= nbsp;   if "<HeaderFiles>" =3D=3D self._CurrentLi= ne:
+            &= nbsp;       self._include_flag =3D True
+            &= nbsp;       self._package_flag =3D False
+            &= nbsp;       self._ValueList =3D None
+            &= nbsp;       return
+            &= nbsp;   if "<Packages>" =3D=3D self._CurrentLine:=
+            &= nbsp;       self._package_flag =3D True
+            &= nbsp;       self._ValueList =3D None
+            &= nbsp;       self._include_flag =3D False
+            &= nbsp;       return
 
-        if ValueList[0] in ['True', 't= rue', 'TRUE']:
-            ValueL= ist[0] =3D '1'
-        elif ValueList[0] in ['False',= 'false', 'FALSE']:
-            ValueL= ist[0] =3D '0'
+            &= nbsp;   if self._include_flag:
+            &= nbsp;       self._ValueList[1] =3D "<= HeaderFiles>_" + md5(self._CurrentLine.encode('utf-8')).hexdigest()=
+            &= nbsp;       self._ValueList[2] =3D self._Curr= entLine
+            &= nbsp;   if self._package_flag and "}" !=3D self._Curren= tLine:
+            &= nbsp;       self._ValueList[1] =3D "<= Packages>_" + md5(self._CurrentLine.encode('utf-8')).hexdigest() +            &= nbsp;       self._ValueList[2] =3D self._Curr= entLine
+            &= nbsp;   if self._CurrentLine =3D=3D "}":
+            &= nbsp;       self._package_flag =3D False
+            &= nbsp;       self._include_flag =3D False
+            &= nbsp;       self._ValueList =3D None
+            &= nbsp;       return
+            else:<= br> +            &= nbsp;   PcdTockens =3D self._CurrentLine.split(TAB_VALUE_SPLIT) +            &= nbsp;   PcdNames =3D self.ParsePcdName(PcdTockens[0].split(TAB_SP= LIT))
+            &= nbsp;   if len(PcdNames) =3D=3D 2:
+            &= nbsp;       if PcdNames[1].strip().endswith(&= quot;]"):
+            &= nbsp;           PcdName = =3D PcdNames[1][:PcdNames[1].index('[')]
+            &= nbsp;           Index =3D= PcdNames[1][PcdNames[1].index('['):]
+            &= nbsp;           self._Val= ueList[0] =3D TAB_SPLIT.join((PcdNames[0],PcdName))
+            &= nbsp;           self._Val= ueList[1] =3D Index
+            &= nbsp;           self._Val= ueList[2] =3D PcdTockens[1]
+            &= nbsp;       else:
+            &= nbsp;           self._Cur= rentStructurePcdName =3D ""
+            &= nbsp;   else:
+            &= nbsp;       if self._CurrentStructurePcdName = !=3D TAB_SPLIT.join(PcdNames[:2]):
+            &= nbsp;           EdkLogger= .error('Parser', FORMAT_INVALID, "Pcd Name does not match: %s and %s &= quot; % (self._CurrentStructurePcdName, TAB_SPLIT.join(PcdNames[:2])),
+            &= nbsp;           &nbs= p;       File=3Dself.MetaFile, Line=3Dself._L= ineIndex + 1)
+            &= nbsp;       self._ValueList[1] =3D TAB_SPLIT.= join(PcdNames[2:])
+            &= nbsp;       self._ValueList[2] =3D PcdTockens= [1]
 
-        self._ValueList[2] =3D ValueLi= st[0].strip() + '|' + ValueList[1].strip() + '|' + ValueList[2].strip()
+        if not self._CurrentStructureP= cdName:
+            if sel= f._PcdDataTypeCODE:
+            &= nbsp;   if ")}" in self._CurrentLine:
+            &= nbsp;       ValuePart, RestofValue =3D self._= CurrentLine.split(")}")
+            &= nbsp;       self._PcdCodeValue =3D self._PcdC= odeValue + "\n " + ValuePart
+            &= nbsp;       self._CurrentLine =3D "|&quo= t;.join((self._CurrentPcdName, self._PcdCodeValue, RestofValue))
+            &= nbsp;       self._PcdDataTypeCODE =3D False +            &= nbsp;       self._PcdCodeValue =3D "&quo= t;
+            &= nbsp;   else:
+            &= nbsp;       self._PcdCodeValue =3D self._PcdC= odeValue + "\n " + self._CurrentLine
+            &= nbsp;       self._ValueList =3D None
+            &= nbsp;       return
+            TokenL= ist =3D GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT, 1)
+            self._= CurrentPcdName =3D TokenList[0]
+            if len= (TokenList) =3D=3D 2 and TokenList[1].strip().startswith("{CODE")= :
+            &= nbsp;   if ")}" in self._CurrentLine:
+            &= nbsp;       self._PcdDataTypeCODE =3D False +            &= nbsp;       self._PcdCodeValue =3D "&quo= t;
+            &= nbsp;   else:
+            &= nbsp;       self._PcdDataTypeCODE =3D True +            &= nbsp;       self._PcdCodeValue =3D TokenList[= 1].strip()
+            &= nbsp;       self._ValueList =3D None
+            &= nbsp;       return
+
+            self._= ValueList[0:1] =3D GetSplitValueList(TokenList[0], TAB_SPLIT)
+            ValueR= e =3D re.compile(r'^[a-zA-Z_][a-zA-Z0-9_]*')
+            # chec= k PCD information
+            if sel= f._ValueList[0] =3D=3D '' or self._ValueList[1] =3D=3D '':
+            &= nbsp;   EdkLogger.error('Parser', FORMAT_INVALID, "No token = space GUID or PCD name specified",
+            &= nbsp;           &nbs= p;       ExtraData=3Dself._CurrentLine + \ +            &= nbsp;           &nbs= p;            &= nbsp;    " (<TokenSpaceGuidCName>.<PcdCName>= ;|<DefaultValue>|<DatumType>|<Token>)",
+            &= nbsp;           &nbs= p;       File=3Dself.MetaFile, Line=3Dself._L= ineIndex+1)
+            # chec= k format of token space GUID CName
+            if not= ValueRe.match(self._ValueList[0]):
+            &= nbsp;   EdkLogger.error('Parser', FORMAT_INVALID,
+            &= nbsp;           &nbs= p;       "The format of the token space = GUID CName is invalid. The correct format is '(a-zA-Z_)[a-zA-Z0-9_]*'"= ,
+            &= nbsp;           &nbs= p;       ExtraData=3Dself._CurrentLine + \ +            &= nbsp;           &nbs= p;            &= nbsp;    " (<TokenSpaceGuidCName>.<PcdCName>= ;|<DefaultValue>|<DatumType>|<Token>)",
+            &= nbsp;           &nbs= p;       File=3Dself.MetaFile, Line=3Dself._L= ineIndex + 1)
+            # chec= k format of PCD CName
+            if not= ValueRe.match(self._ValueList[1]):
+            &= nbsp;   EdkLogger.error('Parser', FORMAT_INVALID,
+            &= nbsp;           &nbs= p;       "The format of the PCD CName is= invalid. The correct format is '(a-zA-Z_)[a-zA-Z0-9_]*'",
+            &= nbsp;           &nbs= p;       ExtraData=3Dself._CurrentLine + \ +            &= nbsp;           &nbs= p;            &= nbsp;    " (<TokenSpaceGuidCName>.<PcdCName>= ;|<DefaultValue>|<DatumType>|<Token>)",
+            &= nbsp;           &nbs= p;       File=3Dself.MetaFile, Line=3Dself._L= ineIndex + 1)
+
+            # chec= k PCD datum information
+            if len= (TokenList) < 2 or TokenList[1] =3D=3D '':
+            &= nbsp;   EdkLogger.error('Parser', FORMAT_INVALID, "No PCD Da= tum information given",
+            &= nbsp;           &nbs= p;       ExtraData=3Dself._CurrentLine + \ +            &= nbsp;           &nbs= p;            &= nbsp;    " (<TokenSpaceGuidCName>.<PcdCName>= ;|<DefaultValue>|<DatumType>|<Token>)",
+            &= nbsp;           &nbs= p;       File=3Dself.MetaFile, Line=3Dself._L= ineIndex+1)
+
+
+            ValueR= e =3D re.compile(r'^\s*L?\".*\|.*\"')
+            PtrVal= ue =3D ValueRe.findall(TokenList[1])
+
+            # Has = VOID* type string, may contain "|" character in the string.
+            if len= (PtrValue) !=3D 0:
+            &= nbsp;   ptrValueList =3D re.sub(ValueRe, '', TokenList[1])
+            &= nbsp;   ValueList =3D AnalyzePcdExpression(ptrValueList)
+            &= nbsp;   ValueList[0] =3D PtrValue[0]
+            else:<= br> +            &= nbsp;   ValueList =3D AnalyzePcdExpression(TokenList[1])
+
+
+            # chec= k if there's enough datum information given
+            if len= (ValueList) !=3D 3:
+            &= nbsp;   EdkLogger.error('Parser', FORMAT_INVALID, "Invalid P= CD Datum information given",
+            &= nbsp;           &nbs= p;       ExtraData=3Dself._CurrentLine + \ +            &= nbsp;           &nbs= p;            &= nbsp;    " (<TokenSpaceGuidCName>.<PcdCName>= ;|<DefaultValue>|<DatumType>|<Token>)",
+            &= nbsp;           &nbs= p;       File=3Dself.MetaFile, Line=3Dself._L= ineIndex + 1)
+            # chec= k default value
+            if Val= ueList[0] =3D=3D '':
+            &= nbsp;   EdkLogger.error('Parser', FORMAT_INVALID, "Missing D= efaultValue in PCD Datum information",
+            &= nbsp;           &nbs= p;       ExtraData=3Dself._CurrentLine + \ +            &= nbsp;           &nbs= p;            &= nbsp;    " (<TokenSpaceGuidCName>.<PcdCName>= ;|<DefaultValue>|<DatumType>|<Token>)",
+            &= nbsp;           &nbs= p;       File=3Dself.MetaFile, Line=3Dself._L= ineIndex + 1)
+            # chec= k datum type
+            if Val= ueList[1] =3D=3D '':
+            &= nbsp;   EdkLogger.error('Parser', FORMAT_INVALID, "Missing D= atumType in PCD Datum information",
+            &= nbsp;           &nbs= p;       ExtraData=3Dself._CurrentLine + \ +            &= nbsp;           &nbs= p;            &= nbsp;    " (<TokenSpaceGuidCName>.<PcdCName>= ;|<DefaultValue>|<DatumType>|<Token>)",
+            &= nbsp;           &nbs= p;       File=3Dself.MetaFile, Line=3Dself._L= ineIndex + 1)
+            # chec= k token of the PCD
+            if Val= ueList[2] =3D=3D '':
+            &= nbsp;   EdkLogger.error('Parser', FORMAT_INVALID, "Missing T= oken in PCD Datum information",
+            &= nbsp;           &nbs= p;       ExtraData=3Dself._CurrentLine + \ +            &= nbsp;           &nbs= p;            &= nbsp;    " (<TokenSpaceGuidCName>.<PcdCName>= ;|<DefaultValue>|<DatumType>|<Token>)",
+            &= nbsp;           &nbs= p;       File=3Dself.MetaFile, Line=3Dself._L= ineIndex + 1)
+
+            PcdVal= ue =3D ValueList[0]
+            if Pcd= Value:
+            &= nbsp;   try:
+            &= nbsp;       self._GuidDict.update(self._AllPc= dDict)
+            &= nbsp;       ValueList[0] =3D ValueExpressionE= x(ValueList[0], ValueList[1], self._GuidDict)(True)
+            &= nbsp;   except BadExpression as Value:
+            &= nbsp;       EdkLogger.error('Parser', FORMAT_= INVALID, Value, ExtraData=3Dself._CurrentLine, File=3Dself.MetaFile, Line= =3Dself._LineIndex + 1)
+            # chec= k format of default value against the datum type
+            IsVali= d, Cause =3D CheckPcdDatum(ValueList[1], ValueList[0])
+            if not= IsValid:
+            &= nbsp;   EdkLogger.error('Parser', FORMAT_INVALID, Cause, ExtraDat= a=3Dself._CurrentLine,
+            &= nbsp;           &nbs= p;       File=3Dself.MetaFile, Line=3Dself._L= ineIndex + 1)
+
+            if Cau= se =3D=3D "StructurePcd":
+            &= nbsp;   self._CurrentStructurePcdName =3D TAB_SPLIT.join(self._Va= lueList[0:2])
+            &= nbsp;   self._ValueList[0] =3D self._CurrentStructurePcdName
+            &= nbsp;   self._ValueList[1] =3D ValueList[1].strip()
+
+            if Val= ueList[0] in ['True', 'true', 'TRUE']:
+            &= nbsp;   ValueList[0] =3D '1'
+            elif V= alueList[0] in ['False', 'false', 'FALSE']:
+            &= nbsp;   ValueList[0] =3D '0'
+
+            # chec= k for duplicate PCD definition
+            if (se= lf._Scope[0], self._ValueList[0], self._ValueList[1]) in self._AllPCDs:
+            &= nbsp;   EdkLogger.error('Parser', FORMAT_INVALID,
+            &= nbsp;           &nbs= p;       "The same PCD name and GUID hav= e been already defined",
+            &= nbsp;           &nbs= p;       ExtraData=3Dself._CurrentLine, File= =3Dself.MetaFile, Line=3Dself._LineIndex + 1)
+            else:<= br> +            &= nbsp;   self._AllPCDs.append((self._Scope[0], self._ValueList[0],= self._ValueList[1]))
+            &= nbsp;   self._AllPcdDict[TAB_SPLIT.join(self._ValueList[0:2])] = =3D ValueList[0]
+
+            self._= ValueList[2] =3D ValueList[0].strip() + '|' + ValueList[1].strip() + '|' + = ValueList[2].strip()
 
     _SectionParser =3D {
         MODEL_META_DATA_HEADER&nb= sp;         :   MetaFileP= arser._DefineParser,
--
2.26.2.windows.1



 

 

--_000_MW4PR21MB19075000390207AB161A2E70EF749MW4PR21MB1907namp_--