diff --git a/MdeModulePkg/Core/Dxe/DxeMain.h b/MdeModulePkg/Core/Dxe/DxeMain.h
index c12f40b738..2219b0e678 100644
--- a/MdeModulePkg/Core/Dxe/DxeMain.h
+++ b/MdeModulePkg/Core/Dxe/DxeMain.h
@@ -2388,52 +2388,6 @@ ProduceFVBProtocolOnBuffer (
OUT EFI_HANDLE *FvProtocol OPTIONAL
);
-/**
- Raising to the task priority level of the mutual exclusion
- lock, and then acquires ownership of the lock.
-
- @param Lock The lock to acquire
-
- @return Lock owned
-
-**/
-VOID
-CoreAcquireLock (
- IN EFI_LOCK *Lock
- );
-
-/**
- Initialize a basic mutual exclusion lock. Each lock
- provides mutual exclusion access at it's task priority
- level. Since there is no-premption (at any TPL) or
- multiprocessor support, acquiring the lock only consists
- of raising to the locks TPL.
-
- @param Lock The EFI_LOCK structure to initialize
-
- @retval EFI_SUCCESS Lock Owned.
- @retval EFI_ACCESS_DENIED Reentrant Lock Acquisition, Lock not Owned.
-
-**/
-EFI_STATUS
-CoreAcquireLockOrFail (
- IN EFI_LOCK *Lock
- );
-
-/**
- Releases ownership of the mutual exclusion lock, and
- restores the previous task priority level.
-
- @param Lock The lock to release
-
- @return Lock unowned
-
-**/
-VOID
-CoreReleaseLock (
- IN EFI_LOCK *Lock
- );
-
/**
Read data from Firmware Block by FVB protocol Read.
The data may cross the multi block ranges.
diff --git a/MdeModulePkg/Core/Dxe/DxeMain.inf b/MdeModulePkg/Core/Dxe/DxeMain.inf
index c475c4f49b..c6f028e613 100644
--- a/MdeModulePkg/Core/Dxe/DxeMain.inf
+++ b/MdeModulePkg/Core/Dxe/DxeMain.inf
@@ -36,7 +36,6 @@
Misc/InstallConfigurationTable.c
Misc/MemoryAttributesTable.c
Misc/MemoryProtection.c
- Library/Library.c
Hand/DriverSupport.c
Hand/Notify.c
Hand/Locate.c
diff --git a/MdeModulePkg/Core/Dxe/Library/Library.c b/MdeModulePkg/Core/Dxe/Library/Library.c
deleted file mode 100644
index 63cef1daca..0000000000
--- a/MdeModulePkg/Core/Dxe/Library/Library.c
+++ /dev/null
@@ -1,94 +0,0 @@
-/** @file
- DXE Core library services.
-
-Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include "DxeMain.h"
-
-//
-// Lock Stuff
-//
-
-/**
- Initialize a basic mutual exclusion lock. Each lock
- provides mutual exclusion access at it's task priority
- level. Since there is no-premption (at any TPL) or
- multiprocessor support, acquiring the lock only consists
- of raising to the locks TPL.
-
- @param Lock The EFI_LOCK structure to initialize
-
- @retval EFI_SUCCESS Lock Owned.
- @retval EFI_ACCESS_DENIED Reentrant Lock Acquisition, Lock not Owned.
-
-**/
-EFI_STATUS
-CoreAcquireLockOrFail (
- IN EFI_LOCK *Lock
- )
-{
- ASSERT (Lock != NULL);
- ASSERT (Lock->Lock != EfiLockUninitialized);
-
- if (Lock->Lock == EfiLockAcquired) {
- //
- // Lock is already owned, so bail out
- //
- return EFI_ACCESS_DENIED;
- }
-
- Lock->OwnerTpl = CoreRaiseTpl (Lock->Tpl);
-
- Lock->Lock = EfiLockAcquired;
- return EFI_SUCCESS;
-}
-
-/**
- Raising to the task priority level of the mutual exclusion
- lock, and then acquires ownership of the lock.
-
- @param Lock The lock to acquire
-
- @return Lock owned
-
-**/
-VOID
-CoreAcquireLock (
- IN EFI_LOCK *Lock
- )
-{
- ASSERT (Lock != NULL);
- ASSERT (Lock->Lock == EfiLockReleased);
-
- Lock->OwnerTpl = CoreRaiseTpl (Lock->Tpl);
- Lock->Lock = EfiLockAcquired;
-}
-
-/**
- Releases ownership of the mutual exclusion lock, and
- restores the previous task priority level.
-
- @param Lock The lock to release
-
- @return Lock unowned
-
-**/
-VOID
-CoreReleaseLock (
- IN EFI_LOCK *Lock
- )
-{
- EFI_TPL Tpl;
-
- ASSERT (Lock != NULL);
- ASSERT (Lock->Lock == EfiLockAcquired);
-
- Tpl = Lock->OwnerTpl;
-
- Lock->Lock = EfiLockReleased;
-
- CoreRestoreTpl (Tpl);
-}
diff --git a/MdeModulePkg/Core/Dxe/Mem/HeapGuard.c b/MdeModulePkg/Core/Dxe/Mem/HeapGuard.c
index aea858d127..8d173026f3 100644
--- a/MdeModulePkg/Core/Dxe/Mem/HeapGuard.c
+++ b/MdeModulePkg/Core/Dxe/Mem/HeapGuard.c
@@ -572,27 +572,6 @@ UnsetGuardPage (
mOnGuarding = FALSE;
}
-/**
- Check to see if the pool at the given address should be guarded or not.
-
- @param[in] MemoryType Pool type to check.
-
-
- @return TRUE The given type of pool should be guarded.
- @return FALSE The given type of pool should not be guarded.
-**/
-BOOLEAN
-IsPoolTypeToGuard (
- IN EFI_MEMORY_TYPE MemoryType
- )
-{
- return IsMemoryTypeToGuard (
- MemoryType,
- AllocateAnyPages,
- GUARD_HEAP_TYPE_POOL
- );
-}
-
/**
Check to see if the page at the given address should be guarded or not.
diff --git a/MdeModulePkg/Core/Dxe/Mem/HeapGuard.h b/MdeModulePkg/Core/Dxe/Mem/HeapGuard.h
index a4a5088b65..7289549ee8 100644
--- a/MdeModulePkg/Core/Dxe/Mem/HeapGuard.h
+++ b/MdeModulePkg/Core/Dxe/Mem/HeapGuard.h
@@ -281,20 +281,6 @@ AdjustMemoryS (
IN UINT64 SizeRequested
);
-/**
- Check to see if the pool at the given address should be guarded or not.
-
- @param[in] MemoryType Pool type to check.
-
-
- @return TRUE The given type of pool should be guarded.
- @return FALSE The given type of pool should not be guarded.
-**/
-BOOLEAN
-IsPoolTypeToGuard (
- IN EFI_MEMORY_TYPE MemoryType
- );
-
/**
Check to see if the page at the given address should be guarded or not.
diff --git a/MdeModulePkg/Include/Library/MemoryPoolLib.h b/MdeModulePkg/Include/Library/MemoryPoolLib.h
index a285040287..ff1da3cca8 100644
--- a/MdeModulePkg/Include/Library/MemoryPoolLib.h
+++ b/MdeModulePkg/Include/Library/MemoryPoolLib.h
@@ -9,6 +9,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#ifndef _MEMORY_POOL_LIB_H_
#define _MEMORY_POOL_LIB_H_
+#include
+
//
// +---------------------------------------------------+
// | 0..(EfiMaxMemoryType - 1) - Normal memory type |
@@ -164,6 +166,20 @@ IsHeapGuardEnabled (
UINT8 GuardType
);
+/**
+ Check to see if the pool at the given address should be guarded or not.
+
+ @param[in] MemoryType Pool type to check.
+
+
+ @return TRUE The given type of pool should be guarded.
+ @return FALSE The given type of pool should not be guarded.
+**/
+BOOLEAN
+IsPoolTypeToGuard (
+ IN EFI_MEMORY_TYPE MemoryType
+ );
+
/**
Check to see if the memory at the given address should be guarded or not.
@@ -182,4 +198,50 @@ IsMemoryTypeToGuard (
IN UINT8 PageOrPool
);
+/**
+ Raising to the task priority level of the mutual exclusion
+ lock, and then acquires ownership of the lock.
+
+ @param Lock The lock to acquire
+
+ @return Lock owned
+
+**/
+VOID
+CoreAcquireLock (
+ IN EFI_LOCK *Lock
+ );
+
+/**
+ Initialize a basic mutual exclusion lock. Each lock
+ provides mutual exclusion access at it's task priority
+ level. Since there is no-premption (at any TPL) or
+ multiprocessor support, acquiring the lock only consists
+ of raising to the locks TPL.
+
+ @param Lock The EFI_LOCK structure to initialize
+
+ @retval EFI_SUCCESS Lock Owned.
+ @retval EFI_ACCESS_DENIED Reentrant Lock Acquisition, Lock not Owned.
+
+**/
+EFI_STATUS
+CoreAcquireLockOrFail (
+ IN EFI_LOCK *Lock
+ );
+
+/**
+ Releases ownership of the mutual exclusion lock, and
+ restores the previous task priority level.
+
+ @param Lock The lock to release
+
+ @return Lock unowned
+
+**/
+VOID
+CoreReleaseLock (
+ IN EFI_LOCK *Lock
+ );
+
#endif
diff --git a/MdeModulePkg/Library/MemoryPoolLib/InternalPool.c b/MdeModulePkg/Library/MemoryPoolLib/InternalPool.c
index 734f397c91..5e506e080b 100644
--- a/MdeModulePkg/Library/MemoryPoolLib/InternalPool.c
+++ b/MdeModulePkg/Library/MemoryPoolLib/InternalPool.c
@@ -7,3 +7,59 @@
**/
#include
+#include
+
+/**
+ Initialize a basic mutual exclusion lock. Each lock
+ provides mutual exclusion access at it's task priority
+ level. Since there is no-premption (at any TPL) or
+ multiprocessor support, acquiring the lock only consists
+ of raising to the locks TPL.
+
+ @param Lock The EFI_LOCK structure to initialize
+
+ @retval EFI_SUCCESS Lock Owned.
+ @retval EFI_ACCESS_DENIED Reentrant Lock Acquisition, Lock not Owned.
+
+**/
+EFI_STATUS
+CoreAcquireLockOrFail (
+ IN EFI_LOCK *Lock
+ )
+{
+ return EfiAcquireLockOrFail (Lock);
+}
+
+/**
+ Raising to the task priority level of the mutual exclusion
+ lock, and then acquires ownership of the lock.
+
+ @param Lock The lock to acquire
+
+ @return Lock owned
+
+**/
+VOID
+CoreAcquireLock (
+ IN EFI_LOCK *Lock
+ )
+{
+ EfiAcquireLock (Lock);
+}
+
+/**
+ Releases ownership of the mutual exclusion lock, and
+ restores the previous task priority level.
+
+ @param Lock The lock to release
+
+ @return Lock unowned
+
+**/
+VOID
+CoreReleaseLock (
+ IN EFI_LOCK *Lock
+ )
+{
+ EfiReleaseLock (Lock);
+}
diff --git a/MdeModulePkg/Library/MemoryPoolLib/InternalPool.h b/MdeModulePkg/Library/MemoryPoolLib/InternalPool.h
index 9a62050831..a8dfc1b5ce 100644
--- a/MdeModulePkg/Library/MemoryPoolLib/InternalPool.h
+++ b/MdeModulePkg/Library/MemoryPoolLib/InternalPool.h
@@ -11,52 +11,6 @@
extern BOOLEAN mOnGuarding;
-/**
- Check to see if the pool at the given address should be guarded or not.
-
- @param[in] MemoryType Pool type to check.
-
-
- @return TRUE The given type of pool should be guarded.
- @return FALSE The given type of pool should not be guarded.
-**/
-BOOLEAN
-IsPoolTypeToGuard (
- IN EFI_MEMORY_TYPE MemoryType
- );
-
-/**
- Initialize a basic mutual exclusion lock. Each lock
- provides mutual exclusion access at it's task priority
- level. Since there is no-premption (at any TPL) or
- multiprocessor support, acquiring the lock only consists
- of raising to the locks TPL.
-
- @param Lock The EFI_LOCK structure to initialize
-
- @retval EFI_SUCCESS Lock Owned.
- @retval EFI_ACCESS_DENIED Reentrant Lock Acquisition, Lock not Owned.
-
-**/
-EFI_STATUS
-CoreAcquireLockOrFail (
- IN EFI_LOCK *Lock
- );
-
-/**
- Releases ownership of the mutual exclusion lock, and
- restores the previous task priority level.
-
- @param Lock The lock to release
-
- @return Lock unowned
-
-**/
-VOID
-CoreReleaseLock (
- IN EFI_LOCK *Lock
- );
-
/**
Update memory profile information.
@@ -118,20 +72,6 @@ AdjustPoolHeadA (
IN UINTN Size
);
-/**
- Raising to the task priority level of the mutual exclusion
- lock, and then acquires ownership of the lock.
-
- @param Lock The lock to acquire
-
- @return Lock owned
-
-**/
-VOID
-CoreAcquireLock (
- IN EFI_LOCK *Lock
- );
-
/**
Adjust the start address and number of pages to free according to Guard.
diff --git a/MdeModulePkg/Library/MemoryPoolLib/Pool.c b/MdeModulePkg/Library/MemoryPoolLib/Pool.c
index 83d53286a3..9e8fb90904 100644
--- a/MdeModulePkg/Library/MemoryPoolLib/Pool.c
+++ b/MdeModulePkg/Library/MemoryPoolLib/Pool.c
@@ -825,6 +825,27 @@ IsHeapGuardEnabled (
return IsMemoryTypeToGuard (EfiMaxMemoryType, AllocateAnyPages, GuardType);
}
+/**
+ Check to see if the pool at the given address should be guarded or not.
+
+ @param[in] MemoryType Pool type to check.
+
+
+ @return TRUE The given type of pool should be guarded.
+ @return FALSE The given type of pool should not be guarded.
+**/
+BOOLEAN
+IsPoolTypeToGuard (
+ IN EFI_MEMORY_TYPE MemoryType
+ )
+{
+ return IsMemoryTypeToGuard (
+ MemoryType,
+ AllocateAnyPages,
+ GUARD_HEAP_TYPE_POOL
+ );
+}
+
/**
Check to see if the memory at the given address should be guarded or not.