]> git.proxmox.com Git - mirror_edk2.git/blobdiff - UefiCpuPkg/CpuDxe/CpuMp.c
UefiCpuPkg/CpuDxe: introduce EFI_MP_SERVICES_PROTOCOL
[mirror_edk2.git] / UefiCpuPkg / CpuDxe / CpuMp.c
index bfd0d8d8535c556b5f434af84a4b1a7cc1b86d0e..e3734c27908bd31199c2e22ba5df309440441f6a 100644 (file)
@@ -24,6 +24,38 @@ VOID *mApStackStart = 0;
 \r
 volatile UINTN mNumberOfProcessors;\r
 \r
+EFI_MP_SERVICES_PROTOCOL  mMpServicesTemplate = {\r
+  NULL, // GetNumberOfProcessors,\r
+  NULL, // GetProcessorInfo,\r
+  NULL, // StartupAllAPs,\r
+  NULL, // StartupThisAP,\r
+  NULL, // SwitchBSP,\r
+  NULL, // EnableDisableAP,\r
+  NULL  // WhoAmI\r
+};\r
+\r
+/**\r
+  Application Processors do loop routine\r
+  after switch to its own stack.\r
+\r
+  @param  Context1    A pointer to the context to pass into the function.\r
+  @param  Context2    A pointer to the context to pass into the function.\r
+\r
+**/\r
+VOID\r
+ProcessorToIdleState (\r
+  IN      VOID                      *Context1,  OPTIONAL\r
+  IN      VOID                      *Context2   OPTIONAL\r
+  )\r
+{\r
+  DEBUG ((DEBUG_INFO, "Ap apicid is %d\n", GetApicId ()));\r
+\r
+  AsmApDoneWithCommonStack ();\r
+\r
+  CpuSleep ();\r
+  CpuDeadLoop ();\r
+}\r
+\r
 /**\r
   Application Processor C code entry point.\r
 \r
@@ -35,6 +67,13 @@ ApEntryPointInC (
   )\r
 {\r
   mNumberOfProcessors++;\r
+  mApStackStart = (UINT8*)mApStackStart + gApStackSize;\r
+\r
+  SwitchStack (\r
+    (SWITCH_STACK_ENTRY_POINT)(UINTN)ProcessorToIdleState,\r
+    NULL,\r
+    NULL,\r
+    mApStackStart);\r
 }\r
 \r
 \r