From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mx.groups.io with SMTP id smtpd.web08.8972.1608626152622488802 for ; Tue, 22 Dec 2020 00:35:53 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=HXb1gL5h; spf=pass (domain: intel.com, ip: 134.134.136.100, mailfrom: hao.a.wu@intel.com) IronPort-SDR: 1oZZmkO/k659Q0LupY22tKfra3PPjul0HxyY7EuBLSzYr+7Va2GZtq7w3pXJ1Xi7+UPTA9T7e8 GcwtTRIA1jnA== X-IronPort-AV: E=McAfee;i="6000,8403,9842"; a="239924672" X-IronPort-AV: E=Sophos;i="5.78,438,1599548400"; d="scan'208";a="239924672" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Dec 2020 00:35:51 -0800 IronPort-SDR: MfTt9LDVWAC8F9n8TOvsjoN13f4+Mrcg46KQHNoA5KnqYGBP6RWb3pxGHOffV5vbOyvdb6by6r LYkrIQ0/dC2Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.78,438,1599548400"; d="scan'208";a="345459888" Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by orsmga006.jf.intel.com with ESMTP; 22 Dec 2020 00:35:51 -0800 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Tue, 22 Dec 2020 00:35:50 -0800 Received: from orsmsx601.amr.corp.intel.com (10.22.229.14) by ORSMSX610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Tue, 22 Dec 2020 00:35:50 -0800 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5 via Frontend Transport; Tue, 22 Dec 2020 00:35:50 -0800 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (104.47.74.44) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.1713.5; Tue, 22 Dec 2020 00:35:44 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Oh/YWEYi+uIfT3Fh8GdPbb35SRdVMG/QaAwmM8replOCGYOj/2GqkZWPcruByrtzNuJ1maQUuTwaqz4E1nrEgUwmgRwuVPIG/hVnBnydZ7TZ1MTOBK3nokAHZ57anThDK9DQmBUSl1/lbXOylffVzzq2YniQP+WyT8dPrt/m0vp4un/kn/NL+PWSNAVH0Y1uBeRUDQ/SxEi0UKC0gerUhoy7VbV1ZOsJ6b/twmtPlVZpzZbhI91ZczJr1LOxvLKX3yPJwlwoxqyCLgfL7z5Vu1QPa8CghE1a+E4yquq2zksw2UX2H34Si4nMzbAGNbJasM4tCX5a+/Lz5yBSDNuL1w== 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=3v4QkgpJ8t58aNlod5n7s/8uDKUY8EBpXLCsed2Mu7I=; b=NIcqU78tCLDz0xWhXMqFCQspYZPlLkvlNLuJ9ekX34qwyjjg+MSfM/+azmzTNer0EoFlXFj5U0Urbs3ZPZnSyz9rQn38UmvJoIuhdVdMOTOE0yaevgz64jOFzDdP2jplMEECJtrIp2NUD4x09nROgG9VJniGkW/JZDN8Kzq3r+IrIjeWFLxe3/XcgrR59orRqpqnU8i40FzsYvpl1q2vAifuicaWX2sYQG36VUhB5sdgnznI7neQDgtJ6hljRDWRXVWHwyvRhU/zCoJxd/l+s2looe7vykGrQHaYSd7V5FCPZECUHRoMs64mSLtcSEnlBepX3OW7A78Lh0cSv1bGGA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3v4QkgpJ8t58aNlod5n7s/8uDKUY8EBpXLCsed2Mu7I=; b=HXb1gL5hPxS39LuCeZ9mgs3oC1aRJQpdXgYIAUSo+VLn8U4JBOW7AJ48/Kv/gqNmH3JvsPoA+8PnKxf58xM8hpsb34eywJkLOYz/9A5uaFWdJpmCrbNFdHfTGAmLBnUiuf/bgwEIzsrQms9SsiYuSCbY9ZOFCLKgdH0/M+fU3j4= Received: from BN8PR11MB3666.namprd11.prod.outlook.com (2603:10b6:408:8c::19) by BN6PR1101MB2354.namprd11.prod.outlook.com (2603:10b6:404:9b::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3676.25; Tue, 22 Dec 2020 08:35:41 +0000 Received: from BN8PR11MB3666.namprd11.prod.outlook.com ([fe80::4cda:993f:ffc1:f169]) by BN8PR11MB3666.namprd11.prod.outlook.com ([fe80::4cda:993f:ffc1:f169%6]) with mapi id 15.20.3676.033; Tue, 22 Dec 2020 08:35:41 +0000 From: "Wu, Hao A" To: "devel@edk2.groups.io" , "kun.q@outlook.com" CC: "Wang, Jian J" , "Dong, Eric" , "Yao, Jiewen" Subject: Re: [edk2-devel] [PATCH v1 05/15] MdeModulePkg: SmmLockBoxSmmLib: Support StandaloneMm for SmmLockBoxLib Thread-Topic: [edk2-devel] [PATCH v1 05/15] MdeModulePkg: SmmLockBoxSmmLib: Support StandaloneMm for SmmLockBoxLib Thread-Index: AQHW1W60bicQQwxSyEWhaQsEq3z3aaoBPSGg Date: Tue, 22 Dec 2020 08:35:40 +0000 Message-ID: References: <20201218185011.1366-1-kun.q@outlook.com> In-Reply-To: Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.5.1.3 authentication-results: edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.198.147.218] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: e41fa39a-c7db-4855-a03f-08d8a65490ef x-ms-traffictypediagnostic: BN6PR1101MB2354: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:5236; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 1Z/IkdcQC+aGv3JfhqfCVGZ6LDPw/NjwECyjka+aYK6BdiSwDAFI2Q/f/0pX6E4E99L8u8xRwlmJPbQwhHEWEKPX4KbMqvBuiba0vxZwipp46oh7mh8aurJQgHkwaPggi8VElcNtoBVAgBSSjH8x5mcWGrnY6nnx0PxCcvn+aZ/zZLo0itzCiYrHRzK4U/gFEwflJlNaXu9VZ7b4I/ErOgEXxY4/rGeJ4omBJWUmwDQgPxzVsz7NSEpVnANVOtPo8D7qXnVWC9g7/C8Hcgvfhi4m4PuV7CWsBF5NBV1MTZP/XvTeMM63n2wlxGdgvTsc1RPXrZC7v90zx8LGrRfDaR7HqzG4eDK9MxiqTlrkxuqylvmHKxBgc6PpLCM0fUndQBs7nk2JhOCziARZo0mSQCy7a757qNV+dYviBnny7uH+i5hMkz8pisk5UD1teMTXPrwBVtO5jYLcVLvcuZrepMZMGxrB/9H9gd5O6HFN+ud2u0p9ZYVg5NwpCk5sNSZH1CsEBAeAb8XaQcja7H1is3fPuc0j5FQyv/ZNlD1ZOXo= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN8PR11MB3666.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(346002)(136003)(376002)(39860400002)(366004)(396003)(110136005)(76116006)(9686003)(186003)(66946007)(54906003)(55016002)(30864003)(83380400001)(107886003)(53546011)(5660300002)(316002)(478600001)(4326008)(8676002)(966005)(52536014)(45080400002)(2906002)(8936002)(86362001)(7696005)(6506007)(71200400001)(26005)(19627235002)(66556008)(66446008)(66476007)(33656002)(64756008)(290074003)(213903007)(579004);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?n0EzIIsnKbPAGCcRUNI4rZJqYKZ8lr1U3BHjccEdSWsRgHcEGWKfT7z1mquV?= =?us-ascii?Q?XYRcWMpJrxSl+FAp0pzPHuhp+bb0qDjZ5dNhBkT+Yt4WwDVPORMpqsYQXOSc?= =?us-ascii?Q?88Sq55NzPMqRu7W6DjUgaAk/yd74VQ3h2MFqLXgE6bRAZxrIiAmE/KNUqaxC?= =?us-ascii?Q?Czr6pRijikQaL6Fsdc6mcZJfpY7VSAkPiE+oyBSvcqT+Fyd+KcMFn9n4bVNH?= =?us-ascii?Q?mkhk/ViU1fyztnupxRafoYcP3zRo4qRiZiDAiF09A7++M6Tva7pg2YDKqUVi?= =?us-ascii?Q?Exa4+EiB4VichcSJypJldEeGPIldVKXjXHP7TI2Uyv5AUrvbqChri+2i1gAQ?= =?us-ascii?Q?3zOPvwMq0n+xjO9KBiACOSzgP/7oUsI1RhNraFwnfAF6QYmkww1GTT0Hu5lC?= =?us-ascii?Q?OgSkrJZSTeg43rVmbSENlm7uoF6P19U6GXsyLYlI9MiaUmWV/CuCRQeP5xUt?= =?us-ascii?Q?jtUFOTRAFHujpRTBpFlqfvMhorZkNE4mOQWSmeNQ8IB4VzWeNUNzAISFba61?= =?us-ascii?Q?QEPu0k9AR9CYSKz2ogZ7KWYybUe1jUh2UuOghwZoI40YQKeIfZcbJ7pOsK6P?= =?us-ascii?Q?3Byo2uunu2gAyYSRAinMnOQEe4mud7VLxWAvWqCTtpYXWVlDjiTmWiVbSTdK?= =?us-ascii?Q?xvIgALS1KTbqm57RYj6auc0vQHl2np5QLF4DwLAj0Jr/7FjAgVCWmwdgHtaf?= =?us-ascii?Q?RcEHLwpsQ5q2ezPLzZ0RGddtE+xeooARnquzLxWLRHhm3e3XAbTaMa9vpgj/?= =?us-ascii?Q?KRSXsBv3Xp50ZUmwYHWfPXI8TwJEsBubOx1+vmiZtN8L0CtIKgN2Um/630fO?= =?us-ascii?Q?lJmLnWlkWfhL2L1QLQxJA2XLoXzD0eh5bdHk+t7Wi7kVjhmxgfzFbSlDHgkm?= =?us-ascii?Q?NTdL9ckf9Ee4KUznE6uBqzOzx3NgzWXBWq6o4U5KrIM5VsShdtSlSNVD4HI3?= =?us-ascii?Q?HgotAOJ3Yw4x1RSlja8TmWD6SL5oVJxcy2xZLSWdXZ4=3D?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BN8PR11MB3666.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: e41fa39a-c7db-4855-a03f-08d8a65490ef X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Dec 2020 08:35:41.0373 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: fCAMXFM+whf5aLnIK9zqprowiu+FXyE+khOMOoR46E54+Hede2nUvYYHlms5e/oeq/t+Tr8wiz5XFbGuPa6ZTA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR1101MB2354 Return-Path: hao.a.wu@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable A couple of minor inline comments below. With them handled: Reviewed-by: Hao A Wu > -----Original Message----- > From: devel@edk2.groups.io On Behalf Of Kun Qin > Sent: Saturday, December 19, 2020 2:50 AM > To: devel@edk2.groups.io > Cc: Wang, Jian J ; Wu, Hao A = ; > Dong, Eric > Subject: [edk2-devel] [PATCH v1 05/15] MdeModulePkg: > SmmLockBoxSmmLib: Support StandaloneMm for SmmLockBoxLib >=20 > This change added support of StandaloneMm for SmmLockBoxLib. It replaces > gSmst with gMmst to support both traditional MM and standalone MM. The > contructor and desctructor functions are abstracted to support different > function prototype definitions. >=20 > Cc: Jian J Wang > Cc: Hao A Wu > Cc: Eric Dong >=20 > Signed-off-by: Kun Qin > --- > MdeModulePkg/Library/SmmLockBoxLib/{SmmLockBoxSmmLib.c =3D> > SmmLockBoxMmLib.c} | 77 +++++++++----------- > MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxStandaloneMmLib.c > | 53 ++++++++++++++ > MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxTraditionalMmLib.c > | 53 ++++++++++++++ > MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxLibPrivate.h > | 27 +++++++ > MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxSmmLib.inf > | 15 ++-- > MdeModulePkg/Library/SmmLockBoxLib/{SmmLockBoxSmmLib.inf =3D> > SmmLockBoxStandaloneMmLib.inf} | 26 ++++--- > MdeModulePkg/MdeModulePkg.dsc = | 2 + > 7 files changed, 193 insertions(+), 60 deletions(-) >=20 > diff --git a/MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxSmmLib.c > b/MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxMmLib.c > similarity index 89% > rename from > MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxSmmLib.c > rename to MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxMmLib.c > index 4cc0e8b78e5b..68fcf2a78ed6 100644 > --- a/MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxSmmLib.c > +++ b/MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxMmLib.c > @@ -6,16 +6,16 @@ SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > **/ >=20 > -#include > -#include > +#include > +#include > #include > #include > #include > #include > #include > #include > -#include > -#include > +#include > +#include > #include >=20 > #include "SmmLockBoxLibPrivate.h" > @@ -49,13 +49,13 @@ InternalGetSmmLockBoxContext ( > // > // Check if gEfiSmmLockBoxCommunicationGuid is installed by someone > // > - for (Index =3D 0; Index < gSmst->NumberOfTableEntries; Index++) { > - if (CompareGuid (&gSmst->SmmConfigurationTable[Index].VendorGuid, > &gEfiSmmLockBoxCommunicationGuid)) { > + for (Index =3D 0; Index < gMmst->NumberOfTableEntries; Index++) { > + if (CompareGuid (&gMmst->MmConfigurationTable[Index].VendorGuid, > + &gEfiSmmLockBoxCommunicationGuid)) { > // > // Found. That means some other library instance is already run. > // No need to install again, just return. > // > - return (SMM_LOCK_BOX_CONTEXT *)gSmst- > >SmmConfigurationTable[Index].VendorTable; > + return (SMM_LOCK_BOX_CONTEXT > + *)gMmst->MmConfigurationTable[Index].VendorTable; > } > } >=20 > @@ -142,8 +142,8 @@ SmmLockBoxSmmEndOfDxeNotify ( > // > // Locate SmmSxDispatch2 protocol. > // > - Status =3D gSmst->SmmLocateProtocol ( > - &gEfiSmmSxDispatch2ProtocolGuid, > + Status =3D gMmst->MmLocateProtocol ( > + &gEfiMmSxDispatchProtocolGuid, > NULL, > (VOID **)&SxDispatch > ); > @@ -191,29 +191,25 @@ SmmLockBoxEndOfS3ResumeNotify ( > Constructor for SmmLockBox library. > This is used to set SmmLockBox context, which will be used in PEI pha= se in > S3 boot path later. >=20 > - @param[in] ImageHandle Image handle of this driver. > - @param[in] SystemTable A Pointer to the EFI System Table. > - > @retval EFI_SUCEESS > @return Others Some error occurs. > **/ > EFI_STATUS > EFIAPI > -SmmLockBoxSmmConstructor ( > - IN EFI_HANDLE ImageHandle, > - IN EFI_SYSTEM_TABLE *SystemTable > +SmmLockBoxMmConstructor ( > + VOID > ) Since function SmmLockBoxMmConstructor() now has become an library interna= l function. Could you help to remove the 'EFIAPI' keyword for it? > { > EFI_STATUS Status; > SMM_LOCK_BOX_CONTEXT *SmmLockBoxContext; >=20 > - DEBUG ((DEBUG_INFO, "SmmLockBoxSmmLib > SmmLockBoxSmmConstructor - Enter\n")); > + DEBUG ((DEBUG_INFO, "SmmLockBoxSmmLib > SmmLockBoxMmConstructor - > + Enter\n")); >=20 > // > // Register SmmReadyToLock notification. > // > - Status =3D gSmst->SmmRegisterProtocolNotify ( > - &gEfiSmmReadyToLockProtocolGuid, > + Status =3D gMmst->MmRegisterProtocolNotify ( > + &gEfiMmReadyToLockProtocolGuid, > SmmLockBoxSmmReadyToLockNotify, > &mSmmLockBoxRegistrationSmmReadyToLock > ); > @@ -222,8 +218,8 @@ SmmLockBoxSmmConstructor ( > // > // Register SmmEndOfDxe notification. > // > - Status =3D gSmst->SmmRegisterProtocolNotify ( > - &gEfiSmmEndOfDxeProtocolGuid, > + Status =3D gMmst->MmRegisterProtocolNotify ( > + &gEfiMmEndOfDxeProtocolGuid, > SmmLockBoxSmmEndOfDxeNotify, > &mSmmLockBoxRegistrationSmmEndOfDxe > ); > @@ -232,7 +228,7 @@ SmmLockBoxSmmConstructor ( > // > // Register EndOfS3Resume notification. > // > - Status =3D gSmst->SmmRegisterProtocolNotify ( > + Status =3D gMmst->MmRegisterProtocolNotify ( > &gEdkiiEndOfS3ResumeGuid, > SmmLockBoxEndOfS3ResumeNotify, > &mSmmLockBoxRegistrationEndOfS3Resume > @@ -249,7 +245,7 @@ SmmLockBoxSmmConstructor ( > // No need to install again, just return. > // > DEBUG ((DEBUG_INFO, "SmmLockBoxSmmLib SmmLockBoxContext - > already installed\n")); > - DEBUG ((DEBUG_INFO, "SmmLockBoxSmmLib > SmmLockBoxSmmConstructor - Exit\n")); > + DEBUG ((DEBUG_INFO, "SmmLockBoxSmmLib > SmmLockBoxMmConstructor - > + Exit\n")); > return EFI_SUCCESS; > } >=20 > @@ -263,8 +259,8 @@ SmmLockBoxSmmConstructor ( > } > mSmmLockBoxContext.LockBoxDataAddress =3D > (EFI_PHYSICAL_ADDRESS)(UINTN)&mLockBoxQueue; >=20 > - Status =3D gSmst->SmmInstallConfigurationTable ( > - gSmst, > + Status =3D gMmst->MmInstallConfigurationTable ( > + gMmst, > &gEfiSmmLockBoxCommunicationGuid, > &mSmmLockBoxContext, > sizeof(mSmmLockBoxContext) @@ -274,7 +270,7 @@ > SmmLockBoxSmmConstructor ( >=20 > DEBUG ((DEBUG_INFO, "SmmLockBoxSmmLib SmmLockBoxContext - > %x\n", (UINTN)&mSmmLockBoxContext)); > DEBUG ((DEBUG_INFO, "SmmLockBoxSmmLib LockBoxDataAddress - > %x\n", (UINTN)&mLockBoxQueue)); > - DEBUG ((DEBUG_INFO, "SmmLockBoxSmmLib > SmmLockBoxSmmConstructor - Exit\n")); > + DEBUG ((DEBUG_INFO, "SmmLockBoxSmmLib > SmmLockBoxMmConstructor - > + Exit\n")); >=20 > return Status; > } > @@ -292,18 +288,17 @@ SmmLockBoxSmmConstructor ( **/ EFI_STATUS > EFIAPI -SmmLockBoxSmmDestructor ( > - IN EFI_HANDLE ImageHandle, > - IN EFI_SYSTEM_TABLE *SystemTable > +SmmLockBoxMmDestructor ( > + VOID > ) Since function SmmLockBoxMmDestructor() now has become an library internal= function. Could you help to remove the 'EFIAPI' keyword for it? Best Regards, Hao Wu > { > EFI_STATUS Status; >=20 > - DEBUG ((DEBUG_INFO, "SmmLockBoxSmmLib > SmmLockBoxSmmDestructor in %a module\n", gEfiCallerBaseName)); > + DEBUG ((DEBUG_INFO, "SmmLockBoxSmmLib SmmLockBoxMmDestructor > in %a > + module\n", gEfiCallerBaseName)); >=20 > if (mSmmConfigurationTableInstalled) { > - Status =3D gSmst->SmmInstallConfigurationTable ( > - gSmst, > + Status =3D gMmst->MmInstallConfigurationTable ( > + gMmst, > &gEfiSmmLockBoxCommunicationGuid, > NULL, > 0 > @@ -316,8 +311,8 @@ SmmLockBoxSmmDestructor ( > // > // Unregister SmmReadyToLock notification. > // > - Status =3D gSmst->SmmRegisterProtocolNotify ( > - &gEfiSmmReadyToLockProtocolGuid, > + Status =3D gMmst->MmRegisterProtocolNotify ( > + &gEfiMmReadyToLockProtocolGuid, > NULL, > &mSmmLockBoxRegistrationSmmReadyToLock > ); > @@ -327,8 +322,8 @@ SmmLockBoxSmmDestructor ( > // > // Unregister SmmEndOfDxe notification. > // > - Status =3D gSmst->SmmRegisterProtocolNotify ( > - &gEfiSmmEndOfDxeProtocolGuid, > + Status =3D gMmst->MmRegisterProtocolNotify ( > + &gEfiMmEndOfDxeProtocolGuid, > NULL, > &mSmmLockBoxRegistrationSmmEndOfDxe > ); > @@ -338,7 +333,7 @@ SmmLockBoxSmmDestructor ( > // > // Unregister EndOfS3Resume notification. > // > - Status =3D gSmst->SmmRegisterProtocolNotify ( > + Status =3D gMmst->MmRegisterProtocolNotify ( > &gEdkiiEndOfS3ResumeGuid, > NULL, > &mSmmLockBoxRegistrationEndOfS3Resume > @@ -453,7 +448,7 @@ SaveLockBox ( > // > // Allocate SMRAM buffer > // > - Status =3D gSmst->SmmAllocatePages ( > + Status =3D gMmst->MmAllocatePages ( > AllocateAnyPages, > EfiRuntimeServicesData, > EFI_SIZE_TO_PAGES (Length), @@ -468,14 +463,14 @@ > SaveLockBox ( > // > // Allocate LockBox > // > - Status =3D gSmst->SmmAllocatePool ( > + Status =3D gMmst->MmAllocatePool ( > EfiRuntimeServicesData, > sizeof(*LockBox), > (VOID **)&LockBox > ); > ASSERT_EFI_ERROR (Status); > if (EFI_ERROR (Status)) { > - gSmst->SmmFreePages (SmramBuffer, EFI_SIZE_TO_PAGES (Length)); > + gMmst->MmFreePages (SmramBuffer, EFI_SIZE_TO_PAGES (Length)); > DEBUG ((DEBUG_INFO, "SmmLockBoxSmmLib SaveLockBox - Exit (%r)\n", > EFI_OUT_OF_RESOURCES)); > return EFI_OUT_OF_RESOURCES; > } > @@ -662,7 +657,7 @@ UpdateLockBox ( > DEBUG_INFO, > "SmmLockBoxSmmLib UpdateLockBox - Allocate new buffer to > enlarge.\n" > )); > - Status =3D gSmst->SmmAllocatePages ( > + Status =3D gMmst->MmAllocatePages ( > AllocateAnyPages, > EfiRuntimeServicesData, > EFI_SIZE_TO_PAGES (Offset + Length), @@ -679,= 7 +674,7 @@ > UpdateLockBox ( > // > CopyMem ((VOID *)(UINTN)SmramBuffer, (VOID *)(UINTN)LockBox- > >SmramBuffer, (UINTN)LockBox->Length); > ZeroMem ((VOID *)(UINTN)LockBox->SmramBuffer, (UINTN)LockBox- > >Length); > - gSmst->SmmFreePages (LockBox->SmramBuffer, EFI_SIZE_TO_PAGES > ((UINTN)LockBox->Length)); > + gMmst->MmFreePages (LockBox->SmramBuffer, EFI_SIZE_TO_PAGES > + ((UINTN)LockBox->Length)); >=20 > LockBox->SmramBuffer =3D SmramBuffer; > } > diff --git > a/MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxStandaloneMmLib. > c > b/MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxStandaloneMmLib. > c > new file mode 100644 > index 000000000000..722121da430b > --- /dev/null > +++ > b/MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxStandaloneMmLib. > c > @@ -0,0 +1,53 @@ > +/** @file > + > +Copyright (c) 2010 - 2019, Intel Corporation. All rights reserved.
> +Copyright (c) Microsoft Corporation. > + > +SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#include > + > +#include "SmmLockBoxLibPrivate.h" > + > +/** > + Constructor for SmmLockBox library. > + This is used to set SmmLockBox context, which will be used in PEI pha= se in > S3 boot path later. > + > + @param[in] ImageHandle Image handle of this driver. > + @param[in] SystemTable A Pointer to the EFI System Table. > + > + @retval EFI_SUCEESS > + @return Others Some error occurs. > +**/ > +EFI_STATUS > +EFIAPI > +SmmLockBoxStandaloneMmConstructor ( > + IN EFI_HANDLE ImageHandle, > + IN EFI_MM_SYSTEM_TABLE *SystemTable > + ) > +{ > + return SmmLockBoxMmConstructor (); > +} > + > +/** > + Destructor for SmmLockBox library. > + This is used to uninstall SmmLockBoxCommunication configuration table > + if it has been installed in Constructor. > + > + @param[in] ImageHandle Image handle of this driver. > + @param[in] SystemTable A Pointer to the EFI System Table. > + > + @retval EFI_SUCEESS The destructor always returns EFI_SUCCESS. > + > +**/ > +EFI_STATUS > +EFIAPI > +SmmLockBoxStandaloneMmDestructor ( > + IN EFI_HANDLE ImageHandle, > + IN EFI_MM_SYSTEM_TABLE *SystemTable > + ) > +{ > + return SmmLockBoxMmDestructor (); > +} > diff --git > a/MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxTraditionalMmLib.c > b/MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxTraditionalMmLib.c > new file mode 100644 > index 000000000000..a748abb16c54 > --- /dev/null > +++ > b/MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxTraditionalMmLib.c > @@ -0,0 +1,53 @@ > +/** @file > + > +Copyright (c) 2010 - 2019, Intel Corporation. All rights reserved.
> +Copyright (c) Microsoft Corporation. > + > +SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#include > + > +#include "SmmLockBoxLibPrivate.h" > + > +/** > + Constructor for SmmLockBox library. > + This is used to set SmmLockBox context, which will be used in PEI pha= se in > S3 boot path later. > + > + @param[in] ImageHandle Image handle of this driver. > + @param[in] SystemTable A Pointer to the EFI System Table. > + > + @retval EFI_SUCEESS > + @return Others Some error occurs. > +**/ > +EFI_STATUS > +EFIAPI > +SmmLockBoxTraditionalConstructor ( > + IN EFI_HANDLE ImageHandle, > + IN EFI_SYSTEM_TABLE *SystemTable > + ) > +{ > + return SmmLockBoxMmConstructor (); > +} > + > +/** > + Destructor for SmmLockBox library. > + This is used to uninstall SmmLockBoxCommunication configuration table > + if it has been installed in Constructor. > + > + @param[in] ImageHandle Image handle of this driver. > + @param[in] SystemTable A Pointer to the EFI System Table. > + > + @retval EFI_SUCEESS The destructor always returns EFI_SUCCESS. > + > +**/ > +EFI_STATUS > +EFIAPI > +SmmLockBoxTraditionalDestructor ( > + IN EFI_HANDLE ImageHandle, > + IN EFI_SYSTEM_TABLE *SystemTable > + ) > +{ > + return SmmLockBoxMmDestructor (); > +} > diff --git > a/MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxLibPrivate.h > b/MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxLibPrivate.h > index 35311cb85d69..f729c6cceeea 100644 > --- a/MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxLibPrivate.h > +++ b/MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxLibPrivate.h > @@ -43,5 +43,32 @@ typedef struct { >=20 > #pragma pack() >=20 > +/** > + Constructor for SmmLockBox library. > + This is used to set SmmLockBox context, which will be used in PEI pha= se in > S3 boot path later. > + > + @retval EFI_SUCEESS > + @return Others Some error occurs. > +**/ > +EFI_STATUS > +EFIAPI > +SmmLockBoxMmConstructor ( > + VOID > + ); > + > +/** > + Destructor for SmmLockBox library. > + This is used to uninstall SmmLockBoxCommunication configuration table > + if it has been installed in Constructor. > + > + @retval EFI_SUCEESS The destructor always returns EFI_SUCCESS. > + > +**/ > +EFI_STATUS > +EFIAPI > +SmmLockBoxMmDestructor ( > + VOID > + ); > + > #endif >=20 > diff --git a/MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxSmmLib.inf > b/MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxSmmLib.inf > index 2b6cc983b988..44f7b63c5d20 100644 > --- a/MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxSmmLib.inf > +++ b/MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxSmmLib.inf > @@ -15,8 +15,8 @@ [Defines] > MODULE_TYPE =3D DXE_SMM_DRIVER > VERSION_STRING =3D 1.0 > LIBRARY_CLASS =3D LockBoxLib|DXE_SMM_DRIVER > - CONSTRUCTOR =3D SmmLockBoxSmmConstructor > - DESTRUCTOR =3D SmmLockBoxSmmDestructor > + CONSTRUCTOR =3D SmmLockBoxTraditionalConstructor > + DESTRUCTOR =3D SmmLockBoxTraditionalDestructor >=20 > # > # The following information is for reference only and not required by t= he > build tools. > @@ -25,7 +25,8 @@ [Defines] > # >=20 > [Sources] > - SmmLockBoxSmmLib.c > + SmmLockBoxTraditionalMmLib.c > + SmmLockBoxMmLib.c > SmmLockBoxLibPrivate.h >=20 > [Packages] > @@ -33,14 +34,14 @@ [Packages] > MdeModulePkg/MdeModulePkg.dec >=20 > [LibraryClasses] > - SmmServicesTableLib > + MmServicesTableLib > BaseLib > DebugLib >=20 > [Protocols] > - gEfiSmmReadyToLockProtocolGuid ## NOTIFY > - gEfiSmmEndOfDxeProtocolGuid ## NOTIFY > - gEfiSmmSxDispatch2ProtocolGuid ## NOTIFY > + gEfiMmReadyToLockProtocolGuid ## NOTIFY > + gEfiMmEndOfDxeProtocolGuid ## NOTIFY > + gEfiMmSxDispatchProtocolGuid ## NOTIFY >=20 > [Guids] > ## SOMETIMES_CONSUMES ## UNDEFINED # SmmSystemTable > diff --git a/MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxSmmLib.inf > b/MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxStandaloneMmLib.i > nf > similarity index 52% > copy from MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxSmmLib.inf > copy to > MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxStandaloneMmLib.inf > index 2b6cc983b988..d46dfb3f9aa8 100644 > --- a/MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxSmmLib.inf > +++ > b/MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxStandaloneMmLib.i > nf > @@ -2,6 +2,7 @@ > # SMM LockBox library instance. > # > # Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved. > +# Copyright (c) Microsoft Corporation. > # > # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -9,14 +10,14 @@ >=20 > [Defines] > INF_VERSION =3D 0x00010005 > - BASE_NAME =3D SmmLockBoxSmmLib > - MODULE_UNI_FILE =3D SmmLockBoxSmmLib.uni > - FILE_GUID =3D E04894D6-290D-4171-A362-0ACFD939F3= C8 > - MODULE_TYPE =3D DXE_SMM_DRIVER > + BASE_NAME =3D SmmLockBoxStandaloneMmLib > + FILE_GUID =3D 3C05978B-30CA-4544-9C5A-AB99265EFC= 31 > + MODULE_TYPE =3D MM_STANDALONE > VERSION_STRING =3D 1.0 > - LIBRARY_CLASS =3D LockBoxLib|DXE_SMM_DRIVER > - CONSTRUCTOR =3D SmmLockBoxSmmConstructor > - DESTRUCTOR =3D SmmLockBoxSmmDestructor > + PI_SPECIFICATION_VERSION =3D 0x00010032 > + LIBRARY_CLASS =3D LockBoxLib|MM_STANDALONE > + CONSTRUCTOR =3D SmmLockBoxStandaloneMmConstructor > + DESTRUCTOR =3D SmmLockBoxStandaloneMmDestructor >=20 > # > # The following information is for reference only and not required by t= he > build tools. > @@ -25,7 +26,8 @@ [Defines] > # >=20 > [Sources] > - SmmLockBoxSmmLib.c > + SmmLockBoxStandaloneMmLib.c > + SmmLockBoxMmLib.c > SmmLockBoxLibPrivate.h >=20 > [Packages] > @@ -33,14 +35,14 @@ [Packages] > MdeModulePkg/MdeModulePkg.dec >=20 > [LibraryClasses] > - SmmServicesTableLib > + MmServicesTableLib > BaseLib > DebugLib >=20 > [Protocols] > - gEfiSmmReadyToLockProtocolGuid ## NOTIFY > - gEfiSmmEndOfDxeProtocolGuid ## NOTIFY > - gEfiSmmSxDispatch2ProtocolGuid ## NOTIFY > + gEfiMmReadyToLockProtocolGuid ## NOTIFY > + gEfiMmEndOfDxeProtocolGuid ## NOTIFY > + gEfiMmSxDispatchProtocolGuid ## NOTIFY >=20 > [Guids] > ## SOMETIMES_CONSUMES ## UNDEFINED # SmmSystemTable > diff --git a/MdeModulePkg/MdeModulePkg.dsc > b/MdeModulePkg/MdeModulePkg.dsc index 90165ca443bf..cd91a70b4fdd > 100644 > --- a/MdeModulePkg/MdeModulePkg.dsc > +++ b/MdeModulePkg/MdeModulePkg.dsc > @@ -167,6 +167,7 @@ [LibraryClasses.common.MM_STANDALONE] >=20 > MemoryAllocationLib|MdeModulePkg/Library/BaseMemoryAllocationLibNul > l/BaseMemoryAllocationLibNull.inf >=20 > StandaloneMmDriverEntryPoint|MdePkg/Library/StandaloneMmDriverEntry > Point/StandaloneMmDriverEntryPoint.inf >=20 > MmServicesTableLib|MdePkg/Library/StandaloneMmServicesTableLib/Stan > daloneMmServicesTableLib.inf > + > + > LockBoxLib|MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxStandalo > neMmLi > + b.inf >=20 > [LibraryClasses.ARM, LibraryClasses.AARCH64] > ArmLib|ArmPkg/Library/ArmLib/ArmBaseLib.inf > @@ -483,6 +484,7 @@ [Components.IA32, Components.X64] > MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxPeiLib.inf > MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxDxeLib.inf > MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxSmmLib.inf > + > MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxStandaloneMmLib.inf >=20 > MdeModulePkg/Library/SmmCorePlatformHookLibNull/SmmCorePlatformH > ookLibNull.inf >=20 > MdeModulePkg/Library/SmmSmiHandlerProfileLib/SmmSmiHandlerProfileLi > b.inf >=20 > MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaArchCustomDeco > mpressLib.inf > -- > 2.28.0.windows.1 >=20 >=20 >=20 >=20 >=20