\r
};\r
\r
+volatile STARTUP_CODE *StartupCode = NULL;\r
\r
/**\r
- Starts the Application Processors and directs them to jump to the\r
- specified routine.\r
-\r
- The processor jumps to this code in flat mode, but the processor's\r
- stack is not initialized.\r
-\r
- @param ApEntryPoint Pointer to the Entry Point routine\r
+ Prepares Startup Code for APs.\r
+ This function prepares Startup Code for APs.\r
\r
@retval EFI_SUCCESS The APs were started\r
@retval EFI_OUT_OF_RESOURCES Cannot allocate memory to start APs\r
\r
**/\r
EFI_STATUS\r
-StartApsStackless (\r
- IN STACKLESS_AP_ENTRY_POINT ApEntryPoint\r
+PrepareAPStartupCode (\r
+ VOID\r
)\r
{\r
EFI_STATUS Status;\r
- volatile STARTUP_CODE *StartupCode;\r
IA32_DESCRIPTOR Gdtr;\r
EFI_PHYSICAL_ADDRESS StartAddress;\r
\r
StartupCode->GdtLimit = Gdtr.Limit;\r
StartupCode->GdtBase = (UINT32) Gdtr.Base;\r
\r
- StartupCode->CpuDxeEntryValue = (UINTN) ApEntryPoint;\r
+ StartupCode->CpuDxeEntryValue = (UINTN) AsmApEntryPoint;\r
\r
StartupCode->FlatJmpOffset += (UINT32) StartAddress;\r
\r
StartupCode->LongJmpOffset += (UINT32) StartAddress;\r
#endif\r
\r
- SendInitSipiSipiAllExcludingSelf ((UINT32)(UINTN)(VOID*) StartupCode);\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+/**\r
+ Free the code buffer of startup AP.\r
+\r
+**/\r
+VOID\r
+FreeApStartupCode (\r
+ VOID\r
+ )\r
+{\r
+ if (StartupCode != NULL) {\r
+ gBS->FreePages ((EFI_PHYSICAL_ADDRESS)(UINTN)(VOID*) StartupCode,\r
+ EFI_SIZE_TO_PAGES (sizeof (*StartupCode)));\r
+ }\r
+}\r
\r
+\r
+/**\r
+ Starts the Application Processors and directs them to jump to the\r
+ specified routine.\r
+\r
+ The processor jumps to this code in flat mode, but the processor's\r
+ stack is not initialized.\r
+\r
+ @retval EFI_SUCCESS The APs were started\r
+\r
+**/\r
+EFI_STATUS\r
+StartApsStackless (\r
+ VOID\r
+ )\r
+{\r
+ SendInitSipiSipiAllExcludingSelf ((UINT32)(UINTN)(VOID*) StartupCode);\r
//\r
// Wait 100 milliseconds for APs to arrive at the ApEntryPoint routine\r
//\r
MicroSecondDelay (100 * 1000);\r
\r
- gBS->FreePages (StartAddress, EFI_SIZE_TO_PAGES (sizeof (*StartupCode)));\r
-\r
return EFI_SUCCESS;\r
}\r
\r
The processor jumps to this code in flat mode, but the processor's\r
stack is not initialized.\r
\r
- @param ApEntryPoint Pointer to the Entry Point routine\r
-\r
@retval EFI_SUCCESS The APs were started\r
- @retval EFI_OUT_OF_RESOURCES Cannot allocate memory to start APs\r
\r
**/\r
EFI_STATUS\r
StartApsStackless (\r
- IN STACKLESS_AP_ENTRY_POINT ApEntryPoint\r
+ VOID\r
);\r
\r
/**\r
IN CPU_DATA_BLOCK *CpuData\r
);\r
\r
+/**\r
+ Prepares Startup Code for APs.\r
+ This function prepares Startup Code for APs.\r
+\r
+ @retval EFI_SUCCESS The APs were started\r
+ @retval EFI_OUT_OF_RESOURCES Cannot allocate memory to start APs\r
+\r
+**/\r
+EFI_STATUS\r
+PrepareAPStartupCode (\r
+ VOID\r
+ );\r
+\r
+/**\r
+ Free the code buffer of startup AP.\r
+\r
+**/\r
+VOID\r
+FreeApStartupCode (\r
+ VOID\r
+ );\r
+\r
#endif // _CPU_MP_H_\r
\r