StandaloneMmPkg[all]  1.0
 All Data Structures Files Functions Variables Typedefs Macros Pages
StandaloneMmMemLib.h File Reference

Functions

BOOLEAN EFIAPI MmIsBufferOutsideMmValid (IN EFI_PHYSICAL_ADDRESS Buffer, IN UINT64 Length)
 
EFI_STATUS EFIAPI MmCopyMemToMmram (OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
 
EFI_STATUS EFIAPI MmCopyMemFromMmram (OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
 
EFI_STATUS EFIAPI MmCopyMem (OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
 
EFI_STATUS EFIAPI MmSetMem (OUT VOID *Buffer, IN UINTN Length, IN UINT8 Value)
 

Detailed Description

Provides services for MM Memory Operation.

The MM Mem Library provides function for checking if buffer is outside MMRAM and valid. It also provides functions for copy data from MMRAM to non-MMRAM, from non-MMRAM to MMRAM, from non-MMRAM to non-MMRAM, or set data in non-MMRAM.

Copyright (c) 2015, Intel Corporation. All rights reserved.
Copyright (c) 2016 - 2021, Arm Limited. All rights reserved.

SPDX-License-Identifier: BSD-2-Clause-Patent

Function Documentation

EFI_STATUS EFIAPI MmCopyMem ( OUT VOID *  DestinationBuffer,
IN CONST VOID *  SourceBuffer,
IN UINTN  Length 
)

Copies a source buffer (NON-MMRAM) to a destination buffer (NON-MMRAM).

This function copies a source buffer (non-MMRAM) to a destination buffer (MMRAM). It checks if source buffer and destination buffer are valid per processor architecture and not overlap with MMRAM. If the check passes, it copies memory and returns EFI_SUCCESS. If the check fails, it returns EFI_SECURITY_VIOLATION. The implementation must be reentrant, and it must handle the case where source buffer overlaps destination buffer.

Parameters
DestinationBufferThe pointer to the destination buffer of the memory copy.
SourceBufferThe pointer to the source buffer of the memory copy.
LengthThe number of bytes to copy from SourceBuffer to DestinationBuffer.
Return values
EFI_SECURITY_VIOLATIONThe DestinationBuffer is invalid per processor architecture or overlap with MMRAM.
EFI_SECURITY_VIOLATIONThe SourceBuffer is invalid per processor architecture or overlap with MMRAM.
EFI_SUCCESSMemory is copied.
EFI_STATUS EFIAPI MmCopyMemFromMmram ( OUT VOID *  DestinationBuffer,
IN CONST VOID *  SourceBuffer,
IN UINTN  Length 
)

Copies a source buffer (MMRAM) to a destination buffer (NON-MMRAM).

This function copies a source buffer (non-MMRAM) to a destination buffer (MMRAM). It checks if destination buffer is valid per processor architecture and not overlap with MMRAM. If the check passes, it copies memory and returns EFI_SUCCESS. If the check fails, it returns EFI_SECURITY_VIOLATION. The implementation must be reentrant.

Parameters
DestinationBufferThe pointer to the destination buffer of the memory copy.
SourceBufferThe pointer to the source buffer of the memory copy.
LengthThe number of bytes to copy from SourceBuffer to DestinationBuffer.
Return values
EFI_SECURITY_VIOLATIONThe DestinationBuffer is invalid per processor architecture or overlap with MMRAM.
EFI_SUCCESSMemory is copied.
EFI_STATUS EFIAPI MmCopyMemToMmram ( OUT VOID *  DestinationBuffer,
IN CONST VOID *  SourceBuffer,
IN UINTN  Length 
)

Copies a source buffer (non-MMRAM) to a destination buffer (MMRAM).

This function copies a source buffer (non-MMRAM) to a destination buffer (MMRAM). It checks if source buffer is valid per processor architecture and not overlap with MMRAM. If the check passes, it copies memory and returns EFI_SUCCESS. If the check fails, it return EFI_SECURITY_VIOLATION. The implementation must be reentrant.

Parameters
DestinationBufferThe pointer to the destination buffer of the memory copy.
SourceBufferThe pointer to the source buffer of the memory copy.
LengthThe number of bytes to copy from SourceBuffer to DestinationBuffer.
Return values
EFI_SECURITY_VIOLATIONThe SourceBuffer is invalid per processor architecture or overlap with MMRAM.
EFI_SUCCESSMemory is copied.
BOOLEAN EFIAPI MmIsBufferOutsideMmValid ( IN EFI_PHYSICAL_ADDRESS  Buffer,
IN UINT64  Length 
)

This function check if the buffer is valid per processor architecture and not overlap with MMRAM.

Parameters
BufferThe buffer start address to be checked.
LengthThe buffer length to be checked.
Return values
TRUEThis buffer is valid per processor architecture and not overlap with MMRAM.
FALSEThis buffer is not valid per processor architecture or overlap with MMRAM.
EFI_STATUS EFIAPI MmSetMem ( OUT VOID *  Buffer,
IN UINTN  Length,
IN UINT8  Value 
)

Fills a target buffer (NON-MMRAM) with a byte value.

This function fills a target buffer (non-MMRAM) with a byte value. It checks if target buffer is valid per processor architecture and not overlap with MMRAM. If the check passes, it fills memory and returns EFI_SUCCESS. If the check fails, it returns EFI_SECURITY_VIOLATION.

Parameters
BufferThe memory to set.
LengthThe number of bytes to set.
ValueThe value with which to fill Length bytes of Buffer.
Return values
EFI_SECURITY_VIOLATIONThe Buffer is invalid per processor architecture or overlap with MMRAM.
EFI_SUCCESSMemory is set.