From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (NAM10-MW2-obe.outbound.protection.outlook.com [40.92.42.41]) by mx.groups.io with SMTP id smtpd.web10.1414.1614108596466272712 for ; Tue, 23 Feb 2021 11:29:56 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@outlook.com header.s=selector1 header.b=T3zBX9zL; spf=pass (domain: outlook.com, ip: 40.92.42.41, mailfrom: kun.q@outlook.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DIe+QdIP92DlorJGjsN3clgW3QgN+MMo9uPI3HredbrbkQpFD1bU+TtIo7lNCYUYsMuXjJG1KMEUqCHrKT97FpQf7dv/UmiOakJjUtOvlrKBrlZetROnrDoaMAGRtzRk3Hih8OxbBvtuB/aAgI7viZW05Mi1ynzlA/6Qi5df6p/UKafDlo20D5xlKnnkP67pL5L7hsAVyVbxZY0A2HxiiDU1glPftUlyrL8jetKETBfMu9mZ4EXi7spC4bNt6+RSDdPB4/yeYfJzYVzV1TDm0IXFD+TzR8K4WNoJ+wa3omOFXhdT3BRFPU8MZOhq4iP4gFjvihtkXZi78DWwIvEoHg== 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=7S3GZ375ak/41xwYCIt14xDFHFElX1Y4khklMFOQztM=; b=bNqgUMNJJmqntx6ohVS92vtNSrVHfo2lBvs8T2wyBD5ZM9JeWezs4Dkw4h/PBZT7yvjPYgcC9m0+FtpbgYhdFIDKYiw72mHlzTGp37Iks+yDZgo4RRnmc74NQR0lrM7GgYmtQpuwBQt34cNI/NJbCruIqYStuflXUbjcI9U74IUpTawD7dmNs3j87Cj8T51XPCHdIsSEhFWvo0AxNabtxRP1UzU050iBlqbYKi9OZADrP+U06kwXws0BhTcOSnNVCrrV9k+ixftohzTbV41O0Nrug7OQhddIth4GMv+Bk1sQiGW8AGcwmeqEBGy+cQcyAgL2TYNEKTygERWDXqbVWQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7S3GZ375ak/41xwYCIt14xDFHFElX1Y4khklMFOQztM=; b=T3zBX9zLTL90j35+mtuf0r/xjBAXjjVc85yhj+OdwIADnaNJS62uxKZv7e46j/SshOaLXhPmplSRifkwQESjXnp0GQh8J/VcqWn4VtZfRwpCGph9J7zgoarEMlFcc0a2wn0/A9yEx/nM0kA8mhG/l/4GeofNEWOSQHYiGyyKN3IEEEYetUtetRsTna72rmbIrHT8GINc4sPyKwdxS/k+3JK/hgaYKpTC7NO9tTCjUH81/jI/nsCQYOa+a6Ocf1+WM2Ke9zgj1ODmQXFaUJJT5EYF00YYu/fA9z+jNTkienO2kRT6/i8v0cPgmEPPVtOfyY06dlxu4idrEi9RSXNCTQ== Received: from MW2NAM10FT013.eop-nam10.prod.protection.outlook.com (2a01:111:e400:7e87::40) by MW2NAM10HT088.eop-nam10.prod.protection.outlook.com (2a01:111:e400:7e87::377) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27; Tue, 23 Feb 2021 19:29:55 +0000 Received: from MWHPR06MB3102.namprd06.prod.outlook.com (2a01:111:e400:7e87::49) by MW2NAM10FT013.mail.protection.outlook.com (2a01:111:e400:7e87::279) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Tue, 23 Feb 2021 19:29:55 +0000 Received: from MWHPR06MB3102.namprd06.prod.outlook.com ([fe80::d4ee:1260:6f53:3f7b]) by MWHPR06MB3102.namprd06.prod.outlook.com ([fe80::d4ee:1260:6f53:3f7b%7]) with mapi id 15.20.3868.032; Tue, 23 Feb 2021 19:29:54 +0000 From: "Kun Qin" To: "devel@edk2.groups.io" , "hao.a.wu@intel.com" , "Yao, Jiewen" , gaoliming , "Kinney, Michael D" , "Liu, Zhiguang" CC: "Wang, Jian J" , "Dong, Eric" , "Ni, Ray" Subject: Re: [edk2-devel] [PATCH v2 1/6] MdeModulePkg: DxeMmUnblockMemoryLib: Added definition and null instance Thread-Topic: [edk2-devel] [PATCH v2 1/6] MdeModulePkg: DxeMmUnblockMemoryLib: Added definition and null instance Thread-Index: AQHW/0uUyofdi3a8+UuCoenhRzNoH6pk0TcGgAA6fQCAARwymg== Date: Tue, 23 Feb 2021 19:29:54 +0000 Message-ID: References: <20210210012457.315-1-kun.q@outlook.com>, , In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: yes X-MS-TNEF-Correlator: x-incomingtopheadermarker: OriginalChecksum:2383736C0A32F13DF59C05D6ACADF4DA5267CEC3A7482632DCB780ED6273BB2B;UpperCasedChecksum:26820E871FEBBF81133707BACB4A649E9D26F3966C30BA243EDC10A9E143C47D;SizeAsReceived:7488;Count:44 x-tmn: [cPdMtVI02DT7epJcehHPFwmwp3eu+DGe] x-ms-publictraffictype: Email x-incomingheadercount: 44 x-eopattributedmessage: 0 x-ms-office365-filtering-correlation-id: 6578b1ed-02b0-40d6-30fd-08d8d83165ef x-ms-traffictypediagnostic: MW2NAM10HT088: x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: M07zH4wzNamfvxsdheraIMDck2ol+iTtknSyjzsSWFT5erhsCXu4m1hnrlICLRkSAs8RaLGJYFmFwOQKT/TQWNSNJW+FKDlJsFCwOX0X7nYvQdLuh3+nNGaLLNvrmvMsVaUtkFlXAZtveuUnUS32mIl7PzzjMmqo76Y5C2mJTehCDuYF76WXcyvvZqgckElHht4Mt2hW+mWIx+MUpphA+f7oD/7YX/V7ILQx1+hCyYqFo0s5jHibJ/qOlWRwcTVMaQVQ/WHXy8TNvpSQZABKHnhIWK13roP558wjst5SomubtYGB7KpU9xud6pbdn3Qbl2auIbasI+Mbf2g/VMB76ZHK8mIDQZTgCx5TwmtiujJrdv+V6imd/QMxSykCw01Xq8vg4DJ44AdqDClXOPBBWvJ4BtkRZpYbxlit+6PqCAW3OPdiz4snTG1JXOZ1aRHa x-ms-exchange-antispam-messagedata: qdw6MZSXEuHFWe2sW0m5xl8lBQVCiqg7jDZwOK9TpFtgbHQ7elHO0aI2ARD483amRtsAJaQrXIokbO7xJorMBWcQqSKRu+lFuR8dSGMoUPuvqBp8788B31AJO1tSo10h14wiXNl9qTSAnxpYYNwasg== x-ms-exchange-transport-forked: True MIME-Version: 1.0 X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-AuthSource: MW2NAM10FT013.eop-nam10.prod.protection.outlook.com X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: 6578b1ed-02b0-40d6-30fd-08d8d83165ef X-MS-Exchange-CrossTenant-originalarrivaltime: 23 Feb 2021 19:29:54.7183 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW2NAM10HT088 X-Groupsio-MsgNum: 72112 Content-Language: en-US Content-Type: multipart/related; boundary="_004_MWHPR06MB310291FD85EFEE7476E7A398F3809MWHPR06MB3102namp_"; type="multipart/alternative" --_004_MWHPR06MB310291FD85EFEE7476E7A398F3809MWHPR06MB3102namp_ Content-Type: multipart/alternative; boundary="_000_MWHPR06MB310291FD85EFEE7476E7A398F3809MWHPR06MB3102namp_" --_000_MWHPR06MB310291FD85EFEE7476E7A398F3809MWHPR06MB3102namp_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Hao, Thanks for the suggestion. I can move the library to MdePkg similar to Smm= MemLib and add the change for OVMF. Liming/Zhiguang, I am happy to prepare patches to cover the dependency change in ed2-platfo= rm in a separate patch series. But please let me know if you would like to = proceed otherwise. Thanks, Kun From: Wu, Hao A Sent: Monday, February 22, 2021 17:42 To: Kun Qin; devel@edk2.groups.io; Yao, Jiewen; gaoliming; Kinney, Michael D; Liu, Zhiguang Cc: Wang, Jian J; Dong, Eric; Ni, Ray Subject: Re: [edk2-devel] [PATCH v2 1/6] MdeModulePkg: DxeMmUnblockMemoryL= ib: Added definition and null instance Hello Kun, Sorry for the delayed response. Except for missing the UNI file for the newly added library, I do not have= other comment for the implementation at this moment. But I am wondering if this library can be added into the MdePkg as the cas= e for MdePkg\Library\SmmMemLib\ I have looped in Jiewen, Liming and Mike for comments. Also, since: * New library dependency for VariableSmmRuntimeDxe.inf * INF file separation and new library dependency in Tcg2Smm I think the series needs to prepare the changes for platforms under edk2 (= OVMF) and edk2-platforms repositories that consume the above 2 modules. I am not exactly sure on how this should be handled within edk2-platforms,= so I added Liming and Zhiguang here for comments. Best Regards, Hao Wu From: Kun Qin Sent: Tuesday, February 23, 2021 6:15 AM To: devel@edk2.groups.io; Wu, Hao A Cc: Wang, Jian J ; Dong, Eric = ; Ni, Ray ; Yao, Jiewen Subject: RE: [PATCH v2 1/6] MdeModulePkg: DxeMmUnblockMemoryLib: Added def= inition and null instance Hi Hao, The patch series was resent with intended usage in VariableRuntime and Tcg= 2 drivers. Could you please provide feedback on them? Any input is apprecia= ted. Regards, Kun From: Kun Qin Sent: Tuesday, February 9, 2021 17:25 To: devel@edk2.groups.io Cc: Jian J Wang; Hao A Wu; Eric Dong; Ray Ni; Jiewen Yao Subject: [PATCH v2 1/6] MdeModulePkg: DxeMmUnblockMemoryLib: Added definit= ion and null instance REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3168 This interface definition provides an abstraction layer for DXE drivers to request certain memory blocks to be mapped/unblocked for accessibility inside MM environment. Cc: Jian J Wang > Cc: Hao A Wu > Cc: Eric Dong > Cc: Ray Ni > Cc: Jiewen Yao > Signed-off-by: Kun Qin > --- Notes: v2: - Resend with practical usage. No change [Hao] MdeModulePkg/Library/DxeMmUnblockMemoryLib/DxeMmUnblockMemoryLibNull.c = | 40 ++++++++++++++++++++ MdeModulePkg/Include/Library/DxeMmUnblockMemoryLib.h = | 40 ++++++++++++++++++++ MdeModulePkg/Library/DxeMmUnblockMemoryLib/DxeMmUnblockMemoryLibNull.inf = | 29 ++++++++++++++ MdeModulePkg/MdeModulePkg.dec = | 5 +++ MdeModulePkg/MdeModulePkg.dsc = | 2 + 5 files changed, 116 insertions(+) diff --git a/MdeModulePkg/Library/DxeMmUnblockMemoryLib/DxeMmUnblockMemory= LibNull.c b/MdeModulePkg/Library/DxeMmUnblockMemoryLib/DxeMmUnblockMemoryLi= bNull.c new file mode 100644 index 000000000000..774a7e41cfb0 --- /dev/null +++ b/MdeModulePkg/Library/DxeMmUnblockMemoryLib/DxeMmUnblockMemoryLibNull= .c @@ -0,0 +1,40 @@ +/** @file + Null instance of MM Unblock Page Library. + + This library provides an abstraction layer of requesting certain page a= ccess to be unblocked + by MM environment if applicable. + + Copyright (c), Microsoft Corporation. + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include + +/** + This API provides a way to unblock certain data pages to be accessible = inside MM environment. + + @param UnblockAddress The address of buffer caller requests t= o unblock, the address + has to be page aligned. + @param NumberOfPages The number of pages requested to be unb= locked from MM + environment. + + @return EFI_SUCCESS The request goes through successfully. + @return EFI_NOT_AVAILABLE_YET The requested functionality is not prod= uced yet. + @return EFI_UNSUPPORTED The requested functionality is not supp= orted on current platform. + @return EFI_SECURITY_VIOLATION The requested address failed to pass se= curity check for + unblocking. + @return EFI_INVALID_PARAMETER Input address either NULL pointer or no= t page aligned. + @return EFI_ACCESS_DENIED The request is rejected due to system h= as passed certain boot + phase. + +**/ +EFI_STATUS +EFIAPI +DxeMmUnblockMemoryRequest ( + IN EFI_PHYSICAL_ADDRESS UnblockAddress, + IN UINT64 NumberOfPages + ) +{ + return EFI_UNSUPPORTED; +} diff --git a/MdeModulePkg/Include/Library/DxeMmUnblockMemoryLib.h b/MdeMod= ulePkg/Include/Library/DxeMmUnblockMemoryLib.h new file mode 100644 index 000000000000..8b63eb74a078 --- /dev/null +++ b/MdeModulePkg/Include/Library/DxeMmUnblockMemoryLib.h @@ -0,0 +1,40 @@ +/** @file + MM Unblock Memory Library Interface. + + This library provides an abstraction layer of requesting certain page a= ccess to be unblocked + by MM environment if applicable. + + Copyright (c), Microsoft Corporation. + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _DXE_MM_UNBLOCK_MEMORY_LIB_H_ +#define _DXE_MM_UNBLOCK_MEMORY_LIB_H_ + +/** + This API provides a way to unblock certain data pages to be accessible = inside MM environment. + + @param UnblockAddress The address of buffer caller requests t= o unblock, the address + has to be page aligned. + @param NumberOfPages The number of pages requested to be unb= locked from MM + environment. + + @return EFI_SUCCESS The request goes through successfully. + @return EFI_NOT_AVAILABLE_YET The requested functionality is not prod= uced yet. + @return EFI_UNSUPPORTED The requested functionality is not supp= orted on current platform. + @return EFI_SECURITY_VIOLATION The requested address failed to pass se= curity check for + unblocking. + @return EFI_INVALID_PARAMETER Input address either NULL pointer or no= t page aligned. + @return EFI_ACCESS_DENIED The request is rejected due to system h= as passed certain boot + phase. + +**/ +EFI_STATUS +EFIAPI +DxeMmUnblockMemoryRequest ( + IN EFI_PHYSICAL_ADDRESS UnblockAddress, + IN UINT64 NumberOfPages +); + +#endif // _DXE_MM_UNBLOCK_MEMORY_LIB_H_ diff --git a/MdeModulePkg/Library/DxeMmUnblockMemoryLib/DxeMmUnblockMemory= LibNull.inf b/MdeModulePkg/Library/DxeMmUnblockMemoryLib/DxeMmUnblockMemory= LibNull.inf new file mode 100644 index 000000000000..e40462e5ab81 --- /dev/null +++ b/MdeModulePkg/Library/DxeMmUnblockMemoryLib/DxeMmUnblockMemoryLibNull= .inf @@ -0,0 +1,29 @@ +## @file +# Null instance of MM Unblock Page Library. +# +# This library provides an abstraction layer of requesting certain page = access to be unblocked +# by MM environment if applicable. +# +# Copyright (c), Microsoft Corporation. +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +# +## + +[Defines] + INF_VERSION =3D 0x0001001B + BASE_NAME =3D DxeMmUnblockMemoryLibNull + FILE_GUID =3D 9E890F68-5C95-4C31-95DD-59E6286F85EA + MODULE_TYPE =3D BASE + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D DxeMmUnblockMemoryLib + +# +# VALID_ARCHITECTURES =3D IA32 X64 +# + +[Sources] + DxeMmUnblockMemoryLibNull.c + +[Packages] + MdePkg/MdePkg.dec diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec index 148395511034..1bb5017da2c5 100644 --- a/MdeModulePkg/MdeModulePkg.dec +++ b/MdeModulePkg/MdeModulePkg.dec @@ -154,6 +154,11 @@ [LibraryClasses] # VariablePolicyHelperLib|Include/Library/VariablePolicyHelperLib.h + ## @libraryclass This library provides an interface for DXE drivers t= o request MM environment + # to map/unblock a memory region for accessibility inside MM. + # + DxeMmUnblockMemoryLib|Include/Library/DxeMmUnblockMemoryLib.h + [Guids] ## MdeModule package token space guid # Include/Guid/MdeModulePkgTokenSpace.h diff --git a/MdeModulePkg/MdeModulePkg.dsc b/MdeModulePkg/MdeModulePkg.dsc index 7ca4a1bb3080..2bc6b8730b8b 100644 --- a/MdeModulePkg/MdeModulePkg.dsc +++ b/MdeModulePkg/MdeModulePkg.dsc @@ -100,6 +100,7 @@ [LibraryClasses] SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf DisplayUpdateProgressLib|MdeModulePkg/Library/DisplayUpdateProgressLibG= raphics/DisplayUpdateProgressLibGraphics.inf VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/Va= riablePolicyHelperLib.inf + DxeMmUnblockMemoryLib|MdeModulePkg/Library/DxeMmUnblockMemoryLib/DxeMmU= nblockMemoryLibNull.inf [LibraryClasses.EBC.PEIM] IoLib|MdePkg/Library/PeiIoLibCpuIo/PeiIoLibCpuIo.inf @@ -332,6 +333,7 @@ [Components] MdeModulePkg/Library/BaseBmpSupportLib/BaseBmpSupportLib.inf MdeModulePkg/Library/DisplayUpdateProgressLibGraphics/DisplayUpdateProg= ressLibGraphics.inf MdeModulePkg/Library/DisplayUpdateProgressLibText/DisplayUpdateProgress= LibText.inf + MdeModulePkg/Library/DxeMmUnblockMemoryLib/DxeMmUnblockMemoryLibNull.in= f MdeModulePkg/Universal/BdsDxe/BdsDxe.inf MdeModulePkg/Application/BootManagerMenuApp/BootManagerMenuApp.inf -- 2.30.0.windows.1 --_000_MWHPR06MB310291FD85EFEE7476E7A398F3809MWHPR06MB3102namp_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Hi Hao,

 

Thanks for the suggestion. I can move the library t= o MdePkg similar to SmmMemLib and add the change for OVMF.

 

Liming/Zhiguang,

 

I am happy to prepare patches to cover the dependen= cy change in ed2-platform in a separate patch series. But please let me kno= w if you would like to proceed otherwise.

 

Thanks,

Kun

 

From: Wu, Hao A
Sent: Monday, February 22, 2021 17:42
To: Kun Qin; devel@edk2.groups.io; Yao, Jie= wen; gaoliming; Kinney, Micha= el D; Liu, Zhiguang
Cc: Wang, Jian J; Dong, Eric; Ni, Ray
Subject: Re: [edk2-devel] [PATCH v2 1/6] MdeModulePkg: DxeMmUnblock= MemoryLib: Added definition and null instance

 

Hello Kun,

 

Sorry for the delayed response.

 

Except for missing the UNI file for the newly added= library, I do not have other comment for the implementation at this moment= .

But I am wondering if this library can be added int= o the MdePkg as the case for MdePkg\Library\SmmMemLib\

I have looped in Jiewen, Liming and Mike for commen= ts.

 

Also, since:

* New library dependency for VariableSmmRuntimeDxe.= inf

* INF file separation and new library dependency in= Tcg2Smm

I think the series needs to prepare the changes for= platforms under edk2 (OVMF) and edk2-platforms repositories that consume t= he above 2 modules.

I am not exactly sure on how this should be handled= within edk2-platforms, so I added Liming and Zhiguang here for comments.

 

Best Regards,

Hao Wu

 

From: Kun Qin <kun.q@outlook.com>
Sent: Tuesday, February 23, 2021 6:15 AM
To: devel@edk2.groups.io; Wu, Hao A <hao.a.wu@intel.com>
Cc: Wang, Jian J <jian.j.wang@intel.com>; Dong, Eric <eric= .dong@intel.com>; Ni, Ray <ray.ni@intel.com>; Yao, Jiewen <jiew= en.yao@intel.com>
Subject: RE: [PATCH v2 1/6] MdeModulePkg: DxeMmUnblockMemoryLib: Ad= ded definition and null instance

 

Hi Hao,

 

The patch series was resent with intended usage in = VariableRuntime and Tcg2 drivers. Could you please provide feedback on them= ? Any input is appreciated.

 

Regards,

Kun

 

From: K= un Qin
Sent: Tuesday, February 9, 2021 17:25
To: devel@edk2.groups.io
Cc:
Jian J Wang; Hao A Wu; Eric Dong; Ray Ni; Jiewen Yao
Subject: [PATCH v2 1/6] MdeModulePkg: DxeMmUnblockMemoryLib: Added = definition and null instance

 

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3168

This interface definition provides an abstraction layer for DXE drivers to request certain memory blocks to be mapped/unblocked for accessibility<= br> inside MM environment.

Cc: Jian J Wang <jian.j.wang@i= ntel.com>
Cc: Hao A Wu <hao.a.wu@intel.com<= /a>>
Cc: Eric Dong <
eric.dong@intel.c= om>
Cc: Ray Ni <ray.ni@intel.com>= ;
Cc: Jiewen Yao <jiewen.yao@inte= l.com>

Signed-off-by: Kun Qin <kun.q@outl= ook.com>
---

Notes:
    v2:
    - Resend with practical usage. No change [Hao]

 MdeModulePkg/Library/DxeMmUnblockMemoryLib/DxeMmUnblockMemoryLibNull= .c   | 40 ++++++++++++++++++++
 MdeModulePkg/Include/Library/DxeMmUnblockMemoryLib.h  &nbs= p;            &= nbsp;     | 40 ++++++++++++++++++++
 MdeModulePkg/Library/DxeMmUnblockMemoryLib/DxeMmUnblockMemoryLibNull= .inf | 29 ++++++++++++++
 MdeModulePkg/MdeModulePkg.dec      &nb= sp;            =             &nb= sp;            |&nbs= p; 5 +++
 MdeModulePkg/MdeModulePkg.dsc      &nb= sp;            =             &nb= sp;            |&nbs= p; 2 +
 5 files changed, 116 insertions(+)

diff --git a/MdeModulePkg/Library/DxeMmUnblockMemoryLib/DxeMmUnblockMemory= LibNull.c b/MdeModulePkg/Library/DxeMmUnblockMemoryLib/DxeMmUnblockMemoryLi= bNull.c
new file mode 100644
index 000000000000..774a7e41cfb0
--- /dev/null
+++ b/MdeModulePkg/Library/DxeMmUnblockMemoryLib/DxeMmUnblockMemoryLibNull= .c
@@ -0,0 +1,40 @@
+/** @file
+  Null instance of MM Unblock Page Library.
+
+  This library provides an abstraction layer of requesting certain p= age access to be unblocked
+  by MM environment if applicable.
+
+  Copyright (c), Microsoft Corporation.
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Uefi.h>
+
+/**
+  This API provides a way to unblock certain data pages to be access= ible inside MM environment.
+
+  @param  UnblockAddress      &nb= sp;   The address of buffer caller requests to unblock, the addre= ss
+            &= nbsp;           &nbs= p;         has to be page aligned.<= br> +  @param  NumberOfPages      &nbs= p;    The number of pages requested to be unblocked from MM<= br> +            &= nbsp;           &nbs= p;         environment.
+
+  @return EFI_SUCCESS        = ;     The request goes through successfully.
+  @return EFI_NOT_AVAILABLE_YET   The requested functional= ity is not produced yet.
+  @return EFI_UNSUPPORTED       &= nbsp; The requested functionality is not supported on current platform.
+  @return EFI_SECURITY_VIOLATION  The requested address failed = to pass security check for
+            &= nbsp;           &nbs= p;         unblocking.
+  @return EFI_INVALID_PARAMETER   Input address either NUL= L pointer or not page aligned.
+  @return EFI_ACCESS_DENIED       The = request is rejected due to system has passed certain boot
+            &= nbsp;           &nbs= p;         phase.
+
+**/
+EFI_STATUS
+EFIAPI
+DxeMmUnblockMemoryRequest (
+  IN EFI_PHYSICAL_ADDRESS   UnblockAddress,
+  IN UINT64         &nb= sp;       NumberOfPages
+  )
+{
+  return EFI_UNSUPPORTED;
+}
diff --git a/MdeModulePkg/Include/Library/DxeMmUnblockMemoryLib.h b/MdeMod= ulePkg/Include/Library/DxeMmUnblockMemoryLib.h
new file mode 100644
index 000000000000..8b63eb74a078
--- /dev/null
+++ b/MdeModulePkg/Include/Library/DxeMmUnblockMemoryLib.h
@@ -0,0 +1,40 @@
+/** @file
+  MM Unblock Memory Library Interface.
+
+  This library provides an abstraction layer of requesting certain p= age access to be unblocked
+  by MM environment if applicable.
+
+  Copyright (c), Microsoft Corporation.
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef _DXE_MM_UNBLOCK_MEMORY_LIB_H_
+#define _DXE_MM_UNBLOCK_MEMORY_LIB_H_
+
+/**
+  This API provides a way to unblock certain data pages to be access= ible inside MM environment.
+
+  @param  UnblockAddress      &nb= sp;   The address of buffer caller requests to unblock, the addre= ss
+            &= nbsp;           &nbs= p;         has to be page aligned.<= br> +  @param  NumberOfPages      &nbs= p;    The number of pages requested to be unblocked from MM<= br> +            &= nbsp;           &nbs= p;         environment.
+
+  @return EFI_SUCCESS        = ;     The request goes through successfully.
+  @return EFI_NOT_AVAILABLE_YET   The requested functional= ity is not produced yet.
+  @return EFI_UNSUPPORTED       &= nbsp; The requested functionality is not supported on current platform.
+  @return EFI_SECURITY_VIOLATION  The requested address failed = to pass security check for
+            &= nbsp;           &nbs= p;         unblocking.
+  @return EFI_INVALID_PARAMETER   Input address either NUL= L pointer or not page aligned.
+  @return EFI_ACCESS_DENIED       The = request is rejected due to system has passed certain boot
+            &= nbsp;           &nbs= p;         phase.
+
+**/
+EFI_STATUS
+EFIAPI
+DxeMmUnblockMemoryRequest (
+  IN EFI_PHYSICAL_ADDRESS   UnblockAddress,
+  IN UINT64         &nb= sp;       NumberOfPages
+);
+
+#endif // _DXE_MM_UNBLOCK_MEMORY_LIB_H_
diff --git a/MdeModulePkg/Library/DxeMmUnblockMemoryLib/DxeMmUnblockMemory= LibNull.inf b/MdeModulePkg/Library/DxeMmUnblockMemoryLib/DxeMmUnblockMemory= LibNull.inf
new file mode 100644
index 000000000000..e40462e5ab81
--- /dev/null
+++ b/MdeModulePkg/Library/DxeMmUnblockMemoryLib/DxeMmUnblockMemoryLibNull= .inf
@@ -0,0 +1,29 @@
+## @file
+#  Null instance of MM Unblock Page Library.
+#
+#  This library provides an abstraction layer of requesting certain = page access to be unblocked
+#  by MM environment if applicable.
+#
+#  Copyright (c), Microsoft Corporation.
+#  SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+#
+##
+
+[Defines]
+  INF_VERSION         &= nbsp;          =3D 0x0001001B<= br> +  BASE_NAME         &nb= sp;            =3D D= xeMmUnblockMemoryLibNull
+  FILE_GUID         &nb= sp;            =3D 9= E890F68-5C95-4C31-95DD-59E6286F85EA
+  MODULE_TYPE         &= nbsp;          =3D BASE
+  VERSION_STRING        &nbs= p;        =3D 1.0
+  LIBRARY_CLASS         = ;         =3D DxeMmUnblockMemoryLib=
+
+#
+#  VALID_ARCHITECTURES       &nbs= p;   =3D IA32 X64
+#
+
+[Sources]
+  DxeMmUnblockMemoryLibNull.c
+
+[Packages]
+  MdePkg/MdePkg.dec
diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec=
index 148395511034..1bb5017da2c5 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -154,6 +154,11 @@ [LibraryClasses]
   #
   VariablePolicyHelperLib|Include/Library/VariablePolicyHelperL= ib.h
 
+  ##  @libraryclass  This library provides an interface fo= r DXE drivers to request MM environment
+  #   to map/unblock a memory region for accessibility ins= ide MM.
+  #
+  DxeMmUnblockMemoryLib|Include/Library/DxeMmUnblockMemoryLib.h
+
 [Guids]
   ## MdeModule package token space guid
   # Include/Guid/MdeModulePkgTokenSpace.h
diff --git a/MdeModulePkg/MdeModulePkg.dsc b/MdeModulePkg/MdeModulePkg.dsc=
index 7ca4a1bb3080..2bc6b8730b8b 100644
--- a/MdeModulePkg/MdeModulePkg.dsc
+++ b/MdeModulePkg/MdeModulePkg.dsc
@@ -100,6 +100,7 @@ [LibraryClasses]
   SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf    DisplayUpdateProgressLib|MdeModulePkg/Library/DisplayUpdatePr= ogressLibGraphics/DisplayUpdateProgressLibGraphics.inf
   VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHe= lperLib/VariablePolicyHelperLib.inf
+  DxeMmUnblockMemoryLib|MdeModulePkg/Library/DxeMmUnblockMemoryLib/D= xeMmUnblockMemoryLibNull.inf
 
 [LibraryClasses.EBC.PEIM]
   IoLib|MdePkg/Library/PeiIoLibCpuIo/PeiIoLibCpuIo.inf
@@ -332,6 +333,7 @@ [Components]
   MdeModulePkg/Library/BaseBmpSupportLib/BaseBmpSupportLib.inf<= br>    MdeModulePkg/Library/DisplayUpdateProgressLibGraphics/Display= UpdateProgressLibGraphics.inf
   MdeModulePkg/Library/DisplayUpdateProgressLibText/DisplayUpda= teProgressLibText.inf
+  MdeModulePkg/Library/DxeMmUnblockMemoryLib/DxeMmUnblockMemoryLibNu= ll.inf
 
   MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
   MdeModulePkg/Application/BootManagerMenuApp/BootManagerMenuAp= p.inf
--
2.30.0.windows.1

 

 

--_000_MWHPR06MB310291FD85EFEE7476E7A398F3809MWHPR06MB3102namp_-- --_004_MWHPR06MB310291FD85EFEE7476E7A398F3809MWHPR06MB3102namp_ Content-Type: image/png; name="A7D8DE2525F24891BA4F7A49EB617192.png" Content-Description: A7D8DE2525F24891BA4F7A49EB617192.png Content-Disposition: inline; filename="A7D8DE2525F24891BA4F7A49EB617192.png"; size=140; creation-date="Tue, 23 Feb 2021 19:29:53 GMT"; modification-date="Tue, 23 Feb 2021 19:29:53 GMT" Content-ID: Content-Transfer-Encoding: base64 iVBORw0KGgoAAAANSUhEUgAAAsQAAAABCAYAAADZ77itAAAAAXNSR0IArs4c6QAAAARnQU1BAACx jwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAhSURBVEhL7cMBDQAACAMg+5cygQkeRoMIG9WT VVXVn7MHYi5moJeByLMAAAAASUVORK5CYII= --_004_MWHPR06MB310291FD85EFEE7476E7A398F3809MWHPR06MB3102namp_--