]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Protocol/MpService.h
MdePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdePkg / Include / Protocol / MpService.h
CommitLineData
82336c28 1/** @file\r
8f3446d8 2 When installed, the MP Services Protocol produces a collection of services\r
82336c28 3 that are needed for MP management.\r
4\r
5 The MP Services Protocol provides a generalized way of performing following tasks:\r
6 - Retrieving information of multi-processor environment and MP-related status of\r
7 specific processors.\r
8 - Dispatching user-provided function to APs.\r
9 - Maintain MP-related processor status.\r
10\r
11 The MP Services Protocol must be produced on any system with more than one logical\r
12 processor.\r
13\r
14 The Protocol is available only during boot time.\r
15\r
16 MP Services Protocol is hardware-independent. Most of the logic of this protocol\r
8f3446d8
JF
17 is architecturally neutral. It abstracts the multi-processor environment and\r
18 status of processors, and provides interfaces to retrieve information, maintain,\r
82336c28 19 and dispatch.\r
20\r
8f3446d8 21 MP Services Protocol may be consumed by ACPI module. The ACPI module may use this\r
82336c28 22 protocol to retrieve data that are needed for an MP platform and report them to OS.\r
8f3446d8 23 MP Services Protocol may also be used to program and configure processors, such\r
82336c28 24 as MTRR synchronization for memory space attributes setting in DXE Services.\r
8f3446d8
JF
25 MP Services Protocol may be used by non-CPU DXE drivers to speed up platform boot\r
26 by taking advantage of the processing capabilities of the APs, for example, using\r
82336c28 27 APs to help test system memory in parallel with other device initialization.\r
28 Diagnostics applications may also use this protocol for multi-processor.\r
29\r
da71a637 30Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>\r
9344f092 31SPDX-License-Identifier: BSD-2-Clause-Patent\r
82336c28 32\r
33 @par Revision Reference:\r
8f3446d8 34 This Protocol is defined in the UEFI Platform Initialization Specification 1.2,\r
82336c28 35 Volume 2:Driver Execution Environment Core Interface.\r
8f3446d8 36\r
82336c28 37**/\r
38\r
39#ifndef _MP_SERVICE_PROTOCOL_H_\r
40#define _MP_SERVICE_PROTOCOL_H_\r
41\r
42///\r
af2dc6a7 43/// Global ID for the EFI_MP_SERVICES_PROTOCOL.\r
82336c28 44///\r
45#define EFI_MP_SERVICES_PROTOCOL_GUID \\r
46 { \\r
47 0x3fdda605, 0xa76e, 0x4f46, {0xad, 0x29, 0x12, 0xf4, 0x53, 0x1b, 0x3d, 0x08} \\r
48 }\r
49\r
50///\r
af2dc6a7 51/// Forward declaration for the EFI_MP_SERVICES_PROTOCOL.\r
82336c28 52///\r
53typedef struct _EFI_MP_SERVICES_PROTOCOL EFI_MP_SERVICES_PROTOCOL;\r
54\r
55///\r
56/// Terminator for a list of failed CPUs returned by StartAllAPs().\r
57///\r
58#define END_OF_CPU_LIST 0xffffffff\r
59\r
60///\r
8f3446d8 61/// This bit is used in the StatusFlag field of EFI_PROCESSOR_INFORMATION and\r
82336c28 62/// indicates whether the processor is playing the role of BSP. If the bit is 1,\r
63/// then the processor is BSP. Otherwise, it is AP.\r
64///\r
65#define PROCESSOR_AS_BSP_BIT 0x00000001\r
66\r
67///\r
8f3446d8
JF
68/// This bit is used in the StatusFlag field of EFI_PROCESSOR_INFORMATION and\r
69/// indicates whether the processor is enabled. If the bit is 1, then the\r
82336c28 70/// processor is enabled. Otherwise, it is disabled.\r
71///\r
72#define PROCESSOR_ENABLED_BIT 0x00000002\r
73\r
74///\r
8f3446d8
JF
75/// This bit is used in the StatusFlag field of EFI_PROCESSOR_INFORMATION and\r
76/// indicates whether the processor is healthy. If the bit is 1, then the\r
82336c28 77/// processor is healthy. Otherwise, some fault has been detected for the processor.\r
78///\r
79#define PROCESSOR_HEALTH_STATUS_BIT 0x00000004\r
80\r
81///\r
82/// Structure that describes the pyhiscal location of a logical CPU.\r
83///\r
84typedef struct {\r
85 ///\r
86 /// Zero-based physical package number that identifies the cartridge of the processor.\r
87 ///\r
88 UINT32 Package;\r
89 ///\r
90 /// Zero-based physical core number within package of the processor.\r
91 ///\r
92 UINT32 Core;\r
93 ///\r
94 /// Zero-based logical thread number within core of the processor.\r
95 ///\r
96 UINT32 Thread;\r
97} EFI_CPU_PHYSICAL_LOCATION;\r
98\r
99///\r
100/// Structure that describes information about a logical CPU.\r
101///\r
102typedef struct {\r
103 ///\r
8f3446d8
JF
104 /// The unique processor ID determined by system hardware. For IA32 and X64,\r
105 /// the processor ID is the same as the Local APIC ID. Only the lower 8 bits\r
82336c28 106 /// are used, and higher bits are reserved. For IPF, the lower 16 bits contains\r
107 /// id/eid, and higher bits are reserved.\r
108 ///\r
8f3446d8
JF
109 UINT64 ProcessorId;\r
110 ///\r
111 /// Flags indicating if the processor is BSP or AP, if the processor is enabled\r
112 /// or disabled, and if the processor is healthy. Bits 3..31 are reserved and\r
113 /// must be 0.\r
82336c28 114 ///\r
82336c28 115 /// <pre>\r
116 /// BSP ENABLED HEALTH Description\r
117 /// === ======= ====== ===================================================\r
118 /// 0 0 0 Unhealthy Disabled AP.\r
119 /// 0 0 1 Healthy Disabled AP.\r
120 /// 0 1 0 Unhealthy Enabled AP.\r
121 /// 0 1 1 Healthy Enabled AP.\r
122 /// 1 0 0 Invalid. The BSP can never be in the disabled state.\r
123 /// 1 0 1 Invalid. The BSP can never be in the disabled state.\r
124 /// 1 1 0 Unhealthy Enabled BSP.\r
af2dc6a7 125 /// 1 1 1 Healthy Enabled BSP.\r
82336c28 126 /// </pre>\r
127 ///\r
128 UINT32 StatusFlag;\r
129 ///\r
130 /// The physical location of the processor, including the physical package number\r
8f3446d8 131 /// that identifies the cartridge, the physical core number within package, and\r
af2dc6a7 132 /// logical thread number within core.\r
82336c28 133 ///\r
134 EFI_CPU_PHYSICAL_LOCATION Location;\r
135} EFI_PROCESSOR_INFORMATION;\r
136\r
82336c28 137/**\r
138 This service retrieves the number of logical processor in the platform\r
139 and the number of those logical processors that are enabled on this boot.\r
140 This service may only be called from the BSP.\r
141\r
142 This function is used to retrieve the following information:\r
af2dc6a7 143 - The number of logical processors that are present in the system.\r
8f3446d8 144 - The number of enabled logical processors in the system at the instant\r
82336c28 145 this call is made.\r
146\r
8f3446d8
JF
147 Because MP Service Protocol provides services to enable and disable processors\r
148 dynamically, the number of enabled logical processors may vary during the\r
82336c28 149 course of a boot session.\r
8f3446d8
JF
150\r
151 If this service is called from an AP, then EFI_DEVICE_ERROR is returned.\r
152 If NumberOfProcessors or NumberOfEnabledProcessors is NULL, then\r
153 EFI_INVALID_PARAMETER is returned. Otherwise, the total number of processors\r
154 is returned in NumberOfProcessors, the number of currently enabled processor\r
82336c28 155 is returned in NumberOfEnabledProcessors, and EFI_SUCCESS is returned.\r
156\r
157 @param[in] This A pointer to the EFI_MP_SERVICES_PROTOCOL\r
158 instance.\r
159 @param[out] NumberOfProcessors Pointer to the total number of logical\r
160 processors in the system, including the BSP\r
161 and disabled APs.\r
162 @param[out] NumberOfEnabledProcessors Pointer to the number of enabled logical\r
163 processors that exist in system, including\r
164 the BSP.\r
165\r
8f3446d8 166 @retval EFI_SUCCESS The number of logical processors and enabled\r
82336c28 167 logical processors was retrieved.\r
168 @retval EFI_DEVICE_ERROR The calling processor is an AP.\r
af2dc6a7 169 @retval EFI_INVALID_PARAMETER NumberOfProcessors is NULL.\r
170 @retval EFI_INVALID_PARAMETER NumberOfEnabledProcessors is NULL.\r
82336c28 171\r
172**/\r
173typedef\r
174EFI_STATUS\r
175(EFIAPI *EFI_MP_SERVICES_GET_NUMBER_OF_PROCESSORS)(\r
176 IN EFI_MP_SERVICES_PROTOCOL *This,\r
177 OUT UINTN *NumberOfProcessors,\r
178 OUT UINTN *NumberOfEnabledProcessors\r
179 );\r
180\r
181/**\r
182 Gets detailed MP-related information on the requested processor at the\r
183 instant this call is made. This service may only be called from the BSP.\r
184\r
8f3446d8 185 This service retrieves detailed MP-related information about any processor\r
82336c28 186 on the platform. Note the following:\r
187 - The processor information may change during the course of a boot session.\r
188 - The information presented here is entirely MP related.\r
8f3446d8 189\r
82336c28 190 Information regarding the number of caches and their sizes, frequency of operation,\r
8f3446d8 191 slot numbers is all considered platform-related information and is not provided\r
82336c28 192 by this service.\r
193\r
194 @param[in] This A pointer to the EFI_MP_SERVICES_PROTOCOL\r
195 instance.\r
196 @param[in] ProcessorNumber The handle number of processor.\r
197 @param[out] ProcessorInfoBuffer A pointer to the buffer where information for\r
198 the requested processor is deposited.\r
199\r
200 @retval EFI_SUCCESS Processor information was returned.\r
201 @retval EFI_DEVICE_ERROR The calling processor is an AP.\r
202 @retval EFI_INVALID_PARAMETER ProcessorInfoBuffer is NULL.\r
203 @retval EFI_NOT_FOUND The processor with the handle specified by\r
204 ProcessorNumber does not exist in the platform.\r
205\r
206**/\r
207typedef\r
208EFI_STATUS\r
209(EFIAPI *EFI_MP_SERVICES_GET_PROCESSOR_INFO)(\r
210 IN EFI_MP_SERVICES_PROTOCOL *This,\r
211 IN UINTN ProcessorNumber,\r
b635c768 212 OUT EFI_PROCESSOR_INFORMATION *ProcessorInfoBuffer\r
82336c28 213 );\r
214\r
215/**\r
8f3446d8
JF
216 This service executes a caller provided function on all enabled APs. APs can\r
217 run either simultaneously or one at a time in sequence. This service supports\r
218 both blocking and non-blocking requests. The non-blocking requests use EFI\r
219 events so the BSP can detect when the APs have finished. This service may only\r
82336c28 220 be called from the BSP.\r
221\r
8f3446d8
JF
222 This function is used to dispatch all the enabled APs to the function specified\r
223 by Procedure. If any enabled AP is busy, then EFI_NOT_READY is returned\r
82336c28 224 immediately and Procedure is not started on any AP.\r
225\r
8f3446d8
JF
226 If SingleThread is TRUE, all the enabled APs execute the function specified by\r
227 Procedure one by one, in ascending order of processor handle number. Otherwise,\r
82336c28 228 all the enabled APs execute the function specified by Procedure simultaneously.\r
229\r
8f3446d8
JF
230 If WaitEvent is NULL, execution is in blocking mode. The BSP waits until all\r
231 APs finish or TimeoutInMicroSecs expires. Otherwise, execution is in non-blocking\r
232 mode, and the BSP returns from this service without waiting for APs. If a\r
233 non-blocking mode is requested after the UEFI Event EFI_EVENT_GROUP_READY_TO_BOOT\r
82336c28 234 is signaled, then EFI_UNSUPPORTED must be returned.\r
235\r
8f3446d8
JF
236 If the timeout specified by TimeoutInMicroseconds expires before all APs return\r
237 from Procedure, then Procedure on the failed APs is terminated. All enabled APs\r
82336c28 238 are always available for further calls to EFI_MP_SERVICES_PROTOCOL.StartupAllAPs()\r
8f3446d8
JF
239 and EFI_MP_SERVICES_PROTOCOL.StartupThisAP(). If FailedCpuList is not NULL, its\r
240 content points to the list of processor handle numbers in which Procedure was\r
82336c28 241 terminated.\r
242\r
8f3446d8
JF
243 Note: It is the responsibility of the consumer of the EFI_MP_SERVICES_PROTOCOL.StartupAllAPs()\r
244 to make sure that the nature of the code that is executed on the BSP and the\r
245 dispatched APs is well controlled. The MP Services Protocol does not guarantee\r
246 that the Procedure function is MP-safe. Hence, the tasks that can be run in\r
247 parallel are limited to certain independent tasks and well-controlled exclusive\r
248 code. EFI services and protocols may not be called by APs unless otherwise\r
82336c28 249 specified.\r
250\r
8f3446d8 251 In blocking execution mode, BSP waits until all APs finish or\r
82336c28 252 TimeoutInMicroSeconds expires.\r
253\r
8f3446d8
JF
254 In non-blocking execution mode, BSP is freed to return to the caller and then\r
255 proceed to the next task without having to wait for APs. The following\r
82336c28 256 sequence needs to occur in a non-blocking execution mode:\r
257\r
8f3446d8
JF
258 -# The caller that intends to use this MP Services Protocol in non-blocking\r
259 mode creates WaitEvent by calling the EFI CreateEvent() service. The caller\r
260 invokes EFI_MP_SERVICES_PROTOCOL.StartupAllAPs(). If the parameter WaitEvent\r
261 is not NULL, then StartupAllAPs() executes in non-blocking mode. It requests\r
262 the function specified by Procedure to be started on all the enabled APs,\r
82336c28 263 and releases the BSP to continue with other tasks.\r
8f3446d8 264 -# The caller can use the CheckEvent() and WaitForEvent() services to check\r
82336c28 265 the state of the WaitEvent created in step 1.\r
8f3446d8
JF
266 -# When the APs complete their task or TimeoutInMicroSecondss expires, the MP\r
267 Service signals WaitEvent by calling the EFI SignalEvent() function. If\r
268 FailedCpuList is not NULL, its content is available when WaitEvent is\r
269 signaled. If all APs returned from Procedure prior to the timeout, then\r
270 FailedCpuList is set to NULL. If not all APs return from Procedure before\r
271 the timeout, then FailedCpuList is filled in with the list of the failed\r
272 APs. The buffer is allocated by MP Service Protocol using AllocatePool().\r
e8b9799c 273 It is the caller's responsibility to free the buffer with FreePool() service.\r
82336c28 274 -# This invocation of SignalEvent() function informs the caller that invoked\r
275 EFI_MP_SERVICES_PROTOCOL.StartupAllAPs() that either all the APs completed\r
8f3446d8
JF
276 the specified task or a timeout occurred. The contents of FailedCpuList\r
277 can be examined to determine which APs did not complete the specified task\r
82336c28 278 prior to the timeout.\r
279\r
280 @param[in] This A pointer to the EFI_MP_SERVICES_PROTOCOL\r
281 instance.\r
8f3446d8 282 @param[in] Procedure A pointer to the function to be run on\r
82336c28 283 enabled APs of the system. See type\r
284 EFI_AP_PROCEDURE.\r
8f3446d8
JF
285 @param[in] SingleThread If TRUE, then all the enabled APs execute\r
286 the function specified by Procedure one by\r
287 one, in ascending order of processor handle\r
288 number. If FALSE, then all the enabled APs\r
82336c28 289 execute the function specified by Procedure\r
290 simultaneously.\r
291 @param[in] WaitEvent The event created by the caller with CreateEvent()\r
8f3446d8
JF
292 service. If it is NULL, then execute in\r
293 blocking mode. BSP waits until all APs finish\r
294 or TimeoutInMicroSeconds expires. If it's\r
295 not NULL, then execute in non-blocking mode.\r
296 BSP requests the function specified by\r
297 Procedure to be started on all the enabled\r
298 APs, and go on executing immediately. If\r
af2dc6a7 299 all return from Procedure, or TimeoutInMicroSeconds\r
8f3446d8
JF
300 expires, this event is signaled. The BSP\r
301 can use the CheckEvent() or WaitForEvent()\r
302 services to check the state of event. Type\r
303 EFI_EVENT is defined in CreateEvent() in\r
304 the Unified Extensible Firmware Interface\r
305 Specification.\r
306 @param[in] TimeoutInMicrosecsond Indicates the time limit in microseconds for\r
307 APs to return from Procedure, either for\r
308 blocking or non-blocking mode. Zero means\r
309 infinity. If the timeout expires before\r
82336c28 310 all APs return from Procedure, then Procedure\r
8f3446d8
JF
311 on the failed APs is terminated. All enabled\r
312 APs are available for next function assigned\r
313 by EFI_MP_SERVICES_PROTOCOL.StartupAllAPs()\r
82336c28 314 or EFI_MP_SERVICES_PROTOCOL.StartupThisAP().\r
8f3446d8
JF
315 If the timeout expires in blocking mode,\r
316 BSP returns EFI_TIMEOUT. If the timeout\r
317 expires in non-blocking mode, WaitEvent\r
82336c28 318 is signaled with SignalEvent().\r
8f3446d8 319 @param[in] ProcedureArgument The parameter passed into Procedure for\r
82336c28 320 all APs.\r
8f3446d8
JF
321 @param[out] FailedCpuList If NULL, this parameter is ignored. Otherwise,\r
322 if all APs finish successfully, then its\r
323 content is set to NULL. If not all APs\r
324 finish before timeout expires, then its\r
325 content is set to address of the buffer\r
326 holding handle numbers of the failed APs.\r
327 The buffer is allocated by MP Service Protocol,\r
328 and it's the caller's responsibility to\r
82336c28 329 free the buffer with FreePool() service.\r
8f3446d8
JF
330 In blocking mode, it is ready for consumption\r
331 when the call returns. In non-blocking mode,\r
332 it is ready when WaitEvent is signaled. The\r
333 list of failed CPU is terminated by\r
82336c28 334 END_OF_CPU_LIST.\r
335\r
8f3446d8 336 @retval EFI_SUCCESS In blocking mode, all APs have finished before\r
82336c28 337 the timeout expired.\r
8f3446d8 338 @retval EFI_SUCCESS In non-blocking mode, function has been dispatched\r
82336c28 339 to all enabled APs.\r
8f3446d8
JF
340 @retval EFI_UNSUPPORTED A non-blocking mode request was made after the\r
341 UEFI event EFI_EVENT_GROUP_READY_TO_BOOT was\r
82336c28 342 signaled.\r
343 @retval EFI_DEVICE_ERROR Caller processor is AP.\r
344 @retval EFI_NOT_STARTED No enabled APs exist in the system.\r
345 @retval EFI_NOT_READY Any enabled APs are busy.\r
8f3446d8 346 @retval EFI_TIMEOUT In blocking mode, the timeout expired before\r
82336c28 347 all enabled APs have finished.\r
348 @retval EFI_INVALID_PARAMETER Procedure is NULL.\r
349\r
350**/\r
351typedef\r
352EFI_STATUS\r
353(EFIAPI *EFI_MP_SERVICES_STARTUP_ALL_APS)(\r
354 IN EFI_MP_SERVICES_PROTOCOL *This,\r
355 IN EFI_AP_PROCEDURE Procedure,\r
356 IN BOOLEAN SingleThread,\r
357 IN EFI_EVENT WaitEvent OPTIONAL,\r
358 IN UINTN TimeoutInMicroSeconds,\r
359 IN VOID *ProcedureArgument OPTIONAL,\r
360 OUT UINTN **FailedCpuList OPTIONAL\r
361 );\r
362\r
363/**\r
8f3446d8
JF
364 This service lets the caller get one enabled AP to execute a caller-provided\r
365 function. The caller can request the BSP to either wait for the completion\r
366 of the AP or just proceed with the next task by using the EFI event mechanism.\r
367 See EFI_MP_SERVICES_PROTOCOL.StartupAllAPs() for more details on non-blocking\r
82336c28 368 execution support. This service may only be called from the BSP.\r
369\r
8f3446d8
JF
370 This function is used to dispatch one enabled AP to the function specified by\r
371 Procedure passing in the argument specified by ProcedureArgument. If WaitEvent\r
372 is NULL, execution is in blocking mode. The BSP waits until the AP finishes or\r
373 TimeoutInMicroSecondss expires. Otherwise, execution is in non-blocking mode.\r
374 BSP proceeds to the next task without waiting for the AP. If a non-blocking mode\r
375 is requested after the UEFI Event EFI_EVENT_GROUP_READY_TO_BOOT is signaled,\r
82336c28 376 then EFI_UNSUPPORTED must be returned.\r
8f3446d8
JF
377\r
378 If the timeout specified by TimeoutInMicroseconds expires before the AP returns\r
379 from Procedure, then execution of Procedure by the AP is terminated. The AP is\r
380 available for subsequent calls to EFI_MP_SERVICES_PROTOCOL.StartupAllAPs() and\r
82336c28 381 EFI_MP_SERVICES_PROTOCOL.StartupThisAP().\r
382\r
383 @param[in] This A pointer to the EFI_MP_SERVICES_PROTOCOL\r
384 instance.\r
51d4779d
JF
385 @param[in] Procedure A pointer to the function to be run on the\r
386 designated AP of the system. See type\r
82336c28 387 EFI_AP_PROCEDURE.\r
8f3446d8 388 @param[in] ProcessorNumber The handle number of the AP. The range is\r
82336c28 389 from 0 to the total number of logical\r
8f3446d8 390 processors minus 1. The total number of\r
82336c28 391 logical processors can be retrieved by\r
392 EFI_MP_SERVICES_PROTOCOL.GetNumberOfProcessors().\r
393 @param[in] WaitEvent The event created by the caller with CreateEvent()\r
8f3446d8
JF
394 service. If it is NULL, then execute in\r
395 blocking mode. BSP waits until this AP finish\r
396 or TimeoutInMicroSeconds expires. If it's\r
397 not NULL, then execute in non-blocking mode.\r
398 BSP requests the function specified by\r
399 Procedure to be started on this AP,\r
51d4779d
JF
400 and go on executing immediately. If this AP\r
401 return from Procedure or TimeoutInMicroSeconds\r
8f3446d8
JF
402 expires, this event is signaled. The BSP\r
403 can use the CheckEvent() or WaitForEvent()\r
404 services to check the state of event. Type\r
405 EFI_EVENT is defined in CreateEvent() in\r
406 the Unified Extensible Firmware Interface\r
407 Specification.\r
408 @param[in] TimeoutInMicrosecsond Indicates the time limit in microseconds for\r
409 this AP to finish this Procedure, either for\r
410 blocking or non-blocking mode. Zero means\r
411 infinity. If the timeout expires before\r
51d4779d 412 this AP returns from Procedure, then Procedure\r
8f3446d8
JF
413 on the AP is terminated. The\r
414 AP is available for next function assigned\r
415 by EFI_MP_SERVICES_PROTOCOL.StartupAllAPs()\r
82336c28 416 or EFI_MP_SERVICES_PROTOCOL.StartupThisAP().\r
8f3446d8
JF
417 If the timeout expires in blocking mode,\r
418 BSP returns EFI_TIMEOUT. If the timeout\r
419 expires in non-blocking mode, WaitEvent\r
82336c28 420 is signaled with SignalEvent().\r
51d4779d
JF
421 @param[in] ProcedureArgument The parameter passed into Procedure on the\r
422 specified AP.\r
8f3446d8 423 @param[out] Finished If NULL, this parameter is ignored. In\r
82336c28 424 blocking mode, this parameter is ignored.\r
8f3446d8 425 In non-blocking mode, if AP returns from\r
82336c28 426 Procedure before the timeout expires, its\r
8f3446d8 427 content is set to TRUE. Otherwise, the\r
82336c28 428 value is set to FALSE. The caller can\r
8f3446d8 429 determine if the AP returned from Procedure\r
82336c28 430 by evaluating this value.\r
431\r
8f3446d8 432 @retval EFI_SUCCESS In blocking mode, specified AP finished before\r
82336c28 433 the timeout expires.\r
8f3446d8 434 @retval EFI_SUCCESS In non-blocking mode, the function has been\r
82336c28 435 dispatched to specified AP.\r
8f3446d8
JF
436 @retval EFI_UNSUPPORTED A non-blocking mode request was made after the\r
437 UEFI event EFI_EVENT_GROUP_READY_TO_BOOT was\r
82336c28 438 signaled.\r
439 @retval EFI_DEVICE_ERROR The calling processor is an AP.\r
8f3446d8 440 @retval EFI_TIMEOUT In blocking mode, the timeout expired before\r
82336c28 441 the specified AP has finished.\r
442 @retval EFI_NOT_READY The specified AP is busy.\r
8f3446d8 443 @retval EFI_NOT_FOUND The processor with the handle specified by\r
82336c28 444 ProcessorNumber does not exist.\r
445 @retval EFI_INVALID_PARAMETER ProcessorNumber specifies the BSP or disabled AP.\r
446 @retval EFI_INVALID_PARAMETER Procedure is NULL.\r
447\r
448**/\r
449typedef\r
450EFI_STATUS\r
451(EFIAPI *EFI_MP_SERVICES_STARTUP_THIS_AP)(\r
452 IN EFI_MP_SERVICES_PROTOCOL *This,\r
453 IN EFI_AP_PROCEDURE Procedure,\r
454 IN UINTN ProcessorNumber,\r
455 IN EFI_EVENT WaitEvent OPTIONAL,\r
456 IN UINTN TimeoutInMicroseconds,\r
457 IN VOID *ProcedureArgument OPTIONAL,\r
458 OUT BOOLEAN *Finished OPTIONAL\r
459 );\r
460\r
461/**\r
8f3446d8
JF
462 This service switches the requested AP to be the BSP from that point onward.\r
463 This service changes the BSP for all purposes. This call can only be performed\r
82336c28 464 by the current BSP.\r
465\r
8f3446d8
JF
466 This service switches the requested AP to be the BSP from that point onward.\r
467 This service changes the BSP for all purposes. The new BSP can take over the\r
468 execution of the old BSP and continue seamlessly from where the old one left\r
469 off. This service may not be supported after the UEFI Event EFI_EVENT_GROUP_READY_TO_BOOT\r
82336c28 470 is signaled.\r
471\r
8f3446d8 472 If the BSP cannot be switched prior to the return from this service, then\r
82336c28 473 EFI_UNSUPPORTED must be returned.\r
474\r
475 @param[in] This A pointer to the EFI_MP_SERVICES_PROTOCOL instance.\r
8f3446d8
JF
476 @param[in] ProcessorNumber The handle number of AP that is to become the new\r
477 BSP. The range is from 0 to the total number of\r
478 logical processors minus 1. The total number of\r
82336c28 479 logical processors can be retrieved by\r
480 EFI_MP_SERVICES_PROTOCOL.GetNumberOfProcessors().\r
8f3446d8 481 @param[in] EnableOldBSP If TRUE, then the old BSP will be listed as an\r
82336c28 482 enabled AP. Otherwise, it will be disabled.\r
483\r
484 @retval EFI_SUCCESS BSP successfully switched.\r
8f3446d8 485 @retval EFI_UNSUPPORTED Switching the BSP cannot be completed prior to\r
82336c28 486 this service returning.\r
487 @retval EFI_UNSUPPORTED Switching the BSP is not supported.\r
da71a637 488 @retval EFI_DEVICE_ERROR The calling processor is an AP.\r
82336c28 489 @retval EFI_NOT_FOUND The processor with the handle specified by\r
490 ProcessorNumber does not exist.\r
8f3446d8 491 @retval EFI_INVALID_PARAMETER ProcessorNumber specifies the current BSP or\r
82336c28 492 a disabled AP.\r
493 @retval EFI_NOT_READY The specified AP is busy.\r
494\r
495**/\r
496typedef\r
497EFI_STATUS\r
498(EFIAPI *EFI_MP_SERVICES_SWITCH_BSP)(\r
499 IN EFI_MP_SERVICES_PROTOCOL *This,\r
500 IN UINTN ProcessorNumber,\r
501 IN BOOLEAN EnableOldBSP\r
502 );\r
503\r
504/**\r
8f3446d8 505 This service lets the caller enable or disable an AP from this point onward.\r
82336c28 506 This service may only be called from the BSP.\r
507\r
8f3446d8
JF
508 This service allows the caller enable or disable an AP from this point onward.\r
509 The caller can optionally specify the health status of the AP by Health. If\r
510 an AP is being disabled, then the state of the disabled AP is implementation\r
511 dependent. If an AP is enabled, then the implementation must guarantee that a\r
512 complete initialization sequence is performed on the AP, so the AP is in a state\r
513 that is compatible with an MP operating system. This service may not be supported\r
82336c28 514 after the UEFI Event EFI_EVENT_GROUP_READY_TO_BOOT is signaled.\r
515\r
8f3446d8 516 If the enable or disable AP operation cannot be completed prior to the return\r
82336c28 517 from this service, then EFI_UNSUPPORTED must be returned.\r
518\r
519 @param[in] This A pointer to the EFI_MP_SERVICES_PROTOCOL instance.\r
51d4779d 520 @param[in] ProcessorNumber The handle number of AP.\r
8f3446d8
JF
521 The range is from 0 to the total number of\r
522 logical processors minus 1. The total number of\r
82336c28 523 logical processors can be retrieved by\r
524 EFI_MP_SERVICES_PROTOCOL.GetNumberOfProcessors().\r
8f3446d8 525 @param[in] EnableAP Specifies the new state for the processor for\r
82336c28 526 enabled, FALSE for disabled.\r
8f3446d8
JF
527 @param[in] HealthFlag If not NULL, a pointer to a value that specifies\r
528 the new health status of the AP. This flag\r
529 corresponds to StatusFlag defined in\r
530 EFI_MP_SERVICES_PROTOCOL.GetProcessorInfo(). Only\r
531 the PROCESSOR_HEALTH_STATUS_BIT is used. All other\r
532 bits are ignored. If it is NULL, this parameter\r
82336c28 533 is ignored.\r
534\r
af2dc6a7 535 @retval EFI_SUCCESS The specified AP was enabled or disabled successfully.\r
8f3446d8 536 @retval EFI_UNSUPPORTED Enabling or disabling an AP cannot be completed\r
82336c28 537 prior to this service returning.\r
538 @retval EFI_UNSUPPORTED Enabling or disabling an AP is not supported.\r
539 @retval EFI_DEVICE_ERROR The calling processor is an AP.\r
540 @retval EFI_NOT_FOUND Processor with the handle specified by ProcessorNumber\r
541 does not exist.\r
542 @retval EFI_INVALID_PARAMETER ProcessorNumber specifies the BSP.\r
543\r
544**/\r
545typedef\r
546EFI_STATUS\r
547(EFIAPI *EFI_MP_SERVICES_ENABLEDISABLEAP)(\r
548 IN EFI_MP_SERVICES_PROTOCOL *This,\r
549 IN UINTN ProcessorNumber,\r
b635c768 550 IN BOOLEAN EnableAP,\r
82336c28 551 IN UINT32 *HealthFlag OPTIONAL\r
552 );\r
553\r
554/**\r
8f3446d8 555 This return the handle number for the calling processor. This service may be\r
82336c28 556 called from the BSP and APs.\r
557\r
8f3446d8
JF
558 This service returns the processor handle number for the calling processor.\r
559 The returned value is in the range from 0 to the total number of logical\r
560 processors minus 1. The total number of logical processors can be retrieved\r
561 with EFI_MP_SERVICES_PROTOCOL.GetNumberOfProcessors(). This service may be\r
562 called from the BSP and APs. If ProcessorNumber is NULL, then EFI_INVALID_PARAMETER\r
563 is returned. Otherwise, the current processors handle number is returned in\r
82336c28 564 ProcessorNumber, and EFI_SUCCESS is returned.\r
565\r
566 @param[in] This A pointer to the EFI_MP_SERVICES_PROTOCOL instance.\r
51d4779d 567 @param[in] ProcessorNumber Pointer to the handle number of AP.\r
8f3446d8
JF
568 The range is from 0 to the total number of\r
569 logical processors minus 1. The total number of\r
82336c28 570 logical processors can be retrieved by\r
571 EFI_MP_SERVICES_PROTOCOL.GetNumberOfProcessors().\r
572\r
8f3446d8 573 @retval EFI_SUCCESS The current processor handle number was returned\r
82336c28 574 in ProcessorNumber.\r
af2dc6a7 575 @retval EFI_INVALID_PARAMETER ProcessorNumber is NULL.\r
82336c28 576\r
577**/\r
578typedef\r
579EFI_STATUS\r
580(EFIAPI *EFI_MP_SERVICES_WHOAMI)(\r
581 IN EFI_MP_SERVICES_PROTOCOL *This,\r
582 OUT UINTN *ProcessorNumber\r
583 );\r
584\r
585///\r
8f3446d8 586/// When installed, the MP Services Protocol produces a collection of services\r
82336c28 587/// that are needed for MP management.\r
588///\r
8f3446d8
JF
589/// Before the UEFI event EFI_EVENT_GROUP_READY_TO_BOOT is signaled, the module\r
590/// that produces this protocol is required to place all APs into an idle state\r
591/// whenever the APs are disabled or the APs are not executing code as requested\r
592/// through the StartupAllAPs() or StartupThisAP() services. The idle state of\r
593/// an AP before the UEFI event EFI_EVENT_GROUP_READY_TO_BOOT is signaled is\r
82336c28 594/// implementation dependent.\r
595///\r
8f3446d8
JF
596/// After the UEFI event EFI_EVENT_GROUP_READY_TO_BOOT is signaled, all the APs\r
597/// must be placed in the OS compatible CPU state as defined by the UEFI\r
598/// Specification. Implementations of this protocol may use the UEFI event\r
599/// EFI_EVENT_GROUP_READY_TO_BOOT to force APs into the OS compatible state as\r
600/// defined by the UEFI Specification. Modules that use this protocol must\r
601/// guarantee that all non-blocking mode requests on all APs have been completed\r
602/// before the UEFI event EFI_EVENT_GROUP_READY_TO_BOOT is signaled. Since the\r
603/// order that event notification functions in the same event group are executed\r
604/// is not deterministic, an event of type EFI_EVENT_GROUP_READY_TO_BOOT cannot\r
82336c28 605/// be used to guarantee that APs have completed their non-blocking mode requests.\r
606///\r
8f3446d8
JF
607/// When the UEFI event EFI_EVENT_GROUP_READY_TO_BOOT is signaled, the StartAllAPs()\r
608/// and StartupThisAp() services must no longer support non-blocking mode requests.\r
609/// The support for SwitchBSP() and EnableDisableAP() may no longer be supported\r
610/// after this event is signaled. Since UEFI Applications and UEFI OS Loaders\r
611/// execute after the UEFI event EFI_EVENT_GROUP_READY_TO_BOOT is signaled, these\r
82336c28 612/// UEFI images must be aware that the functionality of this protocol may be reduced.\r
8f3446d8 613///\r
82336c28 614struct _EFI_MP_SERVICES_PROTOCOL {\r
615 EFI_MP_SERVICES_GET_NUMBER_OF_PROCESSORS GetNumberOfProcessors;\r
616 EFI_MP_SERVICES_GET_PROCESSOR_INFO GetProcessorInfo;\r
617 EFI_MP_SERVICES_STARTUP_ALL_APS StartupAllAPs;\r
618 EFI_MP_SERVICES_STARTUP_THIS_AP StartupThisAP;\r
619 EFI_MP_SERVICES_SWITCH_BSP SwitchBSP;\r
620 EFI_MP_SERVICES_ENABLEDISABLEAP EnableDisableAP;\r
621 EFI_MP_SERVICES_WHOAMI WhoAmI;\r
622};\r
623\r
624extern EFI_GUID gEfiMpServiceProtocolGuid;\r
625\r
626#endif\r