diff options
author | Dun Tan <dun.tan@intel.com> | 2024-09-18 17:23:23 +0800 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2024-11-05 08:30:16 +0000 |
commit | 025cec183deaaef4942f37958b9cc09e69112ef0 (patch) | |
tree | 60bc27f26c3d1314bf0541b8b507524b4c6f2f55 | |
parent | b19f1311d668fbca3ddb72e1244608babd7791c5 (diff) | |
download | edk2-025cec183deaaef4942f37958b9cc09e69112ef0.tar.gz |
StandaloneMmPkg/MemLib: Add an internal header file
Add a internal header file for StandaloneMmMemLib.
Move some common reference and declaration into
StandaloneMmMemLibInternal.h.
Signed-off-by: Dun Tan <dun.tan@intel.com>
5 files changed, 59 insertions, 48 deletions
diff --git a/StandaloneMmPkg/Library/StandaloneMmMemLib/ArmStandaloneMmMemLibInternal.c b/StandaloneMmPkg/Library/StandaloneMmMemLib/ArmStandaloneMmMemLibInternal.c index fddcecf6da..f1e1ec3103 100644 --- a/StandaloneMmPkg/Library/StandaloneMmMemLib/ArmStandaloneMmMemLibInternal.c +++ b/StandaloneMmPkg/Library/StandaloneMmMemLib/ArmStandaloneMmMemLibInternal.c @@ -6,15 +6,13 @@ all MMRAM range via MM_ACCESS_PROTOCOL, including the range for firmware (like MM Core
and MM driver) and/or specific dedicated hardware.
- Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2015 - 2024, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2016 - 2018, ARM Limited. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
-#include <Library/BaseLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/DebugLib.h>
+#include "StandaloneMmMemLibInternal.h"
//
// Maximum support address used to check input buffer
//
@@ -25,7 +23,7 @@ extern EFI_PHYSICAL_ADDRESS mMmMemLibInternalMaximumSupportAddress; **/
VOID
-MmMemLibInternalCalculateMaximumSupportAddress (
+MmMemLibCalculateMaximumSupportAddress (
VOID
)
{
diff --git a/StandaloneMmPkg/Library/StandaloneMmMemLib/StandaloneMmMemLib.c b/StandaloneMmPkg/Library/StandaloneMmMemLib/StandaloneMmMemLib.c index 814352369e..e8b50c5a59 100644 --- a/StandaloneMmPkg/Library/StandaloneMmMemLib/StandaloneMmMemLib.c +++ b/StandaloneMmPkg/Library/StandaloneMmMemLib/StandaloneMmMemLib.c @@ -6,18 +6,14 @@ all MMRAM range via MM_ACCESS_PROTOCOL, including the range for firmware (like MM Core
and MM driver) and/or specific dedicated hardware.
- Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2015 - 2024, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2016 - 2021, Arm Limited. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
-#include <PiMm.h>
-
-#include <Library/BaseLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/DebugLib.h>
+#include "StandaloneMmMemLibInternal.h"
EFI_MMRAM_DESCRIPTOR *mMmMemLibInternalMmramRanges;
UINTN mMmMemLibInternalMmramCount;
@@ -28,36 +24,6 @@ UINTN mMmMemLibInternalMmramCount; EFI_PHYSICAL_ADDRESS mMmMemLibInternalMaximumSupportAddress = 0;
/**
- Calculate and save the maximum support address.
-
-**/
-VOID
-MmMemLibInternalCalculateMaximumSupportAddress (
- VOID
- );
-
-/**
- Initialize cached Mmram Ranges from HOB.
-
- @retval EFI_UNSUPPORTED The routine is unable to extract MMRAM information.
- @retval EFI_SUCCESS MmRanges are populated successfully.
-
-**/
-EFI_STATUS
-MmMemLibInternalPopulateMmramRanges (
- VOID
- );
-
-/**
- Deinitialize cached Mmram Ranges.
-
-**/
-VOID
-MmMemLibInternalFreeMmramRanges (
- VOID
- );
-
-/**
This function check if the buffer is valid per processor architecture and not overlap with MMRAM.
@param Buffer The buffer start address to be checked.
@@ -293,7 +259,7 @@ MemLibConstructor ( //
// Calculate and save maximum support address
//
- MmMemLibInternalCalculateMaximumSupportAddress ();
+ MmMemLibCalculateMaximumSupportAddress ();
//
// Initialize cached Mmram Ranges from HOB.
diff --git a/StandaloneMmPkg/Library/StandaloneMmMemLib/StandaloneMmMemLib.inf b/StandaloneMmPkg/Library/StandaloneMmMemLib/StandaloneMmMemLib.inf index a748af5ea5..54d9a7b10e 100644 --- a/StandaloneMmPkg/Library/StandaloneMmMemLib/StandaloneMmMemLib.inf +++ b/StandaloneMmPkg/Library/StandaloneMmMemLib/StandaloneMmMemLib.inf @@ -6,7 +6,7 @@ # all MMRAM range via MM_ACCESS_PROTOCOL, including the range for firmware (like MM Core
# and MM driver) and/or specific dedicated hardware.
#
-# Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2015 - 2024, Intel Corporation. All rights reserved.<BR>
# Copyright (c) 2016 - 2018, ARM Limited. All rights reserved.<BR>
# Copyright (c) Microsoft Corporation.
#
@@ -33,6 +33,7 @@ [Sources.Common]
StandaloneMmMemLib.c
+ StandaloneMmMemLibInternal.h
[Sources.IA32, Sources.X64]
X86StandaloneMmMemLibInternal.c
diff --git a/StandaloneMmPkg/Library/StandaloneMmMemLib/StandaloneMmMemLibInternal.h b/StandaloneMmPkg/Library/StandaloneMmMemLib/StandaloneMmMemLibInternal.h new file mode 100644 index 0000000000..d2fba8f909 --- /dev/null +++ b/StandaloneMmPkg/Library/StandaloneMmMemLib/StandaloneMmMemLibInternal.h @@ -0,0 +1,48 @@ +/** @file
+ Internal header for StandaloneMmMemLib.
+
+ Copyright (c) 2024, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef STANDALONE_MM_MEM_LIB_INTERNAL_H_
+#define STANDALONE_MM_MEM_LIB_INTERNAL_H_
+
+#include <PiMm.h>
+
+#include <Library/BaseLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/DebugLib.h>
+
+/**
+ Calculate and save the maximum support address.
+
+**/
+VOID
+MmMemLibCalculateMaximumSupportAddress (
+ VOID
+ );
+
+/**
+ Initialize cached Mmram Ranges from HOB.
+
+ @retval EFI_UNSUPPORTED The routine is unable to extract MMRAM information.
+ @retval EFI_SUCCESS MmRanges are populated successfully.
+
+**/
+EFI_STATUS
+MmMemLibInternalPopulateMmramRanges (
+ VOID
+ );
+
+/**
+ Deinitialize cached Mmram Ranges.
+
+**/
+VOID
+MmMemLibInternalFreeMmramRanges (
+ VOID
+ );
+
+#endif
diff --git a/StandaloneMmPkg/Library/StandaloneMmMemLib/X86StandaloneMmMemLibInternal.c b/StandaloneMmPkg/Library/StandaloneMmMemLib/X86StandaloneMmMemLibInternal.c index 19e1736ae1..81b959230f 100644 --- a/StandaloneMmPkg/Library/StandaloneMmMemLib/X86StandaloneMmMemLibInternal.c +++ b/StandaloneMmPkg/Library/StandaloneMmMemLib/X86StandaloneMmMemLibInternal.c @@ -6,18 +6,16 @@ all MMRAM range via MM_ACCESS_PROTOCOL, including the range for firmware (like MM Core
and MM driver) and/or specific dedicated hardware.
- Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2015 - 2024, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2016 - 2018, ARM Limited. All rights reserved.<BR>
Copyright (c) Microsoft Corporation.
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
+#include "StandaloneMmMemLibInternal.h"
#include <PiMm.h>
-#include <Library/BaseLib.h>
-#include <Library/BaseMemoryLib.h>
#include <Library/MemoryAllocationLib.h>
-#include <Library/DebugLib.h>
#include <Library/HobLib.h>
#include <Guid/MmramMemoryReserve.h>
@@ -34,7 +32,7 @@ extern UINTN mMmMemLibInternalMmramCount; **/
VOID
-MmMemLibInternalCalculateMaximumSupportAddress (
+MmMemLibCalculateMaximumSupportAddress (
VOID
)
{
|