NOTE: this patches is for testing temporary.
      So it should be ignore when adding to main tree.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chen Fan <[email protected]>
---
 UefiCpuPkg/CpuDxe/CpuDxe.c    |  2 ++
 UefiCpuPkg/CpuDxe/CpuDxe.inf  |  1 +
 UefiCpuPkg/CpuDxe/CpuMp.h     |  9 +++++
 UefiCpuPkg/CpuDxe/CpuMpTest.c | 76 +++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 88 insertions(+)
 create mode 100644 UefiCpuPkg/CpuDxe/CpuMpTest.c

diff --git a/UefiCpuPkg/CpuDxe/CpuDxe.c b/UefiCpuPkg/CpuDxe/CpuDxe.c
index c9df4e1..16e6bcc 100644
--- a/UefiCpuPkg/CpuDxe/CpuDxe.c
+++ b/UefiCpuPkg/CpuDxe/CpuDxe.c
@@ -900,6 +900,8 @@ InitializeCpu (
 
   InitializeMpSupport ();
 
+  AddTestMpService ();
+
   return Status;
 }
 
diff --git a/UefiCpuPkg/CpuDxe/CpuDxe.inf b/UefiCpuPkg/CpuDxe/CpuDxe.inf
index 9ec490d..fd838c0 100644
--- a/UefiCpuPkg/CpuDxe/CpuDxe.inf
+++ b/UefiCpuPkg/CpuDxe/CpuDxe.inf
@@ -52,6 +52,7 @@
   CpuGdt.h
   CpuMp.c
   CpuMp.h
+  CpuMpTest.c
 
 [Sources.IA32]
   Ia32/CpuAsm.asm | MSFT
diff --git a/UefiCpuPkg/CpuDxe/CpuMp.h b/UefiCpuPkg/CpuDxe/CpuMp.h
index 9161be1..963f2c1 100644
--- a/UefiCpuPkg/CpuDxe/CpuMp.h
+++ b/UefiCpuPkg/CpuDxe/CpuMp.h
@@ -603,5 +603,14 @@ WhoAmI (
   OUT UINTN                    *ProcessorNumber
   );
 
+/**
+  Initialize Mp Service Testing
+
+**/
+VOID
+AddTestMpService (
+  VOID
+  );
+
 #endif // _CPU_MP_H_
 
diff --git a/UefiCpuPkg/CpuDxe/CpuMpTest.c b/UefiCpuPkg/CpuDxe/CpuMpTest.c
new file mode 100644
index 0000000..fa8fb9b
--- /dev/null
+++ b/UefiCpuPkg/CpuDxe/CpuMpTest.c
@@ -0,0 +1,76 @@
+#include "CpuDxe.h"
+#include "CpuMp.h"
+
+VOID
+EFIAPI
+CheckTaskComplete (
+  IN  EFI_EVENT        Event,
+  IN  VOID             *Context
+  )
+{
+  DEBUG ((DEBUG_INFO, "All Client Task finished.\n"));
+}
+
+VOID
+EFIAPI
+ClientTask(
+  IN VOID* parameter
+  )
+{
+   DEBUG ((DEBUG_INFO, "I am Client Task!!!\n"));
+}
+
+/**
+  Initialize Mp Service Testing
+
+**/
+VOID
+AddTestMpService (
+  VOID
+  )
+{
+  EFI_STATUS Status;
+  EFI_MP_SERVICES_PROTOCOL *MpService;
+  UINTN WhoAmI;
+  UINTN NumberOfProcessors;
+  UINTN NumberOfEnabledProcessors;
+  EFI_EVENT WaitEvent;
+
+  Status = gBS->LocateProtocol(&gEfiMpServiceProtocolGuid,
+                               NULL,
+                               (void **) &MpService);
+  if (EFI_ERROR(Status)) {
+    DEBUG ((DEBUG_ERROR, "Install Mp Service fails\n"));
+    return;
+  }
+
+  Status = MpService->WhoAmI(MpService, &WhoAmI);
+  if (!EFI_ERROR(Status)) {
+    DEBUG ((DEBUG_INFO, "WhoAmI is : %d\n", WhoAmI));
+  }
+
+  Status = MpService->GetNumberOfProcessors (MpService,
+                                             &NumberOfProcessors,
+                                             &NumberOfEnabledProcessors
+                                             );
+  if (!EFI_ERROR(Status)) {
+    DEBUG ((DEBUG_INFO, "GetNumberOfProcessors : %d enabled: %d\n",
+                          NumberOfProcessors, NumberOfEnabledProcessors));
+  }
+
+  gBS->CreateEvent (
+         EVT_NOTIFY_SIGNAL,
+         TPL_CALLBACK,
+         CheckTaskComplete,
+         NULL,
+         &WaitEvent
+         );
+
+
+  Status = MpService->StartupAllAPs (MpService, ClientTask, TRUE, WaitEvent,
+                                     0, NULL, NULL);
+  if (EFI_ERROR(Status)) {
+     DEBUG ((DEBUG_ERROR, "FAILED.\n"));
+  }
+
+}
-- 
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