FrameworkMpService.h 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656
  1. /** @file
  2. When installed, the Framework MP Services Protocol produces a collection of
  3. services that are needed for MP management, such as initialization and management
  4. of application processors.
  5. @par Note:
  6. This protocol has been deprecated and has been replaced by the MP Services
  7. Protocol from the UEFI Platform Initialization Specification 1.2, Volume 2:
  8. Driver Execution Environment Core Interface.
  9. The MP Services Protocol provides a generalized way of performing following tasks:
  10. - Retrieving information of multi-processor environment and MP-related status of
  11. specific processors.
  12. - Dispatching user-provided function to APs.
  13. - Maintain MP-related processor status.
  14. The MP Services Protocol must be produced on any system with more than one logical
  15. processor.
  16. The Protocol is available only during boot time.
  17. MP Services Protocol is hardware-independent. Most of the logic of this protocol
  18. is architecturally neutral. It abstracts the multi-processor environment and
  19. status of processors, and provides interfaces to retrieve information, maintain,
  20. and dispatch.
  21. MP Services Protocol may be consumed by ACPI module. The ACPI module may use this
  22. protocol to retrieve data that are needed for an MP platform and report them to OS.
  23. MP Services Protocol may also be used to program and configure processors, such
  24. as MTRR synchronization for memory space attributes setting in DXE Services.
  25. MP Services Protocol may be used by non-CPU DXE drivers to speed up platform boot
  26. by taking advantage of the processing capabilities of the APs, for example, using
  27. APs to help test system memory in parallel with other device initialization.
  28. Diagnostics applications may also use this protocol for multi-processor.
  29. Copyright (c) 1999 - 2018, Intel Corporation. All rights reserved.<BR>
  30. SPDX-License-Identifier: BSD-2-Clause-Patent
  31. **/
  32. #ifndef _FRAMEWORK_MP_SERVICE_PROTOCOL_H_
  33. #define _FRAMEWORK_MP_SERVICE_PROTOCOL_H_
  34. #include <FrameworkDxe.h>
  35. ///
  36. /// Global ID for the FRAMEWORK_EFI_MP_SERVICES_PROTOCOL.
  37. ///
  38. #define FRAMEWORK_EFI_MP_SERVICES_PROTOCOL_GUID \
  39. { \
  40. 0xf33261e7, 0x23cb, 0x11d5, {0xbd, 0x5c, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81} \
  41. }
  42. ///
  43. /// Forward declaration for the EFI_MP_SERVICES_PROTOCOL.
  44. ///
  45. typedef struct _FRAMEWORK_EFI_MP_SERVICES_PROTOCOL FRAMEWORK_EFI_MP_SERVICES_PROTOCOL;
  46. ///
  47. /// Fixed delivery mode that may be used as the DeliveryMode parameter in SendIpi().
  48. ///
  49. #define DELIVERY_MODE_FIXED 0x0
  50. ///
  51. /// Lowest priority delivery mode that may be used as the DeliveryMode parameter in SendIpi().
  52. ///
  53. #define DELIVERY_MODE_LOWEST_PRIORITY 0x1
  54. ///
  55. /// SMI delivery mode that may be used as the DeliveryMode parameter in SendIpi().
  56. ///
  57. #define DELIVERY_MODE_SMI 0x2
  58. ///
  59. /// Remote read delivery mode that may be used as the DeliveryMode parameter in SendIpi().
  60. ///
  61. #define DELIVERY_MODE_REMOTE_READ 0x3
  62. ///
  63. /// NMI delivery mode that may be used as the DeliveryMode parameter in SendIpi().
  64. ///
  65. #define DELIVERY_MODE_NMI 0x4
  66. ///
  67. /// INIT delivery mode that may be used as the DeliveryMode parameter in SendIpi().
  68. ///
  69. #define DELIVERY_MODE_INIT 0x5
  70. ///
  71. /// Startup IPI delivery mode that may be used as the DeliveryMode parameter in SendIpi().
  72. ///
  73. #define DELIVERY_MODE_SIPI 0x6
  74. ///
  75. /// The DeliveryMode parameter in SendIpi() must be less than this maximum value.
  76. ///
  77. #define DELIVERY_MODE_MAX 0x7
  78. ///
  79. /// IPF specific value for the state field of the Self Test State Parameter.
  80. ///
  81. #define EFI_MP_HEALTH_FLAGS_STATUS_HEALTHY 0x0
  82. ///
  83. /// IPF specific value for the state field of the Self Test State Parameter.
  84. ///
  85. #define EFI_MP_HEALTH_FLAGS_STATUS_PERFORMANCE_RESTRICTED 0x1
  86. ///
  87. /// IPF specific value for the state field of the Self Test State Parameter.
  88. ///
  89. #define EFI_MP_HEALTH_FLAGS_STATUS_FUNCTIONALLY_RESTRICTED 0x2
  90. typedef union {
  91. ///
  92. /// Bitfield structure for the IPF Self Test State Parameter.
  93. ///
  94. struct {
  95. UINT32 Status:2;
  96. UINT32 Tested:1;
  97. UINT32 Reserved1:13;
  98. UINT32 VirtualMemoryUnavailable:1;
  99. UINT32 Ia32ExecutionUnavailable:1;
  100. UINT32 FloatingPointUnavailable:1;
  101. UINT32 MiscFeaturesUnavailable:1;
  102. UINT32 Reserved2:12;
  103. } Bits;
  104. ///
  105. /// IA32 and X64 BIST data of the processor.
  106. ///
  107. UINT32 Uint32;
  108. } EFI_MP_HEALTH_FLAGS;
  109. typedef struct {
  110. ///
  111. /// @par IA32, X64:
  112. /// BIST (built-in self-test) data of the processor.
  113. ///
  114. /// @par IPF:
  115. /// Lower 32 bits of the self-test state parameter. For definition of self-test
  116. /// state parameter, please refer to Intel(R) Itanium(R) Architecture Software
  117. /// Developer's Manual, Volume 2: System Architecture.
  118. ///
  119. EFI_MP_HEALTH_FLAGS Flags;
  120. ///
  121. /// @par IA32, X64:
  122. /// Not used.
  123. ///
  124. /// @par IPF:
  125. /// Higher 32 bits of self test state parameter.
  126. ///
  127. UINT32 TestStatus;
  128. } EFI_MP_HEALTH;
  129. typedef enum {
  130. EfiCpuAP = 0, ///< The CPU is an AP (Application Processor).
  131. EfiCpuBSP, ///< The CPU is the BSP (Boot-Strap Processor).
  132. EfiCpuDesignationMaximum
  133. } EFI_CPU_DESIGNATION;
  134. typedef struct {
  135. ///
  136. /// @par IA32, X64:
  137. /// The lower 8 bits contains local APIC ID, and higher bits are reserved.
  138. ///
  139. /// @par IPF:
  140. /// The lower 16 bits contains id/eid as physical address of local SAPIC
  141. /// unit, and higher bits are reserved.
  142. ///
  143. UINT32 ApicID;
  144. ///
  145. /// This field indicates whether the processor is enabled. If the value is
  146. /// TRUE, then the processor is enabled. Otherwise, it is disabled.
  147. ///
  148. BOOLEAN Enabled;
  149. ///
  150. /// This field indicates whether the processor is playing the role of BSP.
  151. /// If the value is EfiCpuAP, then the processor is AP. If the value is
  152. /// EfiCpuBSP, then the processor is BSP.
  153. ///
  154. EFI_CPU_DESIGNATION Designation;
  155. ///
  156. /// @par IA32, X64:
  157. /// The Flags field of this EFI_MP_HEALTH data structure holds BIST (built-in
  158. /// self test) data of the processor. The TestStatus field is not used, and
  159. /// the value is always zero.
  160. ///
  161. /// @par IPF:
  162. /// Bit format of this field is the same as the definition of self-test state
  163. /// parameter, in Intel(R) Itanium(R) Architecture Software Developer's Manual,
  164. /// Volume 2: System Architecture.
  165. ///
  166. EFI_MP_HEALTH Health;
  167. ///
  168. /// Zero-based physical package number that identifies the cartridge of the
  169. /// processor.
  170. ///
  171. UINTN PackageNumber;
  172. ///
  173. /// Zero-based physical core number within package of the processor.
  174. ///
  175. UINTN NumberOfCores;
  176. ///
  177. /// Zero-based logical thread number within core of the processor.
  178. ///
  179. UINTN NumberOfThreads;
  180. ///
  181. /// This field is reserved.
  182. ///
  183. UINT64 ProcessorPALCompatibilityFlags;
  184. ///
  185. /// @par IA32, X64:
  186. /// This field is not used, and the value is always zero.
  187. ///
  188. /// @par IPF:
  189. /// This field is a mask number that is handed off by the PAL about which
  190. /// processor tests are performed and which are masked.
  191. ///
  192. UINT64 ProcessorTestMask;
  193. } EFI_MP_PROC_CONTEXT;
  194. /**
  195. This service retrieves general information of multiprocessors in the system.
  196. This function is used to get the following information:
  197. - Number of logical processors in system
  198. - Maximal number of logical processors supported by system
  199. - Number of enabled logical processors.
  200. - Rendezvous interrupt number (IPF-specific)
  201. - Length of the rendezvous procedure.
  202. @param[in] This The pointer to the FRAMEWORK_EFI_MP_SERVICES_PROTOCOL
  203. instance.
  204. @param[out] NumberOfCPUs The pointer to the total number of logical processors
  205. in the system, including the BSP and disabled
  206. APs. If NULL, this parameter is ignored.
  207. @param[out] MaximumNumberOfCPUs Pointer to the maximum number of processors
  208. supported by the system. If NULL, this
  209. parameter is ignored.
  210. @param[out] NumberOfEnabledCPUs The pointer to the number of enabled logical
  211. processors that exist in system, including
  212. the BSP. If NULL, this parameter is ignored.
  213. @param[out] RendezvousIntNumber This parameter is only meaningful for IPF.
  214. - IA32, X64: The returned value is zero.
  215. If NULL, this parameter is ignored.
  216. - IPF: Pointer to the rendezvous interrupt
  217. number that is used for AP wake-up.
  218. @param[out] RendezvousProcLength The pointer to the length of rendezvous procedure.
  219. - IA32, X64: The returned value is 0x1000.
  220. If NULL, this parameter is ignored.
  221. - IPF: The returned value is zero.
  222. @retval EFI_SUCCESS Multiprocessor general information was successfully retrieved.
  223. **/
  224. typedef
  225. EFI_STATUS
  226. (EFIAPI *EFI_MP_SERVICES_GET_GENERAL_MP_INFO)(
  227. IN FRAMEWORK_EFI_MP_SERVICES_PROTOCOL *This,
  228. OUT UINTN *NumberOfCPUs OPTIONAL,
  229. OUT UINTN *MaximumNumberOfCPUs OPTIONAL,
  230. OUT UINTN *NumberOfEnabledCPUs OPTIONAL,
  231. OUT UINTN *RendezvousIntNumber OPTIONAL,
  232. OUT UINTN *RendezvousProcLength OPTIONAL
  233. );
  234. /**
  235. This service gets detailed MP-related information of the requested processor.
  236. This service gets detailed MP-related information of the requested processor
  237. at the instant this call is made. Note the following:
  238. - The processor information may change during the course of a boot session.
  239. - The data of information presented here is entirely MP related.
  240. Information regarding the number of caches and their sizes, frequency of operation,
  241. slot numbers is all considered platform-related information and will not be
  242. presented here.
  243. @param[in] This The pointer to the FRAMEWORK_EFI_MP_SERVICES_PROTOCOL
  244. instance.
  245. @param[in] ProcessorNumber The handle number of the processor. The range
  246. is from 0 to the total number of logical
  247. processors minus 1. The total number of
  248. logical processors can be retrieved by
  249. GetGeneralMPInfo().
  250. @param[in,out] BufferLength On input, pointer to the size in bytes of
  251. ProcessorContextBuffer. On output, if the
  252. size of ProcessorContextBuffer is not large
  253. enough, the value pointed by this parameter
  254. is updated to size in bytes that is needed.
  255. If the size of ProcessorContextBuffer is
  256. sufficient, the value is not changed from
  257. input.
  258. @param[out] ProcessorContextBuffer The pointer to the buffer where the data of
  259. requested processor will be deposited.
  260. The buffer is allocated by caller.
  261. @retval EFI_SUCCESS Processor information was successfully returned.
  262. @retval EFI_BUFFER_TOO_SMALL The size of ProcessorContextBuffer is too small.
  263. The value pointed by BufferLength has been updated
  264. to size in bytes that is needed.
  265. @retval EFI_INVALID_PARAMETER IA32, X64:BufferLength is NULL.
  266. @retval EFI_INVALID_PARAMETER IA32, X64:ProcessorContextBuffer is NULL.
  267. @retval EFI_INVALID_PARAMETER IA32, X64:Processor with the handle specified by
  268. ProcessorNumber does not exist.
  269. @retval EFI_NOT_FOUND IPF: Processor with the handle specified by
  270. ProcessorNumber does not exist.
  271. **/
  272. typedef
  273. EFI_STATUS
  274. (EFIAPI *EFI_MP_SERVICES_GET_PROCESSOR_CONTEXT)(
  275. IN FRAMEWORK_EFI_MP_SERVICES_PROTOCOL *This,
  276. IN UINTN ProcessorNumber,
  277. IN OUT UINTN *BufferLength,
  278. OUT EFI_MP_PROC_CONTEXT *ProcessorContextBuffer
  279. );
  280. /**
  281. This function is used to dispatch all enabled APs to the function specified
  282. by Procedure. APs can run either simultaneously or one by one. The caller can
  283. also configure the BSP to either wait for APs or just proceed with the next
  284. task. It is the responsibility of the caller of the StartupAllAPs() to make
  285. sure that the nature of the code that will be run on the BSP and the dispatched
  286. APs is well controlled. The MP Services Protocol does not guarantee that the
  287. function that either processor is executing is MP-safe. Hence, the tasks that
  288. can be run in parallel are limited to certain independent tasks and well-
  289. controlled exclusive code. EFI services and protocols may not be called by APs
  290. unless otherwise specified.
  291. @param[in] This The pointer to the FRAMEWORK_EFI_MP_SERVICES_PROTOCOL
  292. instance.
  293. @param[in] Procedure A pointer to the function to be run on enabled
  294. APs of the system.
  295. @param[in] SingleThread Flag that requests APs to execute one at a
  296. time or simultaneously.
  297. - IA32, X64:
  298. If TRUE, then all the enabled APs execute
  299. the function specified by Procedure one by
  300. one, in ascending order of processor handle
  301. number. If FALSE, then all the enabled APs
  302. execute the function specified by Procedure
  303. simultaneously.
  304. - IPF:
  305. If TRUE, then all the enabled APs execute
  306. the function specified by Procedure simultaneously.
  307. If FALSE, then all the enabled APs execute the
  308. function specified by Procedure one by one, in
  309. ascending order of processor handle number. The
  310. time interval of AP dispatching is determined
  311. by WaitEvent and TimeoutInMicrosecs.
  312. @param[in] WaitEvent Event to signal when APs have finished.
  313. - IA32, X64:
  314. If not NULL, when all APs finish after timeout
  315. expires, the event will be signaled. If NULL,
  316. the parameter is ignored.
  317. - IPF:
  318. If SingleThread is TRUE, this parameter
  319. is ignored. If SingleThread is FALSE (i.e.
  320. dispatch APs one by one), this parameter
  321. determines whether the BSP waits after each
  322. AP is dispatched. If it is NULL, the BSP
  323. does not wait after each AP is dispatched.
  324. If it is not NULL, the BSP waits after each
  325. AP is dispatched, and the time interval is
  326. determined by TimeoutInMicrosecs. Type
  327. EFI_EVENT is defined in CreateEvent() in
  328. the Unified Extensible Firmware Interface
  329. Specification.
  330. @param[in] TimeoutInMicrosecsond Time to wait for APs to finish.
  331. - IA32, X64:
  332. If the value is zero, it means no timeout
  333. limit. The BSP waits until all APs finish.
  334. If the value is not zero, the BSP waits
  335. until all APs finish or timeout expires.
  336. If timeout expires, EFI_TIMEOUT is returned,
  337. and the BSP will then check APs?status
  338. periodically, with time interval of 16
  339. microseconds.
  340. - IPF:
  341. If SingleThread is TRUE and FailedCPUList
  342. is NULL, this parameter is ignored. If
  343. SingleThread is TRUE and FailedCPUList is
  344. not NULL, this parameter determines whether
  345. the BSP waits until all APs finish their
  346. procedure. If it is zero, the BSP does not
  347. wait for APs. If it is non-zero, it waits
  348. until all APs finish. If SingleThread is
  349. FALSE and WaitEvent is NULL, this parameter
  350. is ignored. If SingleThread is FALSE and
  351. WaitEvent is not NULL, the BSP waits after
  352. each AP is dispatched and this value
  353. determines time interval. If the value is
  354. zero, the length of time interval is 10ms.
  355. If the value is non-zero, the BSP waits
  356. until dispatched AP finishes and then
  357. dispatch the next.
  358. @param[in] ProcedureArgument The pointer to the optional parameter of the
  359. function specified by Procedure.
  360. @param[out] FailedCPUList List of APs that did not finish.
  361. - IA32, X64:
  362. If not NULL, it records handle numbers of
  363. all logical processors that fail to accept
  364. caller-provided function (busy or disabled).
  365. If NULL, this parameter is ignored.
  366. - IPF:
  367. If not NULL, it records status of all
  368. logical processors, with processor handle
  369. number as index. If a logical processor
  370. fails to accept caller-provided function
  371. because it is busy, the status is EFI_NOT_READY.
  372. If it fails to accept function due to other
  373. reasons, the status is EFI_NOT_AVAILABLE_YET.
  374. If timeout expires, the status is EFI_TIMEOUT.
  375. Otherwise, the value is EFI_SUCCESS. If NULL,
  376. this parameter is ignored.
  377. @retval EFI_SUCCESS IA32, X64: All dispatched APs have finished
  378. before the timeout expires.
  379. @retval EFI_SUCCESS IA32, X64: Only 1 logical processor exists
  380. in system.
  381. @retval EFI_INVALID_PARAMETER IA32, X64: Procedure is NULL.
  382. @retval EFI_TIMEOUT IA32, X64: The timeout expires before all
  383. dispatched APs have finished.
  384. @retval EFI_SUCCESS IPF: This function always returns EFI_SUCCESS.
  385. **/
  386. typedef
  387. EFI_STATUS
  388. (EFIAPI *FRAMEWORK_EFI_MP_SERVICES_STARTUP_ALL_APS)(
  389. IN FRAMEWORK_EFI_MP_SERVICES_PROTOCOL *This,
  390. IN FRAMEWORK_EFI_AP_PROCEDURE Procedure,
  391. IN BOOLEAN SingleThread,
  392. IN EFI_EVENT WaitEvent OPTIONAL,
  393. IN UINTN TimeoutInMicroSecs,
  394. IN VOID *ProcArguments OPTIONAL,
  395. OUT UINTN *FailedCPUList OPTIONAL
  396. );
  397. /**
  398. This function is used to dispatch one enabled AP to the function provided by
  399. the caller. The caller can request the BSP to either wait for the AP or just
  400. proceed with the next task.
  401. @param[in] This The pointer to the FRAMEWORK_EFI_MP_SERVICES_PROTOCOL
  402. instance.
  403. @param[in] Procedure A pointer to the function to be run on the
  404. designated AP.
  405. @param[in] ProcessorNumber The handle number of AP. The range is from
  406. 0 to the total number of logical processors
  407. minus 1. The total number of logical
  408. processors can be retrieved by GetGeneralMPInfo().
  409. @param[in] WaitEvent Event to signal when APs have finished.
  410. - IA32, X64:
  411. If not NULL, when the AP finishes after timeout
  412. expires, the event will be signaled. If NULL,
  413. the parameter is ignored.
  414. - IPF:
  415. This parameter determines whether the BSP
  416. waits after the AP is dispatched. If it is
  417. NULL, the BSP does not wait after the AP
  418. is dispatched. If it is not NULL, the BSP
  419. waits after the AP is dispatched, and the
  420. time interval is determined by TimeoutInMicrosecs.
  421. Type EFI_EVENT is defined in CreateEvent()
  422. in the Unified Extensible Firmware Interface
  423. Specification.
  424. @param[in] TimeoutInMicrosecsond Time to wait for APs to finish.
  425. - IA32, X64:
  426. If the value is zero, it means no timeout
  427. limit. The BSP waits until the AP finishes.
  428. If the value is not zero, the BSP waits until
  429. the AP finishes or timeout expires. If timeout
  430. expires, EFI_TIMEOUT is returned, and the
  431. BSP will then check the AP's status periodically,
  432. with time interval of 16 microseconds.
  433. - IPF:
  434. If WaitEvent is NULL, this parameter is ignored.
  435. If WaitEvent is not NULL, the BSP waits after
  436. the AP is dispatched and this value determines
  437. time interval. If the value is zero, the length
  438. of time interval is 10ms. If the value is
  439. non-zero, the BSP waits until the AP finishes.
  440. @param[in] ProcedureArgument The pointer to the optional parameter of the
  441. function specified by Procedure.
  442. @retval EFI_SUCCESS Specified AP has finished before the timeout
  443. expires.
  444. @retval EFI_TIMEOUT The timeout expires before specified AP has
  445. finished.
  446. @retval EFI_INVALID_PARAMETER IA32, X64: Processor with the handle specified
  447. by ProcessorNumber does not exist.
  448. @retval EFI_INVALID_PARAMETER IA32, X64: Specified AP is busy or disabled.
  449. @retval EFI_INVALID_PARAMETER IA32, X64: Procedure is NULL.
  450. @retval EFI_INVALID_PARAMETER IA32, X64: ProcessorNumber specifies the BSP
  451. @retval EFI_NOT_READY IPF: Specified AP is busy
  452. @retval EFI_NOT_AVAILABLE_YET IPF: ProcessorNumber specifies the BSP
  453. @retval EFI_NOT_AVAILABLE_YET IPF: Specified AP is disabled.
  454. @retval EFI_NOT_AVAILABLE_YET IPF: Specified AP is unhealthy or untested.
  455. **/
  456. typedef
  457. EFI_STATUS
  458. (EFIAPI *FRAMEWORK_EFI_MP_SERVICES_STARTUP_THIS_AP)(
  459. IN FRAMEWORK_EFI_MP_SERVICES_PROTOCOL *This,
  460. IN FRAMEWORK_EFI_AP_PROCEDURE Procedure,
  461. IN UINTN ProcessorNumber,
  462. IN EFI_EVENT WaitEvent OPTIONAL,
  463. IN UINTN TimeoutInMicroSecs,
  464. IN OUT VOID *ProcArguments OPTIONAL
  465. );
  466. /**
  467. This service switches the requested AP to be the BSP from that point onward.
  468. The new BSP can take over the execution of the old BSP and continue seamlessly
  469. from where the old one left off. This call can only be performed by the
  470. current BSP.
  471. @param[in] This The pointer to the FRAMEWORK_EFI_MP_SERVICES_PROTOCOL
  472. instance.
  473. @param[in] ProcessorNumber The handle number of AP. The range is from 0 to
  474. the total number of logical processors minus 1.
  475. The total number of logical processors can be
  476. retrieved by GetGeneralMPInfo().
  477. @param[in] EnableOldBSP If TRUE, then the old BSP will be listed as an
  478. enabled AP. Otherwise, it will be disabled.
  479. @retval EFI_SUCCESS BSP successfully switched.
  480. @retval EFI_INVALID_PARAMETER The processor with the handle specified by
  481. ProcessorNumber does not exist.
  482. @retval EFI_INVALID_PARAMETER ProcessorNumber specifies the BSP.
  483. @retval EFI_NOT_READY IA32, X64: Specified AP is busy or disabled.
  484. @retval EFI_INVALID_PARAMETER IPF: Specified AP is disabled.
  485. @retval EFI_INVALID_PARAMETER IPF: Specified AP is unhealthy or untested.
  486. @retval EFI_NOT_READY IPF: Specified AP is busy.
  487. **/
  488. typedef
  489. EFI_STATUS
  490. (EFIAPI *FRAMEWORK_EFI_MP_SERVICES_SWITCH_BSP)(
  491. IN FRAMEWORK_EFI_MP_SERVICES_PROTOCOL *This,
  492. IN UINTN ProcessorNumber,
  493. IN BOOLEAN EnableOldBSP
  494. );
  495. /**
  496. This service sends an IPI to a specified AP. Caller can specify vector number
  497. and delivery mode of the interrupt.
  498. @param[in] This The pointer to the FRAMEWORK_EFI_MP_SERVICES_PROTOCOL
  499. instance.
  500. @param[in] ProcessorNumber The handle number of AP. The range is from 0 to
  501. the total number of logical processors minus 1.
  502. The total number of logical processors can be
  503. retrieved by GetGeneralMPInfo().
  504. @param[in] VectorNumber The vector number of the interrupt.
  505. @param[in] DeliveryMode The delivery mode of the interrupt.
  506. @retval EFI_SUCCESS IPI was successfully sent.
  507. @retval EFI_INVALID_PARAMETER ProcessorNumber specifies the BSP.
  508. @retval EFI_INVALID_PARAMETER IA32, X64: Processor with the handle specified
  509. by ProcessorNumber does not exist.
  510. @retval EFI_INVALID_PARAMETER IA32, X64: VectorNumber is greater than 255.
  511. @retval EFI_INVALID_PARAMETER IA32, X64: DeliveryMode is greater than or equal
  512. to DELIVERY_MODE_MAX.
  513. @retval EFI_NOT_READY IA32, X64: IPI is not accepted by the target
  514. processor within 10 microseconds.
  515. @retval EFI_INVALID_PARAMETER IPF: Specified AP is disabled.
  516. @retval EFI_INVALID_PARAMETER IPF: Specified AP is unhealthy or untested.
  517. @retval EFI_NOT_READY IPF: Specified AP is busy.
  518. **/
  519. typedef
  520. EFI_STATUS
  521. (EFIAPI *EFI_MP_SERVICES_SEND_IPI)(
  522. IN FRAMEWORK_EFI_MP_SERVICES_PROTOCOL *This,
  523. IN UINTN ProcessorNumber,
  524. IN UINTN VectorNumber,
  525. IN UINTN DeliveryMode
  526. );
  527. /**
  528. This service lets the caller enable or disable an AP. The caller can optionally
  529. specify the health status of the AP by Health. It is usually used to update the
  530. health status of the processor after some processor test.
  531. @param[in] This The pointer to the FRAMEWORK_EFI_MP_SERVICES_PROTOCOL
  532. instance.
  533. @param[in] ProcessorNumber The handle number of AP. The range is from 0 to
  534. the total number of logical processors minus 1.
  535. The total number of logical processors can be
  536. retrieved by GetGeneralMPInfo().
  537. @param[in] NewAPState Indicates whether the new, desired state of the
  538. AP is enabled or disabled. TRUE for enabling,
  539. FALSE otherwise.
  540. @param[in] HealthState If not NULL, it points to the value that specifies
  541. the new health status of the AP. If it is NULL,
  542. this parameter is ignored.
  543. @retval EFI_SUCCESS AP successfully enabled or disabled.
  544. @retval EFI_INVALID_PARAMETER ProcessorNumber specifies the BSP.
  545. @retval EFI_INVALID_PARAMETER IA32, X64: Processor with the handle specified
  546. by ProcessorNumber does not exist.
  547. @retval EFI_INVALID_PARAMETER IPF: If an unhealthy or untested AP is to be
  548. enabled.
  549. **/
  550. typedef
  551. EFI_STATUS
  552. (EFIAPI *FRAMEWORK_EFI_MP_SERVICES_ENABLEDISABLEAP)(
  553. IN FRAMEWORK_EFI_MP_SERVICES_PROTOCOL *This,
  554. IN UINTN ProcessorNumber,
  555. IN BOOLEAN NewAPState,
  556. IN EFI_MP_HEALTH *HealthState OPTIONAL
  557. );
  558. /**
  559. This service lets the caller processor get its handle number, with which any
  560. processor in the system can be uniquely identified. The range is from 0 to the
  561. total number of logical processors minus 1. The total number of logical
  562. processors can be retrieved by GetGeneralMPInfo(). This service may be called
  563. from the BSP and APs.
  564. @param[in] This The pointer to the FRAMEWORK_EFI_MP_SERVICES_PROTOCOL
  565. instance.
  566. @param[out] ProcessorNumber A pointer to the handle number of AP. The range is
  567. from 0 to the total number of logical processors
  568. minus 1. The total number of logical processors
  569. can be retrieved by GetGeneralMPInfo().
  570. @retval EFI_SUCCESS This function always returns EFI_SUCCESS.
  571. **/
  572. typedef
  573. EFI_STATUS
  574. (EFIAPI *FRAMEWORK_EFI_MP_SERVICES_WHOAMI)(
  575. IN FRAMEWORK_EFI_MP_SERVICES_PROTOCOL *This,
  576. OUT UINTN *ProcessorNumber
  577. );
  578. ///
  579. /// Framework MP Services Protocol structure.
  580. ///
  581. struct _FRAMEWORK_EFI_MP_SERVICES_PROTOCOL {
  582. EFI_MP_SERVICES_GET_GENERAL_MP_INFO GetGeneralMPInfo;
  583. EFI_MP_SERVICES_GET_PROCESSOR_CONTEXT GetProcessorContext;
  584. FRAMEWORK_EFI_MP_SERVICES_STARTUP_ALL_APS StartupAllAPs;
  585. FRAMEWORK_EFI_MP_SERVICES_STARTUP_THIS_AP StartupThisAP;
  586. FRAMEWORK_EFI_MP_SERVICES_SWITCH_BSP SwitchBSP;
  587. EFI_MP_SERVICES_SEND_IPI SendIPI;
  588. FRAMEWORK_EFI_MP_SERVICES_ENABLEDISABLEAP EnableDisableAP;
  589. FRAMEWORK_EFI_MP_SERVICES_WHOAMI WhoAmI;
  590. };
  591. extern EFI_GUID gFrameworkEfiMpServiceProtocolGuid;
  592. #endif