StandaloneMmPkg: StandaloneMmMemLib: Extends support for X64 architecture

This change extends StandaloneMmMemLib library to support X64
architecture. The implementation is ported from MdePkg/Library/SmmMemLib.

Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Supreeth Venkatesh <supreeth.venkatesh@arm.com>

Signed-off-by: Kun Qin <kun.q@outlook.com>
Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
This commit is contained in:
Kun Qin
2020-12-18 03:09:24 -08:00
parent 2b9006762d
commit 037ccb09a2
4 changed files with 246 additions and 1 deletions

View File

@@ -37,6 +37,27 @@ 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.
@@ -253,11 +274,42 @@ MemLibConstructor (
IN EFI_MM_SYSTEM_TABLE *MmSystemTable
)
{
EFI_STATUS Status;
//
// Calculate and save maximum support address
//
MmMemLibInternalCalculateMaximumSupportAddress ();
//
// Initialize cached Mmram Ranges from HOB.
//
Status = MmMemLibInternalPopulateMmramRanges ();
return Status;
}
/**
Destructor for Mm Mem library.
@param ImageHandle The image handle of the process.
@param MmSystemTable The EFI System Table pointer.
@retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
**/
EFI_STATUS
EFIAPI
MemLibDestructor (
IN EFI_HANDLE ImageHandle,
IN EFI_MM_SYSTEM_TABLE *MmSystemTable
)
{
//
// Deinitialize cached Mmram Ranges.
//
MmMemLibInternalFreeMmramRanges ();
return EFI_SUCCESS;
}