StandaloneMmPkg/MmIpl : Add MM core fv location PPI support
MmIpl should locate MM core FV location PPI to find current MM FV location. Signed-off-by: Hongbin1 Zhang <hongbin1.zhang@intel.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Star Zeng <star.zeng@intel.com> Cc: Jiaxin Wu <jiaxin.wu@intel.com> Cc: Wei6 Xu <wei6.xu@intel.com> Cc: Sami Mujawar <sami.mujawar@arm.com> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Supreeth Venkatesh <supreeth.venkatesh@arm.com>
This commit is contained in:
parent
47cb080ca4
commit
816a02cb3b
|
@ -147,12 +147,47 @@ LocateMmCoreFv (
|
|||
OUT VOID **MmCoreImageAddress
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINTN FvIndex;
|
||||
EFI_PEI_FV_HANDLE VolumeHandle;
|
||||
EFI_PEI_FILE_HANDLE FileHandle;
|
||||
EFI_PE32_SECTION *SectionData;
|
||||
EFI_FV_INFO VolumeInfo;
|
||||
EFI_STATUS Status;
|
||||
UINTN FvIndex;
|
||||
EFI_PEI_FV_HANDLE VolumeHandle;
|
||||
EFI_PEI_FILE_HANDLE FileHandle;
|
||||
EFI_PE32_SECTION *SectionData;
|
||||
EFI_FV_INFO VolumeInfo;
|
||||
MM_CORE_FV_LOCATION_PPI *MmCoreFvLocation;
|
||||
|
||||
//
|
||||
// The producer of the MmCoreFvLocation PPI is responsible for ensuring
|
||||
// that it reports the correct Firmware Volume (FV) containing the MmCore.
|
||||
// If the gMmCoreFvLocationPpiGuid is not found, the system will search
|
||||
// all Firmware Volumes (FVs) to locate the FV that contains the MM Core.
|
||||
//
|
||||
Status = PeiServicesLocatePpi (&gMmCoreFvLocationPpiGuid, 0, NULL, (VOID **)&MmCoreFvLocation);
|
||||
if (Status == EFI_SUCCESS) {
|
||||
*MmFvBase = MmCoreFvLocation->Address;
|
||||
*MmFvSize = MmCoreFvLocation->Size;
|
||||
FileHandle = NULL;
|
||||
Status = PeiServicesFfsFindNextFile (EFI_FV_FILETYPE_MM_CORE_STANDALONE, (VOID *)(UINTN)MmCoreFvLocation->Address, &FileHandle);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
if (Status == EFI_SUCCESS) {
|
||||
ASSERT (FileHandle != NULL);
|
||||
if (FileHandle != NULL) {
|
||||
CopyGuid (MmCoreFileName, &((EFI_FFS_FILE_HEADER *)FileHandle)->Name);
|
||||
//
|
||||
// Search Section
|
||||
//
|
||||
Status = PeiServicesFfsFindSectionData (EFI_SECTION_PE32, FileHandle, MmCoreImageAddress);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// Get MM Core section data.
|
||||
//
|
||||
SectionData = (EFI_PE32_SECTION *)((UINT8 *)*MmCoreImageAddress - sizeof (EFI_PE32_SECTION));
|
||||
ASSERT (SectionData->Type == EFI_SECTION_PE32);
|
||||
}
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
//
|
||||
// Search all FV
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include <Library/PeiServicesTablePointerLib.h>
|
||||
#include <Ppi/MmControl.h>
|
||||
#include <Ppi/MmCommunication.h>
|
||||
#include <Ppi/MmCoreFvLocationPpi.h>
|
||||
#include <Protocol/MmCommunication.h>
|
||||
#include <Library/MmPlatformHobProducerLib.h>
|
||||
|
||||
|
|
|
@ -61,6 +61,7 @@
|
|||
gEfiPeiMmControlPpiGuid
|
||||
gEfiPeiMmCommunicationPpiGuid
|
||||
gEfiEndOfPeiSignalPpiGuid
|
||||
gMmCoreFvLocationPpiGuid
|
||||
|
||||
[Protocols]
|
||||
gEfiMmEndOfPeiProtocol
|
||||
|
|
Loading…
Reference in New Issue