audk/StandaloneMmPkg/Library/StandaloneMmMemLib/ArmStandaloneMmMemLibInternal.c
Dun Tan 836942fbad StandaloneMmPkg/MemLib: remove unnecessary check
Remove unnecessary check in API MmIsBufferOutsideMmValid of
StandaloneMmMemLib.

The API is used to check if a input buffer is outside MMRAM and
inside a valid non-MMRAM range. Previously, the API only checks
if the input buffer is
 overlapped with MMRAM range. In the last
commit, we add logic to check if the input buffer is inside valid
non-MMRAM 
ranges reported by the resource HOB. Since the resource
HOB only covers valid non-MMRAM ranges, we doesn't need to check
if the input buffer is inside the MMRAM anymore.

Signed-off-by: Dun Tan <dun.tan@intel.com>
2024-11-05 08:30:16 +00:00

76 lines
1.8 KiB
C

/** @file
Internal ARCH Specific file of MM memory check library.
MM memory check library implementation. This library consumes MM_ACCESS_PROTOCOL
to get MMRAM information. In order to use this library instance, the platform should produce
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 - 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 "StandaloneMmMemLibInternal.h"
//
// Maximum support address used to check input buffer
//
extern EFI_PHYSICAL_ADDRESS mMmMemLibInternalMaximumSupportAddress;
/**
Calculate and save the maximum support address.
**/
VOID
MmMemLibCalculateMaximumSupportAddress (
VOID
)
{
mMmMemLibInternalMaximumSupportAddress = MAX_ALLOC_ADDRESS;
DEBUG ((DEBUG_INFO, "mMmMemLibInternalMaximumSupportAddress = 0x%lx\n", mMmMemLibInternalMaximumSupportAddress));
}
/**
Initialize valid non-Mmram Ranges from Resource HOB.
**/
VOID
MmMemLibInitializeValidNonMmramRanges (
VOID
)
{
// Not implemented for AARCH64.
}
/**
Deinitialize cached non-Mmram Ranges.
**/
VOID
MmMemLibFreeValidNonMmramRanges (
VOID
)
{
// Not implemented for AARCH64.
}
/**
This function check if the buffer is valid non-MMRAM memory range.
@param[in] Buffer The buffer start address to be checked.
@param[in] Length The buffer length to be checked.
@retval TRUE This buffer is valid non-MMRAM memory range.
@retval FALSE This buffer is not valid non-MMRAM memory range.
**/
BOOLEAN
MmMemLibIsValidNonMmramRange (
IN EFI_PHYSICAL_ADDRESS Buffer,
IN UINT64 Length
)
{
return TRUE;
}