summaryrefslogtreecommitdiffstats
path: root/MdePkg
diff options
context:
space:
mode:
Diffstat (limited to 'MdePkg')
-rw-r--r--MdePkg/Include/Library/MmUnblockMemoryLib.h44
-rw-r--r--MdePkg/Library/MmUnblockMemoryLib/MmUnblockMemoryLibNull.c44
-rw-r--r--MdePkg/Library/MmUnblockMemoryLib/MmUnblockMemoryLibNull.inf34
-rw-r--r--MdePkg/Library/MmUnblockMemoryLib/MmUnblockMemoryLibNull.uni21
-rw-r--r--MdePkg/MdePkg.dec5
-rw-r--r--MdePkg/MdePkg.dsc1
6 files changed, 149 insertions, 0 deletions
diff --git a/MdePkg/Include/Library/MmUnblockMemoryLib.h b/MdePkg/Include/Library/MmUnblockMemoryLib.h
new file mode 100644
index 0000000000..00fab530a3
--- /dev/null
+++ b/MdePkg/Include/Library/MmUnblockMemoryLib.h
@@ -0,0 +1,44 @@
+/** @file
+ MM Unblock Memory Library Interface.
+
+ This library provides an interface to request non-MMRAM pages to be mapped/unblocked
+ from inside MM environment.
+
+ For MM modules that need to access regions outside of MMRAMs, the agents that set up
+ these regions are responsible for invoking this API in order for these memory areas
+ to be accessed from inside MM.
+
+ Copyright (c) Microsoft Corporation.
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef MM_UNBLOCK_MEMORY_LIB_H_
+#define 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.
+
+ @retval RETURN_SUCCESS The request goes through successfully.
+ @retval RETURN_NOT_AVAILABLE_YET The requested functionality is not produced yet.
+ @retval RETURN_UNSUPPORTED The requested functionality is not supported on current platform.
+ @retval RETURN_SECURITY_VIOLATION The requested address failed to pass security check for
+ unblocking.
+ @retval RETURN_INVALID_PARAMETER Input address either NULL pointer or not page aligned.
+ @retval RETURN_ACCESS_DENIED The request is rejected due to system has passed certain boot
+ phase.
+
+**/
+RETURN_STATUS
+EFIAPI
+MmUnblockMemoryRequest (
+ IN PHYSICAL_ADDRESS UnblockAddress,
+ IN UINT64 NumberOfPages
+);
+
+#endif // MM_UNBLOCK_MEMORY_LIB_H_
diff --git a/MdePkg/Library/MmUnblockMemoryLib/MmUnblockMemoryLibNull.c b/MdePkg/Library/MmUnblockMemoryLib/MmUnblockMemoryLibNull.c
new file mode 100644
index 0000000000..b205c9122d
--- /dev/null
+++ b/MdePkg/Library/MmUnblockMemoryLib/MmUnblockMemoryLibNull.c
@@ -0,0 +1,44 @@
+/** @file
+ Null instance of MM Unblock Page Library.
+
+ This library provides an interface to request non-MMRAM pages to be mapped/unblocked
+ from inside MM environment.
+
+ For MM modules that need to access regions outside of MMRAMs, the agents that set up
+ these regions are responsible for invoking this API in order for these memory areas
+ to be accessed from inside MM.
+
+ Copyright (c) Microsoft Corporation.
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Base.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.
+
+ @retval RETURN_SUCCESS The request goes through successfully.
+ @retval RETURN_NOT_AVAILABLE_YET The requested functionality is not produced yet.
+ @retval RETURN_UNSUPPORTED The requested functionality is not supported on current platform.
+ @retval RETURN_SECURITY_VIOLATION The requested address failed to pass security check for
+ unblocking.
+ @retval RETURN_INVALID_PARAMETER Input address either NULL pointer or not page aligned.
+ @retval RETURN_ACCESS_DENIED The request is rejected due to system has passed certain boot
+ phase.
+
+**/
+RETURN_STATUS
+EFIAPI
+MmUnblockMemoryRequest (
+ IN PHYSICAL_ADDRESS UnblockAddress,
+ IN UINT64 NumberOfPages
+ )
+{
+ return RETURN_UNSUPPORTED;
+}
diff --git a/MdePkg/Library/MmUnblockMemoryLib/MmUnblockMemoryLibNull.inf b/MdePkg/Library/MmUnblockMemoryLib/MmUnblockMemoryLibNull.inf
new file mode 100644
index 0000000000..8ecb767ff7
--- /dev/null
+++ b/MdePkg/Library/MmUnblockMemoryLib/MmUnblockMemoryLibNull.inf
@@ -0,0 +1,34 @@
+## @file
+# Null instance of MM Unblock Page Library.
+#
+# This library provides an interface to request non-MMRAM pages to be mapped/unblocked
+# from inside MM environment.
+#
+# For MM modules that need to access regions outside of MMRAMs, the agents that set up
+# these regions are responsible for invoking this API in order for these memory areas
+# to be accessed from inside MM.
+#
+# Copyright (c) Microsoft Corporation.
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+#
+##
+
+[Defines]
+ INF_VERSION = 0x0001001B
+ BASE_NAME = MmUnblockMemoryLibNull
+ MODULE_UNI_FILE = MmUnblockMemoryLibNull.uni
+ FILE_GUID = 9E890F68-5C95-4C31-95DD-59E6286F85EA
+ MODULE_TYPE = BASE
+ VERSION_STRING = 1.0
+ LIBRARY_CLASS = MmUnblockMemoryLib
+
+#
+# VALID_ARCHITECTURES = IA32 X64
+#
+
+[Sources]
+ MmUnblockMemoryLibNull.c
+
+[Packages]
+ MdePkg/MdePkg.dec
diff --git a/MdePkg/Library/MmUnblockMemoryLib/MmUnblockMemoryLibNull.uni b/MdePkg/Library/MmUnblockMemoryLib/MmUnblockMemoryLibNull.uni
new file mode 100644
index 0000000000..d7f2709a3d
--- /dev/null
+++ b/MdePkg/Library/MmUnblockMemoryLib/MmUnblockMemoryLibNull.uni
@@ -0,0 +1,21 @@
+// /** @file
+// Null instance of MM Unblock Page Library.
+//
+// This library provides an interface to request non-MMRAM pages to be mapped/unblocked
+// from inside MM environment.
+//
+// For MM modules that need to access regions outside of MMRAMs, the agents that set up
+// these regions are responsible for invoking this API in order for these memory areas
+// to be accessed from inside MM.
+//
+// Copyright (c) Microsoft Corporation.
+// SPDX-License-Identifier: BSD-2-Clause-Patent
+//
+// **/
+
+
+#string STR_MODULE_ABSTRACT #language en-US "Null instance of MM Unblock Page Library."
+
+#string STR_MODULE_DESCRIPTION #language en-US "This library provides an interface to request non-MMRAM pages to be mapped/unblocked from inside MM environment.\n"
+ "For MM modules that need to access regions outside of MMRAMs, the agents that set up these regions are responsible for invoking this API in order for these memory areas to be accessed from inside MM."
+
diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec
index 3928db65d1..1d2637acc2 100644
--- a/MdePkg/MdePkg.dec
+++ b/MdePkg/MdePkg.dec
@@ -257,6 +257,11 @@
#
UnitTestHostBaseLib|Test/UnitTest/Include/Library/UnitTestHostBaseLib.h
+ ## @libraryclass This library provides an interface to request non-MMRAM pages to be mapped
+ # or unblocked from inside MM environment.
+ #
+ MmUnblockMemoryLib|Include/Library/MmUnblockMemoryLib.h
+
[LibraryClasses.IA32, LibraryClasses.X64]
## @libraryclass Abstracts both S/W SMI generation and detection.
##
diff --git a/MdePkg/MdePkg.dsc b/MdePkg/MdePkg.dsc
index ce00908681..79629e3f93 100644
--- a/MdePkg/MdePkg.dsc
+++ b/MdePkg/MdePkg.dsc
@@ -168,6 +168,7 @@
MdePkg/Library/SmmPciExpressLib/SmmPciExpressLib.inf
MdePkg/Library/SmiHandlerProfileLibNull/SmiHandlerProfileLibNull.inf
MdePkg/Library/MmServicesTableLib/MmServicesTableLib.inf
+ MdePkg/Library/MmUnblockMemoryLib/MmUnblockMemoryLibNull.inf
[Components.EBC]
MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf