]> git.proxmox.com Git - mirror_edk2.git/commitdiff
UefiCpuPkg/CpuDxe: Switch Ap Stack to NewStack
authorChen Fan <chen.fan.fnst@cn.fujitsu.com>
Thu, 13 Nov 2014 18:26:03 +0000 (18:26 +0000)
committerjljusten <jljusten@Edk2>
Thu, 13 Nov 2014 18:26:03 +0000 (18:26 +0000)
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

UefiCpuPkg/CpuDxe/CpuMp.c

index bfd0d8d8535c556b5f434af84a4b1a7cc1b86d0e..a87d67f180e296d45d05d5a1909d7d8871fb773e 100644 (file)
@@ -24,6 +24,28 @@ VOID *mApStackStart = 0;
 \r
 volatile UINTN mNumberOfProcessors;\r
 \r
+/**\r
+  Application Processors do loop routine\r
+  after switch to its own stack.\r
+\r
+  @param  Context1    A pointer to the context to pass into the function.\r
+  @param  Context2    A pointer to the context to pass into the function.\r
+\r
+**/\r
+VOID\r
+ProcessorToIdleState (\r
+  IN      VOID                      *Context1,  OPTIONAL\r
+  IN      VOID                      *Context2   OPTIONAL\r
+  )\r
+{\r
+  DEBUG ((DEBUG_INFO, "Ap apicid is %d\n", GetApicId ()));\r
+\r
+  AsmApDoneWithCommonStack ();\r
+\r
+  CpuSleep ();\r
+  CpuDeadLoop ();\r
+}\r
+\r
 /**\r
   Application Processor C code entry point.\r
 \r
@@ -35,6 +57,13 @@ ApEntryPointInC (
   )\r
 {\r
   mNumberOfProcessors++;\r
+  mApStackStart = (UINT8*)mApStackStart + gApStackSize;\r
+\r
+  SwitchStack (\r
+    (SWITCH_STACK_ENTRY_POINT)(UINTN)ProcessorToIdleState,\r
+    NULL,\r
+    NULL,\r
+    mApStackStart);\r
 }\r
 \r
 \r