summaryrefslogtreecommitdiff
path: root/UefiCpuPkg
diff options
context:
space:
mode:
authorJeff Fan <jeff.fan@intel.com>2016-07-21 16:56:51 +0800
committerJeff Fan <jeff.fan@intel.com>2016-08-17 20:00:44 +0800
commit963788618b043907ead2ed34ba3a4f3a65142116 (patch)
tree0f1ba1e5f575e0ca76e3c68949aa89b169717bf7 /UefiCpuPkg
parent6dc05093a097aada0da99aa9b84dfe7fc6ef02c8 (diff)
downloadedk2-platforms-963788618b043907ead2ed34ba3a4f3a65142116.tar.xz
UefiCpuPkg/MpInitLib: Register one period event to check APs status
In DxeMpInitLib, register one period event callback function CheckAPsStatus() used to check AP Status. v5: 1. Introduce AP_CHECK_INTERVAL for adjust AP check timer interval potential. v3: 1. Use CamelCase for mCheckAllAPsEvent, mStopCheckAllApsStatus and CheckAndUpdateApsStatus(). 2. Move SetTimer() from Patch #17 to Patch 16. 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: Giri P Mudusuru <giri.p.mudusuru@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>
Diffstat (limited to 'UefiCpuPkg')
-rw-r--r--UefiCpuPkg/Library/MpInitLib/DxeMpLib.c66
1 files changed, 66 insertions, 0 deletions
diff --git a/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c b/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c
index e294612f14..2d8bf25b0a 100644
--- a/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c
+++ b/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c
@@ -13,7 +13,16 @@
**/
#include "MpLib.h"
+
+#include <Library/UefiLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+
+#define AP_CHECK_INTERVAL (EFI_TIMER_PERIOD_MILLISECONDS (100))
+
CPU_MP_DATA *mCpuMpData = NULL;
+EFI_EVENT mCheckAllApsEvent = NULL;
+volatile BOOLEAN mStopCheckAllApsStatus = TRUE;
+
/**
Get the pointer to CPU MP Data structure.
@@ -43,6 +52,43 @@ SaveCpuMpData (
}
/**
+/**
+ Checks APs status and updates APs status if needed.
+
+**/
+VOID
+CheckAndUpdateApsStatus (
+ VOID
+ )
+{
+}
+
+/**
+ Checks APs' status periodically.
+
+ This function is triggerred by timer perodically to check the
+ state of APs for StartupAllAPs() and StartupThisAP() executed
+ in non-blocking mode.
+
+ @param[in] Event Event triggered.
+ @param[in] Context Parameter passed with the event.
+
+**/
+VOID
+EFIAPI
+CheckApsStatus (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
+ //
+ // If CheckApsStatus() is not stopped, otherwise return immediately.
+ //
+ if (!mStopCheckAllApsStatus) {
+ CheckAndUpdateApsStatus ();
+ }
+}
+/**
Initialize global data for MP support.
@param[in] CpuMpData The pointer to CPU MP Data structure.
@@ -52,8 +98,28 @@ InitMpGlobalData (
IN CPU_MP_DATA *CpuMpData
)
{
+ EFI_STATUS Status;
+
SaveCpuMpData (CpuMpData);
+ Status = gBS->CreateEvent (
+ EVT_TIMER | EVT_NOTIFY_SIGNAL,
+ TPL_NOTIFY,
+ CheckApsStatus,
+ NULL,
+ &mCheckAllApsEvent
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ //
+ // Set timer to check all APs status.
+ //
+ Status = gBS->SetTimer (
+ mCheckAllApsEvent,
+ TimerPeriodic,
+ AP_CHECK_INTERVAL
+ );
+ ASSERT_EFI_ERROR (Status);
}
/**