Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chen Fan <[email protected]>
---
UefiCpuPkg/CpuDxe/CpuDxe.inf | 1 +
UefiCpuPkg/CpuDxe/CpuMp.c | 22 ++++++++++++++++++++++
UefiCpuPkg/CpuDxe/CpuMp.h | 2 ++
3 files changed, 25 insertions(+)
diff --git a/UefiCpuPkg/CpuDxe/CpuDxe.inf b/UefiCpuPkg/CpuDxe/CpuDxe.inf
index cee3506..cc4962e 100644
--- a/UefiCpuPkg/CpuDxe/CpuDxe.inf
+++ b/UefiCpuPkg/CpuDxe/CpuDxe.inf
@@ -65,6 +65,7 @@
[Protocols]
gEfiCpuArchProtocolGuid
+ gEfiMpServiceProtocolGuid
[Guids]
gIdleLoopEventGuid ## CONSUMES ## GUID
diff --git a/UefiCpuPkg/CpuDxe/CpuMp.c b/UefiCpuPkg/CpuDxe/CpuMp.c
index 2f3516b..398426d 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;
@@ -25,6 +27,17 @@ UINTN mNumberOfProcessors;
BOOLEAN mAllApsInitFinished = FALSE;
UINTN mApDoneCount = 0;
+
+EFI_MP_SERVICES_PROTOCOL mMpServicesTemplate = {
+ NULL, // GetNumberOfProcessors,
+ NULL, // GetProcessorInfo,
+ NULL, // StartupAllAps,
+ NULL, // StartupThisAP,
+ NULL, // SwitchBSP,
+ NULL, // EnableDisableAP,
+ NULL // WhoAmI
+};
+
VOID
ProcessorToIdleState (
IN VOID *Context1 OPTIONAL,
@@ -72,6 +85,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) {
@@ -97,6 +112,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 69731f7..889b10a 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
#define STALL_100_MILLI_SECOND (1000 * 100)
--
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