From af1a266670d040d2f4083ff309d732d648afba2a Mon Sep 17 00:00:00 2001 From: Angelos Mouzakitis Date: Tue, 10 Oct 2023 14:33:42 +0000 Subject: Add submodule dependency files Change-Id: Iaf8d18082d3991dec7c0ebbea540f092188eb4ec --- .../Library/AArch64/StandaloneMmCoreEntryPoint.h | 213 +++++++++++++++++++++ roms/edk2/StandaloneMmPkg/Include/Library/FvLib.h | 103 ++++++++++ .../Include/Library/StandaloneMmCoreEntryPoint.h | 95 +++++++++ .../Include/Library/StandaloneMmDriverEntryPoint.h | 142 ++++++++++++++ .../Include/Library/StandaloneMmMemLib.h | 134 +++++++++++++ 5 files changed, 687 insertions(+) create mode 100644 roms/edk2/StandaloneMmPkg/Include/Library/AArch64/StandaloneMmCoreEntryPoint.h create mode 100644 roms/edk2/StandaloneMmPkg/Include/Library/FvLib.h create mode 100644 roms/edk2/StandaloneMmPkg/Include/Library/StandaloneMmCoreEntryPoint.h create mode 100644 roms/edk2/StandaloneMmPkg/Include/Library/StandaloneMmDriverEntryPoint.h create mode 100644 roms/edk2/StandaloneMmPkg/Include/Library/StandaloneMmMemLib.h (limited to 'roms/edk2/StandaloneMmPkg/Include/Library') diff --git a/roms/edk2/StandaloneMmPkg/Include/Library/AArch64/StandaloneMmCoreEntryPoint.h b/roms/edk2/StandaloneMmPkg/Include/Library/AArch64/StandaloneMmCoreEntryPoint.h new file mode 100644 index 000000000..0f9a03240 --- /dev/null +++ b/roms/edk2/StandaloneMmPkg/Include/Library/AArch64/StandaloneMmCoreEntryPoint.h @@ -0,0 +1,213 @@ +/** @file + Entry point to the Standalone MM Foundation when initialized during the SEC + phase on ARM platforms + +Copyright (c) 2017 - 2018, ARM Ltd. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __STANDALONEMMCORE_ENTRY_POINT_H__ +#define __STANDALONEMMCORE_ENTRY_POINT_H__ + +#include +#include + +#define CPU_INFO_FLAG_PRIMARY_CPU 0x00000001 + +typedef struct { + UINT8 Type; /* type of the structure */ + UINT8 Version; /* version of this structure */ + UINT16 Size; /* size of this structure in bytes */ + UINT32 Attr; /* attributes: unused bits SBZ */ +} EFI_PARAM_HEADER; + +typedef struct { + UINT64 Mpidr; + UINT32 LinearId; + UINT32 Flags; +} EFI_SECURE_PARTITION_CPU_INFO; + +typedef struct { + EFI_PARAM_HEADER Header; + UINT64 SpMemBase; + UINT64 SpMemLimit; + UINT64 SpImageBase; + UINT64 SpStackBase; + UINT64 SpHeapBase; + UINT64 SpNsCommBufBase; + UINT64 SpSharedBufBase; + UINT64 SpImageSize; + UINT64 SpPcpuStackSize; + UINT64 SpHeapSize; + UINT64 SpNsCommBufSize; + UINT64 SpPcpuSharedBufSize; + UINT32 NumSpMemRegions; + UINT32 NumCpus; + EFI_SECURE_PARTITION_CPU_INFO *CpuInfo; +} EFI_SECURE_PARTITION_BOOT_INFO; + +typedef +EFI_STATUS +(*PI_MM_ARM_TF_CPU_DRIVER_ENTRYPOINT) ( + IN UINTN EventId, + IN UINTN CpuNumber, + IN UINTN NsCommBufferAddr + ); + +typedef struct { + PI_MM_ARM_TF_CPU_DRIVER_ENTRYPOINT *ArmTfCpuDriverEpPtr; +} ARM_TF_CPU_DRIVER_EP_DESCRIPTOR; + +typedef RETURN_STATUS (*REGION_PERMISSION_UPDATE_FUNC) ( + IN EFI_PHYSICAL_ADDRESS BaseAddress, + IN UINT64 Length + ); + +/** + Privileged firmware assigns RO & Executable attributes to all memory occupied + by the Boot Firmware Volume. This function sets the correct permissions of + sections in the Standalone MM Core module to be able to access RO and RW data + and make further progress in the boot process. + + @param ImageContext Pointer to PE/COFF image context + @param ImageBase Base of image in memory + @param SectionHeaderOffset Offset of PE/COFF image section header + @param NumberOfSections Number of Sections + @param TextUpdater Function to change code permissions + @param ReadOnlyUpdater Function to change RO permissions + @param ReadWriteUpdater Function to change RW permissions + +**/ +EFI_STATUS +EFIAPI +UpdateMmFoundationPeCoffPermissions ( + IN CONST PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext, + IN EFI_PHYSICAL_ADDRESS ImageBase, + IN UINT32 SectionHeaderOffset, + IN CONST UINT16 NumberOfSections, + IN REGION_PERMISSION_UPDATE_FUNC TextUpdater, + IN REGION_PERMISSION_UPDATE_FUNC ReadOnlyUpdater, + IN REGION_PERMISSION_UPDATE_FUNC ReadWriteUpdater + ); + + +/** + Privileged firmware assigns RO & Executable attributes to all memory occupied + by the Boot Firmware Volume. This function locates the section information of + the Standalone MM Core module to be able to change permissions of the + individual sections later in the boot process. + + @param TeData Pointer to PE/COFF image data + @param ImageContext Pointer to PE/COFF image context + @param ImageBase Pointer to ImageBase variable + @param SectionHeaderOffset Offset of PE/COFF image section header + @param NumberOfSections Number of Sections + +**/ +EFI_STATUS +EFIAPI +GetStandaloneMmCorePeCoffSections ( + IN VOID *TeData, + IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext, + OUT EFI_PHYSICAL_ADDRESS *ImageBase, + IN OUT UINT32 *SectionHeaderOffset, + IN OUT UINT16 *NumberOfSections + ); + + +/** + Privileged firmware assigns RO & Executable attributes to all memory occupied + by the Boot Firmware Volume. This function locates the Standalone MM Core + module PE/COFF image in the BFV and returns this information. + + @param BfvAddress Base Address of Boot Firmware Volume + @param TeData Pointer to address for allocating memory for + PE/COFF image data + @param TeDataSize Pointer to size of PE/COFF image data + +**/ +EFI_STATUS +EFIAPI +LocateStandaloneMmCorePeCoffData ( + IN EFI_FIRMWARE_VOLUME_HEADER *BfvAddress, + IN OUT VOID **TeData, + IN OUT UINTN *TeDataSize + ); + + +/** + Use the boot information passed by privileged firmware to populate a HOB list + suitable for consumption by the MM Core and drivers. + + @param CpuDriverEntryPoint Address of MM CPU driver entrypoint + @param PayloadBootInfo Boot information passed by privileged firmware + +**/ +VOID * +EFIAPI +CreateHobListFromBootInfo ( + IN OUT PI_MM_ARM_TF_CPU_DRIVER_ENTRYPOINT *CpuDriverEntryPoint, + IN EFI_SECURE_PARTITION_BOOT_INFO *PayloadBootInfo + ); + + +/** + The entry point of Standalone MM Foundation. + + @param SharedBufAddress Pointer to the Buffer between SPM and SP. + @param cookie1. + @param cookie2. +**/ +VOID +EFIAPI +_ModuleEntryPoint ( + IN VOID *SharedBufAddress, + IN UINT64 SharedBufSize, + IN UINT64 cookie1, + IN UINT64 cookie2 + ); + + +/** + Auto generated function that calls the library constructors for all of the module's dependent libraries. + + This function must be called by _ModuleEntryPoint(). + This function calls the set of library constructors for the set of library instances + that a module depends on. This includes library instances that a module depends on + directly and library instances that a module depends on indirectly through other + libraries. This function is auto generated by build tools and those build tools are + responsible for collecting the set of library instances, determine which ones have + constructors, and calling the library constructors in the proper order based upon + each of the library instances own dependencies. + + @param ImageHandle The image handle of the DXE Core. + @param SystemTable A pointer to the EFI System Table. + +**/ +VOID +EFIAPI +ProcessLibraryConstructorList ( + IN EFI_HANDLE ImageHandle, + IN EFI_MM_SYSTEM_TABLE *MmSystemTable + ); + + +/** + Auto generated function that calls a set of module entry points. + + This function must be called by _ModuleEntryPoint(). + This function calls the set of module entry points. + This function is auto generated by build tools and those build tools are responsible + for collecting the module entry points and calling them in a specified order. + + @param HobStart Pointer to the beginning of the HOB List passed in from the PEI Phase. + +**/ +VOID +EFIAPI +ProcessModuleEntryPointList ( + IN VOID *HobStart + ); + +#endif diff --git a/roms/edk2/StandaloneMmPkg/Include/Library/FvLib.h b/roms/edk2/StandaloneMmPkg/Include/Library/FvLib.h new file mode 100644 index 000000000..c08e043cf --- /dev/null +++ b/roms/edk2/StandaloneMmPkg/Include/Library/FvLib.h @@ -0,0 +1,103 @@ +/** @file + +Copyright (c) 2015, Intel Corporation. All rights reserved.
+Copyright (c) 2016 - 2018, ARM Limited. All rights reserved.
+ +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _FV_LIB_H_ +#define _FV_LIB_H_ + +#include +#include +#include + +/** + Given the input file pointer, search for the next matching file in the + FFS volume as defined by SearchType. The search starts from FileHeader inside + the Firmware Volume defined by FwVolHeader. + + @param SearchType Filter to find only files of this type. + Type EFI_FV_FILETYPE_ALL causes no filtering to be done. + @param FwVolHeader Pointer to the FV header of the volume to search. + This parameter must point to a valid FFS volume. + @param FileHeader Pointer to the current file from which to begin searching. + This pointer will be updated upon return to reflect the file found. + + @retval EFI_NOT_FOUND No files matching the search criteria were found + @retval EFI_SUCCESS +**/ +EFI_STATUS +EFIAPI +FfsFindNextFile ( + IN EFI_FV_FILETYPE SearchType, + IN EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader, + IN OUT EFI_FFS_FILE_HEADER **FileHeader + ); + +/** + Given the input file pointer, search for the next matching section in the + FFS volume. + + @param SearchType Filter to find only sections of this type. + @param FfsFileHeader Pointer to the current file to search. + @param SectionHeader Pointer to the Section matching SectionType in FfsFileHeader. + NULL if section not found + + @retval EFI_NOT_FOUND No files matching the search criteria were found + @retval EFI_SUCCESS +**/ +EFI_STATUS +FfsFindSection ( + IN EFI_SECTION_TYPE SectionType, + IN EFI_FFS_FILE_HEADER *FfsFileHeader, + IN OUT EFI_COMMON_SECTION_HEADER **SectionHeader + ); + +/** + Locates a section within a series of sections + with the specified section type. + + @param[in] Sections The sections to search + @param[in] SizeOfSections Total size of all sections + @param[in] SectionType The section type to locate + @param[out] FoundSection The FFS section if found + + @retval EFI_SUCCESS The file and section was found + @retval EFI_NOT_FOUND The file and section was not found + @retval EFI_VOLUME_CORRUPTED The firmware volume was corrupted +**/ +EFI_STATUS +EFIAPI +FindFfsSectionInSections ( + IN VOID *Sections, + IN UINTN SizeOfSections, + IN EFI_SECTION_TYPE SectionType, + OUT EFI_COMMON_SECTION_HEADER **FoundSection + ); + +/** + Given the input file pointer, search for the next matching section in the + FFS volume. + + @param SearchType Filter to find only sections of this type. + @param FfsFileHeader Pointer to the current file to search. + @param SectionData Pointer to the Section matching SectionType in FfsFileHeader. + NULL if section not found + @param SectionDataSize The size of SectionData + + @retval EFI_NOT_FOUND No files matching the search criteria were found + @retval EFI_SUCCESS +**/ +EFI_STATUS +EFIAPI +FfsFindSectionData ( + IN EFI_SECTION_TYPE SectionType, + IN EFI_FFS_FILE_HEADER *FfsFileHeader, + OUT VOID **SectionData, + OUT UINTN *SectionDataSize + ); + +#endif diff --git a/roms/edk2/StandaloneMmPkg/Include/Library/StandaloneMmCoreEntryPoint.h b/roms/edk2/StandaloneMmPkg/Include/Library/StandaloneMmCoreEntryPoint.h new file mode 100644 index 000000000..9799604e8 --- /dev/null +++ b/roms/edk2/StandaloneMmPkg/Include/Library/StandaloneMmCoreEntryPoint.h @@ -0,0 +1,95 @@ +/** @file + Module entry point library for STANDALONE MM core. + +Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
+Copyright (c) 2016 - 2018, ARM Limited. All rights reserved.
+ +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __MODULE_ENTRY_POINT_H__ +#define __MODULE_ENTRY_POINT_H__ + +/// +/// Global variable that contains a pointer to the Hob List passed into the STANDALONE MM Core entry point. +/// +extern VOID *gHobList; + + +/** + The entry point of PE/COFF Image for the STANDALONE MM Core. + + This function is the entry point for the STANDALONE MM Core. This function is required to call + ProcessModuleEntryPointList() and ProcessModuleEntryPointList() is never expected to return. + The STANDALONE MM Core is responsible for calling ProcessLibraryConstructorList() as soon as the EFI + System Table and the image handle for the STANDALONE MM Core itself have been established. + If ProcessModuleEntryPointList() returns, then ASSERT() and halt the system. + + @param HobStart Pointer to the beginning of the HOB List passed in from the PEI Phase. + +**/ +VOID +EFIAPI +_ModuleEntryPoint ( + IN VOID *HobStart + ); + + +/** + Required by the EBC compiler and identical in functionality to _ModuleEntryPoint(). + + This function is required to call _ModuleEntryPoint() passing in HobStart. + + @param HobStart Pointer to the beginning of the HOB List passed in from the PEI Phase. + +**/ +VOID +EFIAPI +EfiMain ( + IN VOID *HobStart + ); + + +/** + Auto generated function that calls the library constructors for all of the module's dependent libraries. + + This function must be called by _ModuleEntryPoint(). + This function calls the set of library constructors for the set of library instances + that a module depends on. This includes library instances that a module depends on + directly and library instances that a module depends on indirectly through other + libraries. This function is auto generated by build tools and those build tools are + responsible for collecting the set of library instances, determine which ones have + constructors, and calling the library constructors in the proper order based upon + each of the library instances own dependencies. + + @param ImageHandle The image handle of the STANDALONE MM Core. + @param SystemTable A pointer to the EFI System Table. + +**/ +VOID +EFIAPI +ProcessLibraryConstructorList ( + IN EFI_HANDLE ImageHandle, + IN EFI_MM_SYSTEM_TABLE *MmSystemTable + ); + + +/** + Autogenerated function that calls a set of module entry points. + + This function must be called by _ModuleEntryPoint(). + This function calls the set of module entry points. + This function is auto generated by build tools and those build tools are responsible + for collecting the module entry points and calling them in a specified order. + + @param HobStart Pointer to the beginning of the HOB List passed in from the PEI Phase. + +**/ +VOID +EFIAPI +ProcessModuleEntryPointList ( + IN VOID *HobStart + ); + +#endif diff --git a/roms/edk2/StandaloneMmPkg/Include/Library/StandaloneMmDriverEntryPoint.h b/roms/edk2/StandaloneMmPkg/Include/Library/StandaloneMmDriverEntryPoint.h new file mode 100644 index 000000000..c83212b40 --- /dev/null +++ b/roms/edk2/StandaloneMmPkg/Include/Library/StandaloneMmDriverEntryPoint.h @@ -0,0 +1,142 @@ +/** @file + Module entry point library for Standalone MM Drivers. + +Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
+Copyright (c) 2016 - 2018, ARM Limited. All rights reserved.
+ +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __MODULE_ENTRY_POINT_H__ +#define __MODULE_ENTRY_POINT_H__ + +/// +///Declare the PI Specification Revision that this driver requires to execute correctly. +/// +extern CONST UINT32 _gMmRevision; + +/** + The entry point of PE/COFF Image for a Standalone MM Driver. + + This function is the entry point for a Standalone MM Driver. + This function must call ProcessLibraryConstructorList() and + ProcessModuleEntryPointList(). + If the return status from ProcessModuleEntryPointList() + is an error status, then ProcessLibraryDestructorList() must be called. + The return value from ProcessModuleEntryPointList() is returned. + If _gDriverUnloadImageCount is greater + than zero, then an unload handler must be registered for this image and + the unload handler must invoke ProcessModuleUnloadList(). + If _gUefiDriverRevision is not zero and SystemTable->Hdr.Revision is + less than _gUefiDriverRevison, then return EFI_INCOMPATIBLE_VERSION. + + @param ImageHandle The image handle of the Standalone MM Driver. + @param SystemTable A pointer to the EFI System Table. + + @retval EFI_SUCCESS The Standalone MM Driver exited normally. + @retval EFI_INCOMPATIBLE_VERSION _gUefiDriverRevision is greater than + SystemTable->Hdr.Revision. + @retval Other Return value from + ProcessModuleEntryPointList(). + +**/ +EFI_STATUS +EFIAPI +_ModuleEntryPoint ( + IN EFI_HANDLE ImageHandle, + IN EFI_MM_SYSTEM_TABLE *MmSystemTable + ); + + +/** + Required by the EBC compiler and identical in functionality to _ModuleEntryPoint(). + + This function is required to call _ModuleEntryPoint() passing in ImageHandle, and SystemTable. + + @param ImageHandle The image handle of the Standalone MM Driver. + @param SystemTable A pointer to the EFI System Table. + + @retval EFI_SUCCESS The Standalone MM Driver exited normally. + @retval EFI_INCOMPATIBLE_VERSION _gUefiDriverRevision is greater than + SystemTable->Hdr.Revision. + @retval Other Return value from ProcessModuleEntryPointList(). +**/ +EFI_STATUS +EFIAPI +EfiMain ( + IN EFI_HANDLE ImageHandle, + IN EFI_MM_SYSTEM_TABLE *MmSystemTable + ); + +/** + Auto generated function that calls the library constructors for all of the module's + dependent libraries. + + This function must be called by _ModuleEntryPoint(). + This function calls the set of library constructors for the set of library instances + that a module depends on. This includes library instances that a module depends on + directly and library instances that a module depends on indirectly through other libraries. + This function is auto generated by build tools and those build tools are responsible + for collecting the set of library instances, determine which ones have constructors, + and calling the library constructors in the proper order based upon each of the library + instances own dependencies. + + @param ImageHandle The image handle of the Standalone MM Driver. + @param SystemTable A pointer to the EFI System Table. + +**/ +VOID +EFIAPI +ProcessLibraryConstructorList ( + IN EFI_HANDLE ImageHandle, + IN EFI_MM_SYSTEM_TABLE *MmSystemTable + ); + + +/** + Auto generated function that calls the library descructors for all of the module's + dependent libraries. + + This function may be called by _ModuleEntryPoint() or ExitDriver(). + This function calls the set of library destructors for the set of library instances + that a module depends on. This includes library instances that a module depends on + directly and library instances that a module depends on indirectly through other libraries. + This function is auto generated by build tools and those build tools are responsible for + collecting the set of library instances, determine which ones have destructors, and calling + the library destructors in the proper order based upon each of the library instances own dependencies. + + @param ImageHandle The image handle of the Standalone MM Driver. + @param SystemTable A pointer to the EFI System Table. + +**/ +VOID +EFIAPI +ProcessLibraryDestructorList ( + IN EFI_HANDLE ImageHandle, + IN EFI_MM_SYSTEM_TABLE *MmSystemTable + ); + + +/** + Auto generated function that calls a set of module entry points. + + This function must be called by _ModuleEntryPoint(). + This function calls the set of module entry points. + This function is auto generated by build tools and those build tools are responsible + for collecting the module entry points and calling them in a specified order. + + @param ImageHandle The image handle of the Standalone MM Driver. + @param SystemTable A pointer to the EFI System Table. + + @retval EFI_SUCCESS The Standalone MMDriver executed normally. + @retval !EFI_SUCCESS The Standalone MM Driver failed to execute normally. +**/ +EFI_STATUS +EFIAPI +ProcessModuleEntryPointList ( + IN EFI_HANDLE ImageHandle, + IN EFI_MM_SYSTEM_TABLE *MmSystemTable + ); + +#endif diff --git a/roms/edk2/StandaloneMmPkg/Include/Library/StandaloneMmMemLib.h b/roms/edk2/StandaloneMmPkg/Include/Library/StandaloneMmMemLib.h new file mode 100644 index 000000000..baa6fe998 --- /dev/null +++ b/roms/edk2/StandaloneMmPkg/Include/Library/StandaloneMmMemLib.h @@ -0,0 +1,134 @@ +/** @file + 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 - 2018, ARM Limited. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _MM_MEM_LIB_H_ +#define _MM_MEM_LIB_H_ + +/** + 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. + @param Length The buffer length to be checked. + + @retval TRUE This buffer is valid per processor architecture and not overlap with MMRAM. + @retval FALSE This buffer is not valid per processor architecture or overlap with MMRAM. +**/ +BOOLEAN +EFIAPI +MmIsBufferOutsideMmValid ( + IN EFI_PHYSICAL_ADDRESS Buffer, + IN UINT64 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. + + @param DestinationBuffer The pointer to the destination buffer of the memory copy. + @param SourceBuffer The pointer to the source buffer of the memory copy. + @param Length The number of bytes to copy from SourceBuffer to DestinationBuffer. + + @retval EFI_SECURITY_VIOLATION The SourceBuffer is invalid per processor architecture or overlap with MMRAM. + @retval EFI_SUCCESS Memory is copied. + +**/ +EFI_STATUS +EFIAPI +MmCopyMemToMmram ( + 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. + + @param DestinationBuffer The pointer to the destination buffer of the memory copy. + @param SourceBuffer The pointer to the source buffer of the memory copy. + @param Length The number of bytes to copy from SourceBuffer to DestinationBuffer. + + @retval EFI_SECURITY_VIOLATION The DesinationBuffer is invalid per processor architecture or overlap with MMRAM. + @retval EFI_SUCCESS Memory is copied. + +**/ +EFI_STATUS +EFIAPI +MmCopyMemFromMmram ( + 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. + + @param DestinationBuffer The pointer to the destination buffer of the memory copy. + @param SourceBuffer The pointer to the source buffer of the memory copy. + @param Length The number of bytes to copy from SourceBuffer to DestinationBuffer. + + @retval EFI_SECURITY_VIOLATION The DesinationBuffer is invalid per processor architecture or overlap with MMRAM. + @retval EFI_SECURITY_VIOLATION The SourceBuffer is invalid per processor architecture or overlap with MMRAM. + @retval EFI_SUCCESS Memory is copied. + +**/ +EFI_STATUS +EFIAPI +MmCopyMem ( + OUT VOID *DestinationBuffer, + IN CONST VOID *SourceBuffer, + IN UINTN Length + ); + +/** + 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. + + @param Buffer The memory to set. + @param Length The number of bytes to set. + @param Value The value with which to fill Length bytes of Buffer. + + @retval EFI_SECURITY_VIOLATION The Buffer is invalid per processor architecture or overlap with MMRAM. + @retval EFI_SUCCESS Memory is set. + +**/ +EFI_STATUS +EFIAPI +MmSetMem ( + OUT VOID *Buffer, + IN UINTN Length, + IN UINT8 Value + ); + +#endif -- cgit 1.2.3-korg