UefiCpuPkg/MpInitLib: Register one End of PEI callback function

In PeiMpInitLib, register End of PEI callback function CpuMpEndOfPeiCallback().

v5:
  1. Add comment block for mMpInitLibNotifyList.

Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Cc: Giri P Mudusuru <giri.p.mudusuru@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Michael Kinney <michael.d.kinney@intel.com>
This commit is contained in:
Jeff Fan 2016-07-21 16:33:11 +08:00
parent 93ca4c0fd7
commit 6dc05093a0
2 changed files with 63 additions and 0 deletions

View File

@ -290,5 +290,25 @@ MicrocodeDetect (
IN CPU_MP_DATA *CpuMpData
);
/**
Notify function on End Of PEI PPI.
On S3 boot, this function will restore wakeup buffer data.
On normal boot, this function will flag wakeup buffer to be un-used type.
@param[in] PeiServices The pointer to the PEI Services Table.
@param[in] NotifyDescriptor Address of the notification descriptor data structure.
@param[in] Ppi Address of the PPI that was installed.
@retval EFI_SUCCESS When everything is OK.
**/
EFI_STATUS
EFIAPI
CpuMpEndOfPeiCallback (
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,
IN VOID *Ppi
);
#endif

View File

@ -13,6 +13,17 @@
**/
#include "MpLib.h"
#include <Ppi/EndOfPeiPhase.h>
#include <Library/PeiServicesLib.h>
//
// Global PEI notify function descriptor on EndofPei event
//
GLOBAL_REMOVE_IF_UNREFERENCED EFI_PEI_NOTIFY_DESCRIPTOR mMpInitLibNotifyList = {
(EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
&gEfiEndOfPeiSignalPpiGuid,
CpuMpEndOfPeiCallback
};
/**
Get pointer to CPU MP Data structure.
@ -54,6 +65,32 @@ SaveCpuMpData (
}
/**
/**
Notify function on End Of PEI PPI.
On S3 boot, this function will restore wakeup buffer data.
On normal boot, this function will flag wakeup buffer to be un-used type.
@param[in] PeiServices The pointer to the PEI Services Table.
@param[in] NotifyDescriptor Address of the notification descriptor data structure.
@param[in] Ppi Address of the PPI that was installed.
@retval EFI_SUCCESS When everything is OK.
**/
EFI_STATUS
EFIAPI
CpuMpEndOfPeiCallback (
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,
IN VOID *Ppi
)
{
DEBUG ((DEBUG_INFO, "PeiMpInitLib: CpuMpEndOfPeiCallback () invoked\n"));
return EFI_SUCCESS;
}
/**
Initialize global data for MP support.
@ -64,8 +101,14 @@ InitMpGlobalData (
IN CPU_MP_DATA *CpuMpData
)
{
EFI_STATUS Status;
SaveCpuMpData (CpuMpData);
//
// Register an event for EndOfPei
//
Status = PeiServicesNotifyPpi (&mMpInitLibNotifyList);
ASSERT_EFI_ERROR (Status);
}
/**