]> git.proxmox.com Git - mirror_edk2.git/blobdiff - UefiCpuPkg/CpuDxe/CpuMp.h
MdePkg: Add definition for new warning code EFI_WARN_FILE_SYSTEM.
[mirror_edk2.git] / UefiCpuPkg / CpuDxe / CpuMp.h
index 2b3b9b23d4c28bdf50289f902b66cc2f55814088..503f3ae944fe850e1a2afeeb15aa6604ef2e0242 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   CPU DXE MP support\r
 \r
-  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
 #ifndef _CPU_MP_H_\r
 #define _CPU_MP_H_\r
 \r
+#include <Ppi/SecPlatformInformation.h>\r
+#include <Ppi/SecPlatformInformation2.h>\r
 #include <Protocol/MpService.h>\r
 #include <Library/SynchronizationLib.h>\r
+#include <Library/HobLib.h>\r
+#include <Library/ReportStatusCodeLib.h>\r
 \r
 /**\r
   Initialize Multi-processor support.\r
@@ -40,15 +44,12 @@ VOID
   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
@@ -82,8 +83,9 @@ typedef enum {
   CpuStateIdle,\r
   CpuStateBlocked,\r
   CpuStateReady,\r
-  CpuStateBuzy,\r
-  CpuStateFinished\r
+  CpuStateBusy,\r
+  CpuStateFinished,\r
+  CpuStateSleeping\r
 } CPU_STATE;\r
 \r
 /**\r
@@ -93,15 +95,17 @@ typedef enum {
 typedef struct {\r
   EFI_PROCESSOR_INFORMATION      Info;\r
   SPIN_LOCK                      CpuDataLock;\r
+  INTN                           LockSelf;\r
   volatile CPU_STATE             State;\r
 \r
-  EFI_AP_PROCEDURE               Procedure;\r
-  VOID                           *Parameter;\r
+  volatile EFI_AP_PROCEDURE      Procedure;\r
+  volatile VOID*                 Parameter;\r
   BOOLEAN                        *Finished;\r
   INTN                           Timeout;\r
   EFI_EVENT                      WaitEvent;\r
   BOOLEAN                        TimeoutActive;\r
   EFI_EVENT                      CheckThisAPEvent;\r
+  VOID                           *TopOfStack;\r
 } CPU_DATA_BLOCK;\r
 \r
 /**\r
@@ -465,6 +469,49 @@ StartupThisAP (
   OUT BOOLEAN                   *Finished               OPTIONAL\r
   );\r
 \r
+/**\r
+  This service switches the requested AP to be the BSP from that point onward.\r
+  This service changes the BSP for all purposes.   This call can only be performed\r
+  by the current BSP.\r
+\r
+  This service switches the requested AP to be the BSP from that point onward.\r
+  This service changes the BSP for all purposes. The new BSP can take over the\r
+  execution of the old BSP and continue seamlessly from where the old one left\r
+  off. This service may not be supported after the UEFI Event EFI_EVENT_GROUP_READY_TO_BOOT\r
+  is signaled.\r
+\r
+  If the BSP cannot be switched prior to the return from this service, then\r
+  EFI_UNSUPPORTED must be returned.\r
+\r
+  @param[in] This              A pointer to the EFI_MP_SERVICES_PROTOCOL instance.\r
+  @param[in] ProcessorNumber   The handle number of AP that is to become the new\r
+                               BSP. The range is from 0 to the total number of\r
+                               logical processors minus 1. The total number of\r
+                               logical processors can be retrieved by\r
+                               EFI_MP_SERVICES_PROTOCOL.GetNumberOfProcessors().\r
+  @param[in] EnableOldBSP      If TRUE, then the old BSP will be listed as an\r
+                               enabled AP. Otherwise, it will be disabled.\r
+\r
+  @retval EFI_SUCCESS             BSP successfully switched.\r
+  @retval EFI_UNSUPPORTED         Switching the BSP cannot be completed prior to\r
+                                  this service returning.\r
+  @retval EFI_UNSUPPORTED         Switching the BSP is not supported.\r
+  @retval EFI_SUCCESS             The calling processor is an AP.\r
+  @retval EFI_NOT_FOUND           The processor with the handle specified by\r
+                                  ProcessorNumber does not exist.\r
+  @retval EFI_INVALID_PARAMETER   ProcessorNumber specifies the current BSP or\r
+                                  a disabled AP.\r
+  @retval EFI_NOT_READY           The specified AP is busy.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+SwitchBSP (\r
+  IN EFI_MP_SERVICES_PROTOCOL  *This,\r
+  IN  UINTN                    ProcessorNumber,\r
+  IN  BOOLEAN                  EnableOldBSP\r
+  );\r
+\r
 /**\r
   This service lets the caller enable or disable an AP from this point onward.\r
   This service may only be called from the BSP.\r
@@ -560,5 +607,54 @@ ResetProcessorToIdleState (
   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
+/**\r
+  Resets the Application Processor and directs it 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 ProcessorId           the AP of ProcessorId was reset\r
+**/\r
+VOID\r
+ResetApStackless (\r
+  IN UINT32 ProcessorId\r
+  );\r
+\r
+/**\r
+  A minimal wrapper function that allows MtrrSetAllMtrrs() to be passed to\r
+  EFI_MP_SERVICES_PROTOCOL.StartupAllAPs() as Procedure.\r
+\r
+  @param[in] Buffer  Pointer to an MTRR_SETTINGS object, to be passed to\r
+                     MtrrSetAllMtrrs().\r
+**/\r
+VOID\r
+EFIAPI\r
+SetMtrrsFromBuffer (\r
+  IN VOID *Buffer\r
+  );\r
+\r
 #endif // _CPU_MP_H_\r
 \r