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