diff options
author | Chen Fan <chen.fan.fnst@cn.fujitsu.com> | 2014-11-17 14:54:09 +0000 |
---|---|---|
committer | lersek <lersek@Edk2> | 2014-11-17 14:54:09 +0000 |
commit | 9840b1299de78458a42d35b8d1d6cbadd1f6da72 (patch) | |
tree | a7f9d0e1e6a8d8fc6590834ad42ebaecc49b1815 /UefiCpuPkg/CpuDxe/CpuMp.c | |
parent | f44200276423fdfbce4ddb4ba118b7efa8d2385a (diff) | |
download | edk2-9840b1299de78458a42d35b8d1d6cbadd1f6da72.tar.gz edk2-9840b1299de78458a42d35b8d1d6cbadd1f6da72.tar.bz2 edk2-9840b1299de78458a42d35b8d1d6cbadd1f6da72.zip |
UefiCpuPkg/CpuDxe: Put APs in wait for SIPI state at ExitBootServices
when gBS->ExitBootServices() is called, the APs should avoid to access
the unsafed buff datas which were allocated by boot services.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chen Fan <chen.fan.fnst@cn.fujitsu.com>
Tested-by: Gabriel Somlo <somlo@cmu.edu>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16397 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'UefiCpuPkg/CpuDxe/CpuMp.c')
-rw-r--r-- | UefiCpuPkg/CpuDxe/CpuMp.c | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/UefiCpuPkg/CpuDxe/CpuMp.c b/UefiCpuPkg/CpuDxe/CpuMp.c index f864de1f6f..b65300c773 100644 --- a/UefiCpuPkg/CpuDxe/CpuMp.c +++ b/UefiCpuPkg/CpuDxe/CpuMp.c @@ -20,7 +20,8 @@ UINTN gApStackSize; UINTN gPollInterval = 100; // 100 microseconds
MP_SYSTEM_DATA mMpSystemData;
-EFI_HANDLE mMpServiceHandle = NULL;
+EFI_HANDLE mMpServiceHandle = NULL;
+EFI_EVENT mExitBootServicesEvent = (EFI_EVENT)NULL;
VOID *mCommonStack = 0;
VOID *mTopOfApCommonStack = 0;
@@ -1465,6 +1466,28 @@ InitMpSystemData ( }
/**
+ Callback function for ExitBootServices.
+
+ @param Event Event whose notification function is being invoked.
+ @param Context The pointer to the notification function's context,
+ which is implementation-dependent.
+
+**/
+VOID
+EFIAPI
+ExitBootServicesCallback (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
+ //
+ // Avoid APs access invalid buff datas which allocated by BootServices,
+ // so we send INIT IPI to APs to let them wait for SIPI state.
+ //
+ SendInitIpiAllExcludingSelf ();
+}
+
+/**
Initialize Multi-processor support.
**/
@@ -1531,4 +1554,13 @@ InitializeMpSupport ( (gMaxLogicalProcessorNumber - mMpSystemData.NumberOfProcessors) *
gApStackSize));
}
+
+ Status = gBS->CreateEvent (
+ EVT_SIGNAL_EXIT_BOOT_SERVICES,
+ TPL_CALLBACK,
+ ExitBootServicesCallback,
+ NULL,
+ &mExitBootServicesEvent
+ );
+ ASSERT_EFI_ERROR (Status);
}
|