Due to AP cannot invoke any EFI API to allocate stack
memory region. so BSP needs to know the APs amount and
then could allocate stack spaces for them.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chen Fan <[email protected]>
---
 UefiCpuPkg/CpuDxe/CpuMp.c | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/UefiCpuPkg/CpuDxe/CpuMp.c b/UefiCpuPkg/CpuDxe/CpuMp.c
index 8cf711a..2d52b22 100644
--- a/UefiCpuPkg/CpuDxe/CpuMp.c
+++ b/UefiCpuPkg/CpuDxe/CpuMp.c
@@ -18,9 +18,10 @@
 VOID *mCommonStack = 0;
 VOID *mTopOfApCommonStack = 0;
 
+volatile UINTN   mNumberOfProcessors;
 
 /**
-  Application Processor C code entry point
+  Application Processor C code entry point.
 
 **/
 VOID
@@ -29,11 +30,19 @@ ApEntryPointInC (
   VOID
   )
 {
+  //
+  // AP initialization C code
+  //
+  mNumberOfProcessors++;
+
+  AsmApDoneWithCommonStack ();
+
+  CpuSleep ();
 }
 
 
 /**
-  Initialize Multi-processor support
+  Initialize Multi-processor support.
 
 **/
 VOID
@@ -41,5 +50,12 @@ InitializeMpSupport (
   VOID
   )
 {
+  mNumberOfProcessors = 1;
+
+  if (mNumberOfProcessors == 1) {
+    return;
+  }
+
+  DEBUG ((DEBUG_INFO, "Detect CPU count: %d\n", mNumberOfProcessors));
 }
 
-- 
1.9.3


------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to