TianoCore EDK2 master
Loading...
Searching...
No Matches
StandaloneMmIplPei.c File Reference

Go to the source code of this file.

Functions

EFI_STATUS EFIAPI Communicate (IN CONST EFI_PEI_MM_COMMUNICATION_PPI *This, IN OUT VOID *CommBuffer, IN OUT UINTN *CommSize)
 
EFI_STATUS LocateMmCoreFv (OUT EFI_PHYSICAL_ADDRESS *MmFvBase, OUT UINTN *MmFvSize, OUT EFI_GUID *MmCoreFileName, OUT VOID **MmCoreImageAddress)
 
VOID * CreatMmHobList (OUT UINTN *HobSize, IN MM_COMM_BUFFER *MmCommBuffer, IN EFI_PHYSICAL_ADDRESS MmFvBase, IN UINT64 MmFvSize, IN EFI_GUID *MmCoreFileName, IN PHYSICAL_ADDRESS MmCoreImageAddress, IN UINT64 MmCoreImageSize, IN PHYSICAL_ADDRESS MmCoreEntryPoint, IN EFI_MMRAM_HOB_DESCRIPTOR_BLOCK *Block)
 
VOID FindLargestMmramRange (IN OUT UINTN *LagestMmramRangeIndex, IN EFI_MMRAM_HOB_DESCRIPTOR_BLOCK *CurrentBlock)
 
EFI_PHYSICAL_ADDRESS MmIplAllocateMmramPage (IN UINTN Pages, OUT EFI_MMRAM_HOB_DESCRIPTOR_BLOCK **NewBlock)
 
EFI_STATUS ExecuteMmCoreFromMmram (IN MM_COMM_BUFFER *MmCommBuffer)
 
EFI_STATUS EFIAPI EndOfPeiCallback (IN EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor, IN VOID *Ppi)
 
EFI_STATUS MmIplDispatchMmDrivers (VOID)
 
MM_COMM_BUFFERMmIplBuildCommBufferHob (VOID)
 
EFI_STATUS EFIAPI StandaloneMmIplPeiEntry (IN EFI_PEI_FILE_HANDLE FileHandle, IN CONST EFI_PEI_SERVICES **PeiServices)
 

Variables

EFI_PEI_MM_COMMUNICATION_PPI mMmCommunicationPpi = { Communicate }
 
EFI_PEI_PPI_DESCRIPTOR mPpiList
 
EFI_PEI_NOTIFY_DESCRIPTOR mNotifyList
 

Detailed Description

MM IPL that load the MM Core into MMRAM at PEI stage

Copyright (c) 2024, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file StandaloneMmIplPei.c.

Function Documentation

◆ Communicate()

EFI_STATUS EFIAPI Communicate ( IN CONST EFI_PEI_MM_COMMUNICATION_PPI This,
IN OUT VOID *  CommBuffer,
IN OUT UINTN CommSize 
)

Communicates with a registered handler.

This function provides a service to send and receive messages from a registered UEFI service.

Parameters
[in]ThisThe EFI_PEI_MM_COMMUNICATION_PPI instance.
[in,out]CommBufferA pointer to the buffer to convey into MMRAM.
[in,out]CommSizeThe size of the data buffer being passed in.On exit, the size of data being returned. Zero if the handler does not wish to reply with any data.
Return values
EFI_SUCCESSThe message was successfully posted.
EFI_INVALID_PARAMETERThe CommBuffer was NULL.
EFI_NOT_STARTEDThe service is NOT started.

Definition at line 41 of file StandaloneMmIplPei.c.

◆ CreatMmHobList()

VOID * CreatMmHobList ( OUT UINTN HobSize,
IN MM_COMM_BUFFER MmCommBuffer,
IN EFI_PHYSICAL_ADDRESS  MmFvBase,
IN UINT64  MmFvSize,
IN EFI_GUID MmCoreFileName,
IN PHYSICAL_ADDRESS  MmCoreImageAddress,
IN UINT64  MmCoreImageSize,
IN PHYSICAL_ADDRESS  MmCoreEntryPoint,
IN EFI_MMRAM_HOB_DESCRIPTOR_BLOCK Block 
)

Create HOB list for Standalone MM core.

Parameters
[out]HobSizeHOB size of fundation and platform HOB list.
[in]MmCommBufferPointer of MM communication buffer.
[in]MmFvBaseBase of MM FV which included MM core driver.
[in]MmFvSizeSize of MM FV which included MM core driver.
[in]MmCoreFileNameFile GUID of MM core driver.
[in]MmCoreImageAddressAddress of MM core image.
[in]MmCoreImageSizeSize of MM core image.
[in]MmCoreEntryPointEntry point of MM core driver.
[in]BlockPointer of MMRAM descriptor block.
Return values
HobListIf fundation and platform HOBs not existed, it is pointed to PEI HOB List. If existed, it is pointed to fundation and platform HOB list.

Definition at line 229 of file StandaloneMmIplPei.c.

◆ EndOfPeiCallback()

EFI_STATUS EFIAPI EndOfPeiCallback ( IN EFI_PEI_SERVICES **  PeiServices,
IN EFI_PEI_NOTIFY_DESCRIPTOR NotifyDescriptor,
IN VOID *  Ppi 
)

This is the callback function on end of PEI.

This callback is used for call MmEndOfPeiHandler in standalone MM core.

Parameters
PeiServicesGeneral purpose services available to every PEIM.
NotifyDescriptorThe notification structure this PEIM registered on install.
PpiPointer to the PPI data associated with this function.
Return values
EFI_SUCCESSExit boot services successfully.
OtherExit boot services failed.

Definition at line 616 of file StandaloneMmIplPei.c.

◆ ExecuteMmCoreFromMmram()

EFI_STATUS ExecuteMmCoreFromMmram ( IN MM_COMM_BUFFER MmCommBuffer)

Load the MM Core image into MMRAM and executes the MM Core from MMRAM.

Parameters
[in]MmCommBufferMM communicate buffer
Returns
EFI_STATUS Execute MM core successfully. Other Execute MM core failed.

Definition at line 493 of file StandaloneMmIplPei.c.

◆ FindLargestMmramRange()

VOID FindLargestMmramRange ( IN OUT UINTN LagestMmramRangeIndex,
IN EFI_MMRAM_HOB_DESCRIPTOR_BLOCK CurrentBlock 
)

Find largest unallocated MMRAM in current MMRAM descriptor block

Parameters
[in,out]LagestMmramRangeIndexLagest mmram range index.
[in]CurrentBlockCurrent MMRAM descriptor block.

Definition at line 356 of file StandaloneMmIplPei.c.

◆ LocateMmCoreFv()

EFI_STATUS LocateMmCoreFv ( OUT EFI_PHYSICAL_ADDRESS MmFvBase,
OUT UINTN MmFvSize,
OUT EFI_GUID MmCoreFileName,
OUT VOID **  MmCoreImageAddress 
)

Search all the available firmware volumes for MM Core driver.

Parameters
MmFvBaseBase address of FV which included MM Core driver.
MmFvSizeSize of FV which included MM Core driver.
MmCoreFileNameGUID of MM Core.
MmCoreImageAddressMM Core image address.
Return values
EFI_SUCCESSThe specified FFS section was returned.
EFI_NOT_FOUNDThe specified FFS section could not be found.

Definition at line 143 of file StandaloneMmIplPei.c.

◆ MmIplAllocateMmramPage()

EFI_PHYSICAL_ADDRESS MmIplAllocateMmramPage ( IN UINTN  Pages,
OUT EFI_MMRAM_HOB_DESCRIPTOR_BLOCK **  NewBlock 
)

Allocate available MMRAM for MM core image.

Parameters
[in]PagesPage count of MM core image.
[out]NewBlockPointer of new mmram block HOB.
Returns
EFI_PHYSICAL_ADDRESS Address for MM core image to be loaded in MMRAM.

Definition at line 409 of file StandaloneMmIplPei.c.

◆ MmIplBuildCommBufferHob()

MM_COMM_BUFFER * MmIplBuildCommBufferHob ( VOID  )

Build communication buffer HOB.

Returns
MM_COMM_BUFFER Pointer of MM communication buffer

Definition at line 687 of file StandaloneMmIplPei.c.

◆ MmIplDispatchMmDrivers()

EFI_STATUS MmIplDispatchMmDrivers ( VOID  )

Dispatch StandaloneMm drivers in MM.

StandaloneMm core will exit when MmEntryPoint was registered in CPU StandaloneMm driver, and issue a software SMI by communicate mode to dispatch other StandaloneMm drivers.

Return values
EFI_SUCCESSDispatch StandaloneMm drivers successfully.
OtherDispatch StandaloneMm drivers failed.

Definition at line 655 of file StandaloneMmIplPei.c.

◆ StandaloneMmIplPeiEntry()

EFI_STATUS EFIAPI StandaloneMmIplPeiEntry ( IN EFI_PEI_FILE_HANDLE  FileHandle,
IN CONST EFI_PEI_SERVICES **  PeiServices 
)

The Entry Point for MM IPL at PEI stage.

Load MM Core into MMRAM.

Parameters
FileHandleHandle of the file being invoked.
PeiServicesDescribes the list of possible PEI Services.
Return values
EFI_SUCCESSThe entry point is executed successfully.
OtherSome error occurred when executing this entry point.

Definition at line 753 of file StandaloneMmIplPei.c.

Variable Documentation

◆ mMmCommunicationPpi

EFI_PEI_MM_COMMUNICATION_PPI mMmCommunicationPpi = { Communicate }

Definition at line 11 of file StandaloneMmIplPei.c.

◆ mNotifyList

Initial value:
= {
EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST,
&gEfiEndOfPeiSignalPpiGuid,
}
EFI_STATUS EFIAPI EndOfPeiCallback(IN EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor, IN VOID *Ppi)

Definition at line 19 of file StandaloneMmIplPei.c.

◆ mPpiList

Initial value:
= {
(EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
&gEfiPeiMmCommunicationPpiGuid,
&mMmCommunicationPpi
}

Definition at line 13 of file StandaloneMmIplPei.c.