summaryrefslogtreecommitdiff
path: root/UefiCpuPkg/CpuDxe/CpuMp.c
diff options
context:
space:
mode:
authorChen Fan <chen.fan.fnst@cn.fujitsu.com>2014-11-13 18:26:03 +0000
committerjljusten <jljusten@Edk2>2014-11-13 18:26:03 +0000
commite343f8f7b35a400bb1d6e0edd7dddc53dd9e436d (patch)
tree24777603e62a813c94999fee7f1e1c9da5cba6f4 /UefiCpuPkg/CpuDxe/CpuMp.c
parent6a26a597a38d36c670a5c1ce0bf54c8a413a1868 (diff)
downloadedk2-platforms-e343f8f7b35a400bb1d6e0edd7dddc53dd9e436d.tar.xz
UefiCpuPkg/CpuDxe: Switch Ap Stack to NewStack
All APs use the same common stack to initialization. after initialization, APs should switch to the stack of its own. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Chen Fan <chen.fan.fnst@cn.fujitsu.com> Reviewed-by: Jeff Fan <jeff.fan@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16351 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'UefiCpuPkg/CpuDxe/CpuMp.c')
-rw-r--r--UefiCpuPkg/CpuDxe/CpuMp.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/UefiCpuPkg/CpuDxe/CpuMp.c b/UefiCpuPkg/CpuDxe/CpuMp.c
index bfd0d8d853..a87d67f180 100644
--- a/UefiCpuPkg/CpuDxe/CpuMp.c
+++ b/UefiCpuPkg/CpuDxe/CpuMp.c
@@ -25,6 +25,28 @@ VOID *mApStackStart = 0;
volatile UINTN mNumberOfProcessors;
/**
+ Application Processors do loop routine
+ after switch to its own stack.
+
+ @param Context1 A pointer to the context to pass into the function.
+ @param Context2 A pointer to the context to pass into the function.
+
+**/
+VOID
+ProcessorToIdleState (
+ IN VOID *Context1, OPTIONAL
+ IN VOID *Context2 OPTIONAL
+ )
+{
+ DEBUG ((DEBUG_INFO, "Ap apicid is %d\n", GetApicId ()));
+
+ AsmApDoneWithCommonStack ();
+
+ CpuSleep ();
+ CpuDeadLoop ();
+}
+
+/**
Application Processor C code entry point.
**/
@@ -35,6 +57,13 @@ ApEntryPointInC (
)
{
mNumberOfProcessors++;
+ mApStackStart = (UINT8*)mApStackStart + gApStackSize;
+
+ SwitchStack (
+ (SWITCH_STACK_ENTRY_POINT)(UINTN)ProcessorToIdleState,
+ NULL,
+ NULL,
+ mApStackStart);
}