From: "Kun Qin" <kun.q@outlook.com>
To: devel@edk2.groups.io
Cc: Jian J Wang <jian.j.wang@intel.com>,
Hao A Wu <hao.a.wu@intel.com>, Eric Dong <eric.dong@intel.com>,
Ray Ni <ray.ni@intel.com>, Jiewen Yao <jiewen.yao@intel.com>
Subject: [PATCH v2 1/6] MdeModulePkg: DxeMmUnblockMemoryLib: Added definition and null instance
Date: Tue, 9 Feb 2021 17:24:52 -0800 [thread overview]
Message-ID: <MWHPR06MB3102C58C6FAD076E6DFB60C3F38D9@MWHPR06MB3102.namprd06.prod.outlook.com> (raw)
In-Reply-To: <20210210012457.315-1-kun.q@outlook.com>
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3168
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 <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Signed-off-by: Kun Qin <kun.q@outlook.com>
---
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/DxeMmUnblockMemoryLibNull.c b/MdeModulePkg/Library/DxeMmUnblockMemoryLib/DxeMmUnblockMemoryLibNull.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 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 accessible inside MM environment.
+
+ @param UnblockAddress The address of buffer caller requests to unblock, the address
+ has to be page aligned.
+ @param NumberOfPages The number of pages requested to be unblocked from MM
+ environment.
+
+ @return EFI_SUCCESS The request goes through successfully.
+ @return EFI_NOT_AVAILABLE_YET The requested functionality is not produced yet.
+ @return EFI_UNSUPPORTED The requested functionality is not supported on current platform.
+ @return EFI_SECURITY_VIOLATION The requested address failed to pass security check for
+ unblocking.
+ @return EFI_INVALID_PARAMETER Input address either NULL pointer or not page aligned.
+ @return EFI_ACCESS_DENIED The request is rejected due to system has 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/MdeModulePkg/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 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 accessible inside MM environment.
+
+ @param UnblockAddress The address of buffer caller requests to unblock, the address
+ has to be page aligned.
+ @param NumberOfPages The number of pages requested to be unblocked from MM
+ environment.
+
+ @return EFI_SUCCESS The request goes through successfully.
+ @return EFI_NOT_AVAILABLE_YET The requested functionality is not produced yet.
+ @return EFI_UNSUPPORTED The requested functionality is not supported on current platform.
+ @return EFI_SECURITY_VIOLATION The requested address failed to pass security check for
+ unblocking.
+ @return EFI_INVALID_PARAMETER Input address either NULL pointer or not page aligned.
+ @return EFI_ACCESS_DENIED The request is rejected due to system has 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/DxeMmUnblockMemoryLibNull.inf b/MdeModulePkg/Library/DxeMmUnblockMemoryLib/DxeMmUnblockMemoryLibNull.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 = 0x0001001B
+ BASE_NAME = DxeMmUnblockMemoryLibNull
+ FILE_GUID = 9E890F68-5C95-4C31-95DD-59E6286F85EA
+ MODULE_TYPE = BASE
+ VERSION_STRING = 1.0
+ LIBRARY_CLASS = DxeMmUnblockMemoryLib
+
+#
+# VALID_ARCHITECTURES = 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 to 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/DisplayUpdateProgressLibGraphics/DisplayUpdateProgressLibGraphics.inf
VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
+ DxeMmUnblockMemoryLib|MdeModulePkg/Library/DxeMmUnblockMemoryLib/DxeMmUnblockMemoryLibNull.inf
[LibraryClasses.EBC.PEIM]
IoLib|MdePkg/Library/PeiIoLibCpuIo/PeiIoLibCpuIo.inf
@@ -332,6 +333,7 @@ [Components]
MdeModulePkg/Library/BaseBmpSupportLib/BaseBmpSupportLib.inf
MdeModulePkg/Library/DisplayUpdateProgressLibGraphics/DisplayUpdateProgressLibGraphics.inf
MdeModulePkg/Library/DisplayUpdateProgressLibText/DisplayUpdateProgressLibText.inf
+ MdeModulePkg/Library/DxeMmUnblockMemoryLib/DxeMmUnblockMemoryLibNull.inf
MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
MdeModulePkg/Application/BootManagerMenuApp/BootManagerMenuApp.inf
--
2.30.0.windows.1
next parent reply other threads:[~2021-02-10 1:25 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20210210012457.315-1-kun.q@outlook.com>
2021-02-10 1:24 ` Kun Qin [this message]
2021-02-22 22:15 ` [PATCH v2 1/6] MdeModulePkg: DxeMmUnblockMemoryLib: Added definition and null instance Kun Qin
2021-02-23 1:42 ` Wu, Hao A
2021-02-23 19:29 ` [edk2-devel] " Kun Qin
2021-02-24 1:27 ` Wu, Hao A
2021-02-24 1:33 ` Yao, Jiewen
2021-02-24 1:48 ` Kun Qin
2021-02-25 14:03 ` 回复: " gaoliming
2021-02-25 18:57 ` Kun Qin
[not found] ` <16668BE524C457EA.19172@groups.io>
2021-02-25 1:53 ` Kun Qin
2021-02-25 2:06 ` Yao, Jiewen
2021-02-25 2:20 ` Kun Qin
2021-02-10 1:24 ` [PATCH v2 2/6] MdeModulePkg: VariableSmmRuntimeDxe: Added request unblock memory interface Kun Qin
2021-02-10 1:24 ` [PATCH v2 3/6] SecurityPkg: Tcg2Smm: Switching from gSmst to gMmst Kun Qin
2021-02-24 1:20 ` Yao, Jiewen
2021-02-10 1:24 ` [PATCH v2 4/6] SecurityPkg: Tcg2Smm: Separate Tcg2Smm into 2 modules Kun Qin
2021-02-22 22:33 ` Kun Qin
2021-02-24 1:20 ` Yao, Jiewen
2021-02-10 1:24 ` [PATCH v2 5/6] SecurityPkg: Tcg2Smm: Added support for Standalone Mm Kun Qin
2021-02-24 1:26 ` Yao, Jiewen
2021-02-24 1:40 ` [edk2-devel] " Kun Qin
[not found] ` <16668B740798D6CC.26818@groups.io>
2021-02-25 2:26 ` Kun Qin
2021-03-01 8:28 ` Yao, Jiewen
2021-03-01 8:57 ` Kun Qin
2021-03-01 9:27 ` Yao, Jiewen
2021-03-01 9:45 ` Kun Qin
2021-02-10 1:24 ` [PATCH v2 6/6] SecurityPkg: Tcg2Acpi: Added unblock memory interface for NVS region Kun Qin
2021-02-24 1:24 ` Yao, Jiewen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=MWHPR06MB3102C58C6FAD076E6DFB60C3F38D9@MWHPR06MB3102.namprd06.prod.outlook.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox