[edk2] [RFC v3.1 06/17] UefiCpuPkg/CpuDxe: Startup APs

Subject: [edk2] [RFC v3.1 06/17] UefiCpuPkg/CpuDxe: Startup APs

From: Chen Fan <chen.fan.fnst@cn.fujitsu.com>

To: <edk2-devel@lists.sourceforge.net>

Date: 2014-09-20 01:43:12

  • 2014-09-20 01:43:12  Chen Fan   [edk2] [RFC v3.1 06/17] UefiCpuPkg/CpuDxe: Startup APs
From: Jordan Justen 

This sequence should happen:
* CpuMp.c: Allocate a stack for the APs
* ApStartup.c: Send Start IPI to wake APs in 16-bit real mode
* MpAsm.S: AP enters CpuDxe driver code without stack
  - AP grabs a lock
  - AP sets up stack
  - AP calls CpuMp.c:ApEntryPointInC

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen 
---
 UefiCpuPkg/CpuDxe/CpuMp.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/UefiCpuPkg/CpuDxe/CpuMp.c b/UefiCpuPkg/CpuDxe/CpuMp.c
index 8cf711a..f8d00df 100644
--- a/UefiCpuPkg/CpuDxe/CpuMp.c
+++ b/UefiCpuPkg/CpuDxe/CpuMp.c
@@ -41,5 +41,16 @@ InitializeMpSupport (
   VOID
   )
 {
+  mCommonStack = AllocatePages (EFI_SIZE_TO_PAGES (SIZE_64KB));
+  mTopOfApCommonStack = (VOID*) ((UINTN)mCommonStack + SIZE_64KB);
+  if (mCommonStack == NULL) {
+    return;
+  }
+
+  StartApsStackless (AsmApEntryPoint);
+
+  mTopOfApCommonStack = NULL;
+  FreePages (mCommonStack, EFI_SIZE_TO_PAGES (SIZE_64KB));
+  mCommonStack = NULL;
 }
 
-- 
1.9.3


------------------------------------------------------------------------------
Slashdot TV.  Video for Nerds.  Stuff that Matters.
http://pubads.g.doubleclick.net/gampad/clk?id=160591471&iu=/4140/ostg.clktrk
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel