MpServices2.h 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. /** @file
  2. This file declares EDKII Multi-processor service PPI.
  3. Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
  4. SPDX-License-Identifier: BSD-2-Clause-Patent
  5. **/
  6. #ifndef __EDKII_PEI_MP_SERVICES2_PPI_H__
  7. #define __EDKII_PEI_MP_SERVICES2_PPI_H__
  8. #include <Ppi/MpServices.h>
  9. #define EDKII_PEI_MP_SERVICES2_PPI_GUID \
  10. { \
  11. 0x5cb9cb3d, 0x31a4, 0x480c, { 0x94, 0x98, 0x29, 0xd2, 0x69, 0xba, 0xcf, 0xba} \
  12. }
  13. typedef struct _EDKII_PEI_MP_SERVICES2_PPI EDKII_PEI_MP_SERVICES2_PPI;
  14. /**
  15. Get the number of CPU's.
  16. @param[in] This Pointer to this instance of the PPI.
  17. @param[out] NumberOfProcessors Pointer to the total number of logical processors in
  18. the system, including the BSP and disabled APs.
  19. @param[out] NumberOfEnabledProcessors
  20. Number of processors in the system that are enabled.
  21. @retval EFI_SUCCESS The number of logical processors and enabled
  22. logical processors was retrieved.
  23. @retval EFI_DEVICE_ERROR The calling processor is an AP.
  24. @retval EFI_INVALID_PARAMETER NumberOfProcessors is NULL.
  25. NumberOfEnabledProcessors is NULL.
  26. **/
  27. typedef
  28. EFI_STATUS
  29. (EFIAPI *EDKII_PEI_MP_SERVICES_GET_NUMBER_OF_PROCESSORS)(
  30. IN EDKII_PEI_MP_SERVICES2_PPI *This,
  31. OUT UINTN *NumberOfProcessors,
  32. OUT UINTN *NumberOfEnabledProcessors
  33. );
  34. /**
  35. Get information on a specific CPU.
  36. @param[in] This Pointer to this instance of the PPI.
  37. @param[in] ProcessorNumber Pointer to the total number of logical processors in
  38. the system, including the BSP and disabled APs.
  39. @param[out] ProcessorInfoBuffer Number of processors in the system that are enabled.
  40. @retval EFI_SUCCESS Processor information was returned.
  41. @retval EFI_DEVICE_ERROR The calling processor is an AP.
  42. @retval EFI_INVALID_PARAMETER ProcessorInfoBuffer is NULL.
  43. @retval EFI_NOT_FOUND The processor with the handle specified by
  44. ProcessorNumber does not exist in the platform.
  45. **/
  46. typedef
  47. EFI_STATUS
  48. (EFIAPI *EDKII_PEI_MP_SERVICES_GET_PROCESSOR_INFO)(
  49. IN EDKII_PEI_MP_SERVICES2_PPI *This,
  50. IN UINTN ProcessorNumber,
  51. OUT EFI_PROCESSOR_INFORMATION *ProcessorInfoBuffer
  52. );
  53. /**
  54. Activate all of the application proessors.
  55. @param[in] This A pointer to the EFI_PEI_MP_SERVICES_PPI instance.
  56. @param[in] Procedure A pointer to the function to be run on enabled APs of
  57. the system.
  58. @param[in] SingleThread If TRUE, then all the enabled APs execute the function
  59. specified by Procedure one by one, in ascending order
  60. of processor handle number. If FALSE, then all the
  61. enabled APs execute the function specified by Procedure
  62. simultaneously.
  63. @param[in] TimeoutInMicroSeconds
  64. Indicates the time limit in microseconds for APs to
  65. return from Procedure, for blocking mode only. Zero
  66. means infinity. If the timeout expires before all APs
  67. return from Procedure, then Procedure on the failed APs
  68. is terminated. All enabled APs are available for next
  69. function assigned by EFI_PEI_MP_SERVICES_PPI.StartupAllAPs()
  70. or EFI_PEI_MP_SERVICES_PPI.StartupThisAP(). If the
  71. timeout expires in blocking mode, BSP returns
  72. EFI_TIMEOUT.
  73. @param[in] ProcedureArgument The parameter passed into Procedure for all APs.
  74. @retval EFI_SUCCESS In blocking mode, all APs have finished before the
  75. timeout expired.
  76. @retval EFI_DEVICE_ERROR Caller processor is AP.
  77. @retval EFI_NOT_STARTED No enabled APs exist in the system.
  78. @retval EFI_NOT_READY Any enabled APs are busy.
  79. @retval EFI_TIMEOUT In blocking mode, the timeout expired before all
  80. enabled APs have finished.
  81. @retval EFI_INVALID_PARAMETER Procedure is NULL.
  82. **/
  83. typedef
  84. EFI_STATUS
  85. (EFIAPI *EDKII_PEI_MP_SERVICES_STARTUP_ALL_APS)(
  86. IN EDKII_PEI_MP_SERVICES2_PPI *This,
  87. IN EFI_AP_PROCEDURE Procedure,
  88. IN BOOLEAN SingleThread,
  89. IN UINTN TimeoutInMicroSeconds,
  90. IN VOID *ProcedureArgument OPTIONAL
  91. );
  92. /**
  93. Activate a specific application processor.
  94. @param[in] This A pointer to the EFI_PEI_MP_SERVICES_PPI instance.
  95. @param[in] Procedure A pointer to the function to be run on enabled APs of
  96. the system.
  97. @param[in] ProcessorNumber The handle number of the AP. The range is from 0 to the
  98. total number of logical processors minus 1. The total
  99. number of logical processors can be retrieved by
  100. EFI_PEI_MP_SERVICES_PPI.GetNumberOfProcessors().
  101. @param[in] TimeoutInMicroSeconds
  102. Indicates the time limit in microseconds for APs to
  103. return from Procedure, for blocking mode only. Zero
  104. means infinity. If the timeout expires before all APs
  105. return from Procedure, then Procedure on the failed APs
  106. is terminated. All enabled APs are available for next
  107. function assigned by EFI_PEI_MP_SERVICES_PPI.StartupAllAPs()
  108. or EFI_PEI_MP_SERVICES_PPI.StartupThisAP(). If the
  109. timeout expires in blocking mode, BSP returns
  110. EFI_TIMEOUT.
  111. @param[in] ProcedureArgument The parameter passed into Procedure for all APs.
  112. @retval EFI_SUCCESS In blocking mode, specified AP finished before the
  113. timeout expires.
  114. @retval EFI_DEVICE_ERROR The calling processor is an AP.
  115. @retval EFI_TIMEOUT In blocking mode, the timeout expired before the
  116. specified AP has finished.
  117. @retval EFI_NOT_FOUND The processor with the handle specified by
  118. ProcessorNumber does not exist.
  119. @retval EFI_INVALID_PARAMETER ProcessorNumber specifies the BSP or disabled AP.
  120. @retval EFI_INVALID_PARAMETER Procedure is NULL.
  121. **/
  122. typedef
  123. EFI_STATUS
  124. (EFIAPI *EDKII_PEI_MP_SERVICES_STARTUP_THIS_AP)(
  125. IN EDKII_PEI_MP_SERVICES2_PPI *This,
  126. IN EFI_AP_PROCEDURE Procedure,
  127. IN UINTN ProcessorNumber,
  128. IN UINTN TimeoutInMicroseconds,
  129. IN VOID *ProcedureArgument OPTIONAL
  130. );
  131. /**
  132. Switch the boot strap processor.
  133. @param[in] This A pointer to the EFI_PEI_MP_SERVICES_PPI instance.
  134. @param[in] ProcessorNumber The handle number of the AP. The range is from 0 to the
  135. total number of logical processors minus 1. The total
  136. number of logical processors can be retrieved by
  137. EFI_PEI_MP_SERVICES_PPI.GetNumberOfProcessors().
  138. @param[in] EnableOldBSP If TRUE, then the old BSP will be listed as an enabled
  139. AP. Otherwise, it will be disabled.
  140. @retval EFI_SUCCESS BSP successfully switched.
  141. @retval EFI_UNSUPPORTED Switching the BSP cannot be completed prior to this
  142. service returning.
  143. @retval EFI_UNSUPPORTED Switching the BSP is not supported.
  144. @retval EFI_DEVICE_ERROR The calling processor is an AP.
  145. @retval EFI_NOT_FOUND The processor with the handle specified by
  146. ProcessorNumber does not exist.
  147. @retval EFI_INVALID_PARAMETER ProcessorNumber specifies the current BSP or a disabled
  148. AP.
  149. @retval EFI_NOT_READY The specified AP is busy.
  150. **/
  151. typedef
  152. EFI_STATUS
  153. (EFIAPI *EDKII_PEI_MP_SERVICES_SWITCH_BSP)(
  154. IN EDKII_PEI_MP_SERVICES2_PPI *This,
  155. IN UINTN ProcessorNumber,
  156. IN BOOLEAN EnableOldBSP
  157. );
  158. /**
  159. Enable or disable an application processor.
  160. @param[in] This A pointer to the EFI_PEI_MP_SERVICES_PPI instance.
  161. @param[in] ProcessorNumber The handle number of the AP. The range is from 0 to the
  162. total number of logical processors minus 1. The total
  163. number of logical processors can be retrieved by
  164. EFI_PEI_MP_SERVICES_PPI.GetNumberOfProcessors().
  165. @param[in] EnableAP Specifies the new state for the processor for enabled,
  166. FALSE for disabled.
  167. @param[in] HealthFlag If not NULL, a pointer to a value that specifies the
  168. new health status of the AP. This flag corresponds to
  169. StatusFlag defined in EFI_PEI_MP_SERVICES_PPI.GetProcessorInfo().
  170. Only the PROCESSOR_HEALTH_STATUS_BIT is used. All other
  171. bits are ignored. If it is NULL, this parameter is
  172. ignored.
  173. @retval EFI_SUCCESS The specified AP was enabled or disabled successfully.
  174. @retval EFI_UNSUPPORTED Enabling or disabling an AP cannot be completed prior
  175. to this service returning.
  176. @retval EFI_UNSUPPORTED Enabling or disabling an AP is not supported.
  177. @retval EFI_DEVICE_ERROR The calling processor is an AP.
  178. @retval EFI_NOT_FOUND Processor with the handle specified by ProcessorNumber
  179. does not exist.
  180. @retval EFI_INVALID_PARAMETER ProcessorNumber specifies the BSP.
  181. **/
  182. typedef
  183. EFI_STATUS
  184. (EFIAPI *EDKII_PEI_MP_SERVICES_ENABLEDISABLEAP)(
  185. IN EDKII_PEI_MP_SERVICES2_PPI *This,
  186. IN UINTN ProcessorNumber,
  187. IN BOOLEAN EnableAP,
  188. IN UINT32 *HealthFlag OPTIONAL
  189. );
  190. /**
  191. Identify the currently executing processor.
  192. @param[in] This A pointer to the EFI_PEI_MP_SERVICES_PPI instance.
  193. @param[out] ProcessorNumber The handle number of the AP. The range is from 0 to the
  194. total number of logical processors minus 1. The total
  195. number of logical processors can be retrieved by
  196. EFI_PEI_MP_SERVICES_PPI.GetNumberOfProcessors().
  197. @retval EFI_SUCCESS The current processor handle number was returned in
  198. ProcessorNumber.
  199. @retval EFI_INVALID_PARAMETER ProcessorNumber is NULL.
  200. **/
  201. typedef
  202. EFI_STATUS
  203. (EFIAPI *EDKII_PEI_MP_SERVICES_WHOAMI)(
  204. IN EDKII_PEI_MP_SERVICES2_PPI *This,
  205. OUT UINTN *ProcessorNumber
  206. );
  207. /**
  208. Activate all of the application proessors.
  209. @param[in] This A pointer to the EDKII_PEI_MP_SERVICES2_PPI instance.
  210. @param[in] Procedure A pointer to the function to be run on enabled APs of
  211. the system.
  212. @param[in] TimeoutInMicroSeconds
  213. Indicates the time limit in microseconds for APs to
  214. return from Procedure, for blocking mode only. Zero
  215. means infinity. If the timeout expires in blocking
  216. mode, BSP returns EFI_TIMEOUT.
  217. @param[in] ProcedureArgument The parameter passed into Procedure for all CPUs.
  218. @retval EFI_SUCCESS In blocking mode, all APs have finished before the
  219. timeout expired.
  220. @retval EFI_DEVICE_ERROR Caller processor is AP.
  221. @retval EFI_NOT_READY Any enabled APs are busy.
  222. @retval EFI_TIMEOUT In blocking mode, the timeout expired before all
  223. enabled APs have finished.
  224. @retval EFI_INVALID_PARAMETER Procedure is NULL.
  225. **/
  226. typedef
  227. EFI_STATUS
  228. (EFIAPI *EDKII_PEI_MP_SERVICES_STARTUP_ALL_CPUS)(
  229. IN EDKII_PEI_MP_SERVICES2_PPI *This,
  230. IN EFI_AP_PROCEDURE Procedure,
  231. IN UINTN TimeoutInMicroSeconds,
  232. IN VOID *ProcedureArgument OPTIONAL
  233. );
  234. struct _EDKII_PEI_MP_SERVICES2_PPI {
  235. EDKII_PEI_MP_SERVICES_GET_NUMBER_OF_PROCESSORS GetNumberOfProcessors;
  236. EDKII_PEI_MP_SERVICES_GET_PROCESSOR_INFO GetProcessorInfo;
  237. EDKII_PEI_MP_SERVICES_STARTUP_ALL_APS StartupAllAPs;
  238. EDKII_PEI_MP_SERVICES_STARTUP_THIS_AP StartupThisAP;
  239. EDKII_PEI_MP_SERVICES_SWITCH_BSP SwitchBSP;
  240. EDKII_PEI_MP_SERVICES_ENABLEDISABLEAP EnableDisableAP;
  241. EDKII_PEI_MP_SERVICES_WHOAMI WhoAmI;
  242. EDKII_PEI_MP_SERVICES_STARTUP_ALL_CPUS StartupAllCPUs;
  243. };
  244. extern EFI_GUID gEdkiiPeiMpServices2PpiGuid;
  245. #endif