Revision: 16397
http://sourceforge.net/p/edk2/code/16397
Author: lersek
Date: 2014-11-17 14:54:09 +0000 (Mon, 17 Nov 2014)
Log Message:
-----------
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 <[email protected]>
Tested-by: Gabriel Somlo <[email protected]>
Reviewed-by: Jordan Justen <[email protected]>
Reviewed-by: Jeff Fan <[email protected]>
Tested-by: Laszlo Ersek <[email protected]>
Modified Paths:
--------------
trunk/edk2/UefiCpuPkg/CpuDxe/CpuMp.c
Modified: trunk/edk2/UefiCpuPkg/CpuDxe/CpuMp.c
===================================================================
--- trunk/edk2/UefiCpuPkg/CpuDxe/CpuMp.c 2014-11-17 02:30:44 UTC (rev
16396)
+++ trunk/edk2/UefiCpuPkg/CpuDxe/CpuMp.c 2014-11-17 14:54:09 UTC (rev
16397)
@@ -20,7 +20,8 @@
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 @@
}
/**
+ 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 @@
(gMaxLogicalProcessorNumber -
mMpSystemData.NumberOfProcessors) *
gApStackSize));
}
+
+ Status = gBS->CreateEvent (
+ EVT_SIGNAL_EXIT_BOOT_SERVICES,
+ TPL_CALLBACK,
+ ExitBootServicesCallback,
+ NULL,
+ &mExitBootServicesEvent
+ );
+ ASSERT_EFI_ERROR (Status);
}
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits