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>
This commit is contained in:
Dun Tan 2024-09-18 17:23:23 +08:00 committed by mergify[bot]
parent b19f1311d6
commit 025cec183d
5 changed files with 59 additions and 48 deletions

View File

@ -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
)
{

View File

@ -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;
@ -27,36 +23,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.
@ -293,7 +259,7 @@ MemLibConstructor (
//
// Calculate and save maximum support address
//
MmMemLibInternalCalculateMaximumSupportAddress ();
MmMemLibCalculateMaximumSupportAddress ();
//
// Initialize cached Mmram Ranges from HOB.

View File

@ -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

View File

@ -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

View File

@ -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
)
{