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