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