From 6dc05093a097aada0da99aa9b84dfe7fc6ef02c8 Mon Sep 17 00:00:00 2001 From: Jeff Fan Date: Thu, 21 Jul 2016 16:33:11 +0800 Subject: 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 Cc: Feng Tian Cc: Giri P Mudusuru Cc: Laszlo Ersek Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jeff Fan Reviewed-by: Michael Kinney Tested-by: Laszlo Ersek Tested-by: Michael Kinney --- UefiCpuPkg/Library/MpInitLib/MpLib.h | 20 +++++++++++++++ UefiCpuPkg/Library/MpInitLib/PeiMpLib.c | 43 +++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) (limited to 'UefiCpuPkg/Library') diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.h b/UefiCpuPkg/Library/MpInitLib/MpLib.h index d3ccac8d06..f56023786f 100644 --- a/UefiCpuPkg/Library/MpInitLib/MpLib.h +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.h @@ -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 diff --git a/UefiCpuPkg/Library/MpInitLib/PeiMpLib.c b/UefiCpuPkg/Library/MpInitLib/PeiMpLib.c index 6211e71795..72791b5617 100644 --- a/UefiCpuPkg/Library/MpInitLib/PeiMpLib.c +++ b/UefiCpuPkg/Library/MpInitLib/PeiMpLib.c @@ -13,6 +13,17 @@ **/ #include "MpLib.h" +#include +#include + +// +// 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); } /** -- cgit v1.2.3