From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR01-DB5-obe.outbound.protection.outlook.com (EUR01-DB5-obe.outbound.protection.outlook.com [40.107.15.80]) by mx.groups.io with SMTP id smtpd.web11.16235.1577595227606116673 for ; Sat, 28 Dec 2019 20:53:48 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@nxp.com header.s=selector2 header.b=Md6QCp1v; spf=pass (domain: nxp.com, ip: 40.107.15.80, mailfrom: pankaj.bansal@nxp.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BdTC8L6B0AY3EcpV3vEkBZMm71JiQ+q4dLp7joI/E2lxgLJ8SDs7rmP4lEZWG644CF9Dt8FnAyq7/uBbVmbmDg0hu6tm+URn7d6Agepc/2OO1kpE3oVaJlcucvXpu8AGdSNAie1rSoGCzo4ZfoIjAkvXh5zETbOzLLmCbrx8m7COGPn1UvLmwsiyh+wPvUZ3tYUsQppP/y6IZ1L9XBAfLhTgTzMQg9HLY9Orn3oqNdJdMxswbtlYp+h/TKSXiHyYVe4Bn7UIYRJVlXgZN4B6LUIJR7BXYmC6xX6Cm2jHMWR4SEgHKD9V4Cqzals8HZeD3rsw5VGEn0ArgJU/jF9JSw== 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=tZgzOCabApi01T+avRA3a69nBw+kx6bUwh7Ra+8B4eU=; b=SgoUDzqzie44v545guq0eVR+XSW03Yz1e66KUspcbEFwN6vkCWXbHk0+43GfyYwmntJ0Kb1CeiSe0Ej0/pb3glOy7EuJIw+2vYrHxOWpgMDB3UuGtxO8C3ck4LUzqU2iWl+LziMSGWtHqz8GqQHfOk3ClwVQUQYXWQpTjGBXd2YGbYj8jPYM2DkP4peRo68ehU6iaQd308XWqmVmrLhoekus9mgIAVQ83Qa88SWoFMRyoiM3iHlfNQ4nGYFZrj6FjWHPTVE6+K6p6WVIfosLzbKwUxU+ahJtgfT0aVHhyEzYUKXQijujFPpMEjFvvcNDjDeppin5AtGq5PvSapcdMA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tZgzOCabApi01T+avRA3a69nBw+kx6bUwh7Ra+8B4eU=; b=Md6QCp1vCNVOLUc7azK8ooYIStdUAnFyNlbhcqE6MyeXAkaxdIJsG2qxNhclviJSdPIUxEx66/TsDCk1ikpmZ42767r/BWyJKZ4wnRWB0GzikMQrCI20UR3ig36QbnQJ42QlgBGyRBGG4NsFtyEcMkQ8Y7lB6MrvOCcZ1EHpFNg= Received: from VI1PR0401MB2496.eurprd04.prod.outlook.com (10.168.65.10) by VI1PR0401MB2238.eurprd04.prod.outlook.com (10.169.133.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2581.12; Sun, 29 Dec 2019 04:53:45 +0000 Received: from VI1PR0401MB2496.eurprd04.prod.outlook.com ([fe80::8823:663d:c6ed:cbd6]) by VI1PR0401MB2496.eurprd04.prod.outlook.com ([fe80::8823:663d:c6ed:cbd6%12]) with mapi id 15.20.2581.007; Sun, 29 Dec 2019 04:53:45 +0000 Received: from uefi-workstation.ap.freescale.net (92.120.1.69) by TYCPR01CA0026.jpnprd01.prod.outlook.com (2603:1096:405:1::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2581.11 via Frontend Transport; Sun, 29 Dec 2019 04:53:42 +0000 From: pankaj.bansal@nxp.com To: "devel@edk2.groups.io" CC: Pankaj Bansal , Dandan Bi , Liming Gao Subject: [PATCH] MdeModulePkg PeiCore: Install SEC PPIs before library constructor call Thread-Topic: [PATCH] MdeModulePkg PeiCore: Install SEC PPIs before library constructor call Thread-Index: AQHVvgPymyICpiI6tkWQbYHqZL3dCA== Date: Sun, 29 Dec 2019 04:53:44 +0000 Message-ID: <20191229101353.20820-1-pankaj.bansal@nxp.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: TYCPR01CA0026.jpnprd01.prod.outlook.com (2603:1096:405:1::14) To VI1PR0401MB2496.eurprd04.prod.outlook.com (2603:10a6:800:56::10) x-mailer: git-send-email 2.17.1 authentication-results: spf=none (sender IP is ) smtp.mailfrom=pankaj.bansal@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [92.120.1.69] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: caa244a2-d474-4fae-4dd8-08d78c1b153d x-ms-traffictypediagnostic: VI1PR0401MB2238:|VI1PR0401MB2238: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:6430; x-forefront-prvs: 0266491E90 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(39860400002)(366004)(136003)(396003)(376002)(346002)(189003)(199004)(478600001)(6486002)(316002)(1076003)(5660300002)(6512007)(54906003)(6916009)(2906002)(4326008)(71200400001)(8676002)(16526019)(66556008)(186003)(66446008)(81156014)(66476007)(66946007)(64756008)(81166006)(52116002)(36756003)(6506007)(26005)(86362001)(8936002)(44832011)(2616005)(956004);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR0401MB2238;H:VI1PR0401MB2496.eurprd04.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: d/OSW2n/ig/8aMbwYkmFtnt6I8kZZNCcenPxpx7vRhwnN1aSe3rJsTvpVqzSeeX9j2IzJhtXNbX2UcSZLxZDJnYJG81cxZxTWxzU74MiglUv5/SRsT7DYJix2snoR2g+rHu2BY4EdrPlz6+BIsm+/qD2Z1U6Q3aKOuijTAsPFhqk+c1YURMAUBXPURwOlyKhb+w8ZJn3eKm7uW9/XYFrMxk7tRTvb0HIcmNbjOb/ekyBFzyUUcWt1mAV6Ue5QNFzNVqwtIEc7F2iHmRFUDGDnibIBMFboOHbB6HcU4AEWJ6NErmsFH053gkOp2TXcL9nVeMwXOiGvAX+qDFqm2UPA7Wz0Os5CKvFvo/uhKeoWmV3DeHBwc+0KgZxdWzlmUnAG+YfVr8CQrDCXgr6ocCY+ui8OOWrZNsFUHH61BLIwIJgPphhiDLCRzhp0r78Dy3a MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: caa244a2-d474-4fae-4dd8-08d78c1b153d X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Dec 2019 04:53:44.9317 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 6+pk2/04+5FS2wvlpdgtonSHNvVFpBGP77woH7zPQU5yYs8lub8aemRJhSNcuLMbMrVnJ+VNsw/qhPW9eYXdGQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0401MB2238 Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Install PPIs received from SEC phase before library constructor call, so that any platform specific library can make use of the PPIs exposed by SEC phase. Since SEC phase can expose HOBs also in PPI list, we need to Initialize memory service before installing SEC PPIs. Therefore, the sequence becomes: Initialize memory -> install SEC PPIs -> Call libraries' constructors Signed-off-by: Pankaj Bansal Cc: Dandan Bi Cc: Liming Gao --- MdeModulePkg/Core/Pei/PeiMain/PeiMain.c | 24 ++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/MdeModulePkg/Core/Pei/PeiMain/PeiMain.c b/MdeModulePkg/Core/Pe= i/PeiMain/PeiMain.c index 025d7f98ec..3dd69ddde0 100644 --- a/MdeModulePkg/Core/Pei/PeiMain/PeiMain.c +++ b/MdeModulePkg/Core/Pei/PeiMain/PeiMain.c @@ -366,14 +366,23 @@ PeiCore ( SetPeiServicesTablePointer ((CONST EFI_PEI_SERVICES **)&PrivateData.Ps); =20 // - // Initialize libraries that the PEI Core is linked against + // Initialize PEI Core Services // - ProcessLibraryConstructorList (NULL, (CONST EFI_PEI_SERVICES **)&Private= Data.Ps); + InitializeMemoryServices (&PrivateData, SecCoreData, OldCoreData); + + if (OldCoreData =3D=3D NULL) { + // + // If SEC provided the PpiList, process it. + // + if (PpiList !=3D NULL) { + ProcessPpiListFromSec ((CONST EFI_PEI_SERVICES **) &PrivateData.Ps, = PpiList); + } + } =20 // - // Initialize PEI Core Services + // Initialize libraries that the PEI Core is linked against // - InitializeMemoryServices (&PrivateData, SecCoreData, OldCoreData); + ProcessLibraryConstructorList (NULL, (CONST EFI_PEI_SERVICES **)&Private= Data.Ps); =20 // // Update performance measurements @@ -410,13 +419,6 @@ PeiCore ( EFI_PROGRESS_CODE, (EFI_SOFTWARE_PEI_CORE | EFI_SW_PC_INIT) ); - - // - // If SEC provided the PpiList, process it. - // - if (PpiList !=3D NULL) { - ProcessPpiListFromSec ((CONST EFI_PEI_SERVICES **) &PrivateData.Ps, = PpiList); - } } else { // // Try to locate Temporary RAM Done Ppi. --=20 2.17.1