]> git.proxmox.com Git - mirror_edk2.git/blobdiff - UefiCpuPkg/CpuDxe/CpuMp.h
UefiCpuPkg/CpuDxe: introduce MP_SYSTEM_DATA for Mp Service Protocol
[mirror_edk2.git] / UefiCpuPkg / CpuDxe / CpuMp.h
index 93d054002a3931bfe8a34303f2a4d3365dd7b093..481f7b16183527af8d181e9ceec984fb1a8638ac 100644 (file)
@@ -15,6 +15,9 @@
 #ifndef _CPU_MP_H_\r
 #define _CPU_MP_H_\r
 \r
+#include <Protocol/MpService.h>\r
+#include <Library/SynchronizationLib.h>\r
+\r
 /**\r
   Initialize Multi-processor support.\r
 \r
@@ -24,5 +27,102 @@ InitializeMpSupport (
   VOID\r
   );\r
 \r
+typedef\r
+VOID\r
+(EFIAPI *STACKLESS_AP_ENTRY_POINT)(\r
+  VOID\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
+  @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
+  );\r
+\r
+/**\r
+  The AP entry point that the Startup-IPI target code will jump to.\r
+\r
+  The processor jumps to this code in flat mode, but the processor's\r
+  stack is not initialized.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+AsmApEntryPoint (\r
+  VOID\r
+  );\r
+\r
+/**\r
+  Releases the lock preventing other APs from using the shared AP\r
+  stack.\r
+\r
+  Once the AP has transitioned to using a new stack, it can call this\r
+  function to allow another AP to proceed with using the shared stack.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+AsmApDoneWithCommonStack (\r
+  VOID\r
+  );\r
+\r
+typedef enum {\r
+  CpuStateIdle,\r
+  CpuStateBlocked,\r
+  CpuStateReady,\r
+  CpuStateBuzy,\r
+  CpuStateFinished\r
+} CPU_STATE;\r
+\r
+/**\r
+  Define Individual Processor Data block.\r
+\r
+**/\r
+typedef struct {\r
+  EFI_PROCESSOR_INFORMATION      Info;\r
+  SPIN_LOCK                      CpuDataLock;\r
+  volatile CPU_STATE             State;\r
+\r
+  EFI_AP_PROCEDURE               Procedure;\r
+  VOID                           *Parameter;\r
+} CPU_DATA_BLOCK;\r
+\r
+/**\r
+  Define MP data block which consumes individual processor block.\r
+\r
+**/\r
+typedef struct {\r
+  CPU_DATA_BLOCK              *CpuDatas;\r
+  UINTN                       NumberOfProcessors;\r
+  UINTN                       NumberOfEnabledProcessors;\r
+} MP_SYSTEM_DATA;\r
+\r
+/**\r
+  This function is called by all processors (both BSP and AP) once and collects MP related data.\r
+\r
+  @param Bsp             TRUE if the CPU is BSP\r
+  @param ProcessorNumber The specific processor number\r
+\r
+  @retval EFI_SUCCESS    Data for the processor collected and filled in\r
+\r
+**/\r
+EFI_STATUS\r
+FillInProcessorInformation (\r
+  IN     BOOLEAN              Bsp,\r
+  IN     UINTN                ProcessorNumber\r
+  );\r
+\r
 #endif // _CPU_MP_H_\r
 \r