Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chen Fan <[email protected]>
---
 UefiCpuPkg/CpuDxe/CpuDxe.inf |  1 +
 UefiCpuPkg/CpuDxe/CpuMp.c    | 21 +++++++++++++++++++++
 UefiCpuPkg/CpuDxe/CpuMp.h    |  2 ++
 3 files changed, 24 insertions(+)

diff --git a/UefiCpuPkg/CpuDxe/CpuDxe.inf b/UefiCpuPkg/CpuDxe/CpuDxe.inf
index 058e9a6..f73b845 100644
--- a/UefiCpuPkg/CpuDxe/CpuDxe.inf
+++ b/UefiCpuPkg/CpuDxe/CpuDxe.inf
@@ -65,6 +65,7 @@
 
 [Protocols]
   gEfiCpuArchProtocolGuid                       ## PRODUCES
+  gEfiMpServiceProtocolGuid                     ## PRODUCES
 
 [Guids]
   gIdleLoopEventGuid                            ## CONSUMES           ## Event
diff --git a/UefiCpuPkg/CpuDxe/CpuMp.c b/UefiCpuPkg/CpuDxe/CpuMp.c
index 9a9c26c..3bf9850 100644
--- a/UefiCpuPkg/CpuDxe/CpuMp.c
+++ b/UefiCpuPkg/CpuDxe/CpuMp.c
@@ -15,6 +15,8 @@
 #include "CpuDxe.h"
 #include "CpuMp.h"
 
+EFI_HANDLE mMpServiceHandle = NULL;
+
 VOID *mCommonStack = 0;
 VOID *mTopOfApCommonStack = 0;
 VOID *mApStackStart = 0;
@@ -27,6 +29,16 @@ UINTN volatile mApDoneCount = 0;
 
 CPU_EXCHANGE_DATA mCpuExchangeData;
 
+EFI_MP_SERVICES_PROTOCOL  mMpServicesTemplate = {
+  NULL, // GetNumberOfProcessors,
+  NULL, // GetProcessorInfo,
+  NULL, // StartupAllAps,
+  NULL, // StartupThisAP,
+  NULL, // SwitchBSP,
+  NULL, // EnableDisableAP,
+  NULL  // WhoAmI
+};
+
 /**
   Application Processors do loop routine
   after swtich to its own stack
@@ -80,6 +92,8 @@ InitializeMpSupport (
   VOID
   )
 {
+  EFI_STATUS Status;
+
   mCommonStack = AllocatePages (EFI_SIZE_TO_PAGES (AP_STACK_SIZE));
   mTopOfApCommonStack = (VOID*) ((UINTN)mCommonStack + AP_STACK_SIZE);
   if (mCommonStack == NULL) {
@@ -106,6 +120,13 @@ InitializeMpSupport (
 
   while (mApDoneCount != (mNumberOfProcessors - 1));
 
+  Status = gBS->InstallMultipleProtocolInterfaces (
+                  &mMpServiceHandle,
+                  &gEfiMpServiceProtocolGuid,  &mMpServicesTemplate,
+                  NULL
+                  );
+  ASSERT_EFI_ERROR (Status);
+
 EXIT:
   mTopOfApCommonStack = NULL;
   FreePages (mCommonStack, EFI_SIZE_TO_PAGES (AP_STACK_SIZE));
diff --git a/UefiCpuPkg/CpuDxe/CpuMp.h b/UefiCpuPkg/CpuDxe/CpuMp.h
index 6f0620e..6d9f2a6 100644
--- a/UefiCpuPkg/CpuDxe/CpuMp.h
+++ b/UefiCpuPkg/CpuDxe/CpuMp.h
@@ -15,6 +15,8 @@
 #ifndef _CPU_MP_H_
 #define _CPU_MP_H_
 
+#include <Protocol/MpService.h>
+
 #define AP_STACK_SIZE      SIZE_64KB
 
 /**
-- 
1.9.3


------------------------------------------------------------------------------
Want excitement?
Manually upgrade your production database.
When you want reliability, choose Perforce
Perforce version control. Predictably reliable.
http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to