]> git.proxmox.com Git - mirror_edk2.git/blob - UefiCpuPkg/CpuDxe/CpuMp.h
UefiCpuPkg/CpuDxe: introduce ResetApStackless()
[mirror_edk2.git] / UefiCpuPkg / CpuDxe / CpuMp.h
1 /** @file
2 CPU DXE MP support
3
4 Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 **/
14
15 #ifndef _CPU_MP_H_
16 #define _CPU_MP_H_
17
18 #include <Protocol/MpService.h>
19 #include <Library/SynchronizationLib.h>
20
21 /**
22 Initialize Multi-processor support.
23
24 **/
25 VOID
26 InitializeMpSupport (
27 VOID
28 );
29
30 typedef
31 VOID
32 (EFIAPI *STACKLESS_AP_ENTRY_POINT)(
33 VOID
34 );
35
36 /**
37 Starts the Application Processors and directs them to jump to the
38 specified routine.
39
40 The processor jumps to this code in flat mode, but the processor's
41 stack is not initialized.
42
43 @retval EFI_SUCCESS The APs were started
44
45 **/
46 EFI_STATUS
47 StartApsStackless (
48 VOID
49 );
50
51 /**
52 The AP entry point that the Startup-IPI target code will jump to.
53
54 The processor jumps to this code in flat mode, but the processor's
55 stack is not initialized.
56
57 **/
58 VOID
59 EFIAPI
60 AsmApEntryPoint (
61 VOID
62 );
63
64 /**
65 Releases the lock preventing other APs from using the shared AP
66 stack.
67
68 Once the AP has transitioned to using a new stack, it can call this
69 function to allow another AP to proceed with using the shared stack.
70
71 **/
72 VOID
73 EFIAPI
74 AsmApDoneWithCommonStack (
75 VOID
76 );
77
78 typedef enum {
79 CpuStateIdle,
80 CpuStateBlocked,
81 CpuStateReady,
82 CpuStateBuzy,
83 CpuStateFinished
84 } CPU_STATE;
85
86 /**
87 Define Individual Processor Data block.
88
89 **/
90 typedef struct {
91 EFI_PROCESSOR_INFORMATION Info;
92 SPIN_LOCK CpuDataLock;
93 volatile CPU_STATE State;
94
95 EFI_AP_PROCEDURE Procedure;
96 VOID *Parameter;
97 BOOLEAN *Finished;
98 INTN Timeout;
99 EFI_EVENT WaitEvent;
100 BOOLEAN TimeoutActive;
101 EFI_EVENT CheckThisAPEvent;
102 VOID *TopOfStack;
103 } CPU_DATA_BLOCK;
104
105 /**
106 Define MP data block which consumes individual processor block.
107
108 **/
109 typedef struct {
110 CPU_DATA_BLOCK *CpuDatas;
111 UINTN NumberOfProcessors;
112 UINTN NumberOfEnabledProcessors;
113
114 EFI_AP_PROCEDURE Procedure;
115 VOID *ProcedureArgument;
116 UINTN StartCount;
117 UINTN FinishCount;
118 BOOLEAN SingleThread;
119 UINTN **FailedList;
120 UINTN FailedListIndex;
121 INTN Timeout;
122 EFI_EVENT WaitEvent;
123 BOOLEAN TimeoutActive;
124 EFI_EVENT CheckAllAPsEvent;
125 } MP_SYSTEM_DATA;
126
127 /**
128 This function is called by all processors (both BSP and AP) once and collects MP related data.
129
130 @param Bsp TRUE if the CPU is BSP
131 @param ProcessorNumber The specific processor number
132
133 @retval EFI_SUCCESS Data for the processor collected and filled in
134
135 **/
136 EFI_STATUS
137 FillInProcessorInformation (
138 IN BOOLEAN Bsp,
139 IN UINTN ProcessorNumber
140 );
141
142 /**
143 This service retrieves the number of logical processor in the platform
144 and the number of those logical processors that are enabled on this boot.
145 This service may only be called from the BSP.
146
147 This function is used to retrieve the following information:
148 - The number of logical processors that are present in the system.
149 - The number of enabled logical processors in the system at the instant
150 this call is made.
151
152 Because MP Service Protocol provides services to enable and disable processors
153 dynamically, the number of enabled logical processors may vary during the
154 course of a boot session.
155
156 If this service is called from an AP, then EFI_DEVICE_ERROR is returned.
157 If NumberOfProcessors or NumberOfEnabledProcessors is NULL, then
158 EFI_INVALID_PARAMETER is returned. Otherwise, the total number of processors
159 is returned in NumberOfProcessors, the number of currently enabled processor
160 is returned in NumberOfEnabledProcessors, and EFI_SUCCESS is returned.
161
162 @param[in] This A pointer to the EFI_MP_SERVICES_PROTOCOL
163 instance.
164 @param[out] NumberOfProcessors Pointer to the total number of logical
165 processors in the system, including the BSP
166 and disabled APs.
167 @param[out] NumberOfEnabledProcessors Pointer to the number of enabled logical
168 processors that exist in system, including
169 the BSP.
170
171 @retval EFI_SUCCESS The number of logical processors and enabled
172 logical processors was retrieved.
173 @retval EFI_DEVICE_ERROR The calling processor is an AP.
174 @retval EFI_INVALID_PARAMETER NumberOfProcessors is NULL.
175 @retval EFI_INVALID_PARAMETER NumberOfEnabledProcessors is NULL.
176
177 **/
178 EFI_STATUS
179 EFIAPI
180 GetNumberOfProcessors (
181 IN EFI_MP_SERVICES_PROTOCOL *This,
182 OUT UINTN *NumberOfProcessors,
183 OUT UINTN *NumberOfEnabledProcessors
184 );
185
186 /**
187 Gets detailed MP-related information on the requested processor at the
188 instant this call is made. This service may only be called from the BSP.
189
190 This service retrieves detailed MP-related information about any processor
191 on the platform. Note the following:
192 - The processor information may change during the course of a boot session.
193 - The information presented here is entirely MP related.
194
195 Information regarding the number of caches and their sizes, frequency of operation,
196 slot numbers is all considered platform-related information and is not provided
197 by this service.
198
199 @param[in] This A pointer to the EFI_MP_SERVICES_PROTOCOL
200 instance.
201 @param[in] ProcessorNumber The handle number of processor.
202 @param[out] ProcessorInfoBuffer A pointer to the buffer where information for
203 the requested processor is deposited.
204
205 @retval EFI_SUCCESS Processor information was returned.
206 @retval EFI_DEVICE_ERROR The calling processor is an AP.
207 @retval EFI_INVALID_PARAMETER ProcessorInfoBuffer is NULL.
208 @retval EFI_NOT_FOUND The processor with the handle specified by
209 ProcessorNumber does not exist in the platform.
210
211 **/
212 EFI_STATUS
213 EFIAPI
214 GetProcessorInfo (
215 IN EFI_MP_SERVICES_PROTOCOL *This,
216 IN UINTN ProcessorNumber,
217 OUT EFI_PROCESSOR_INFORMATION *ProcessorInfoBuffer
218 );
219
220 /**
221 This service executes a caller provided function on all enabled APs. APs can
222 run either simultaneously or one at a time in sequence. This service supports
223 both blocking and non-blocking requests. The non-blocking requests use EFI
224 events so the BSP can detect when the APs have finished. This service may only
225 be called from the BSP.
226
227 This function is used to dispatch all the enabled APs to the function specified
228 by Procedure. If any enabled AP is busy, then EFI_NOT_READY is returned
229 immediately and Procedure is not started on any AP.
230
231 If SingleThread is TRUE, all the enabled APs execute the function specified by
232 Procedure one by one, in ascending order of processor handle number. Otherwise,
233 all the enabled APs execute the function specified by Procedure simultaneously.
234
235 If WaitEvent is NULL, execution is in blocking mode. The BSP waits until all
236 APs finish or TimeoutInMicroseconds expires. Otherwise, execution is in non-blocking
237 mode, and the BSP returns from this service without waiting for APs. If a
238 non-blocking mode is requested after the UEFI Event EFI_EVENT_GROUP_READY_TO_BOOT
239 is signaled, then EFI_UNSUPPORTED must be returned.
240
241 If the timeout specified by TimeoutInMicroseconds expires before all APs return
242 from Procedure, then Procedure on the failed APs is terminated. All enabled APs
243 are always available for further calls to EFI_MP_SERVICES_PROTOCOL.StartupAllAPs()
244 and EFI_MP_SERVICES_PROTOCOL.StartupThisAP(). If FailedCpuList is not NULL, its
245 content points to the list of processor handle numbers in which Procedure was
246 terminated.
247
248 Note: It is the responsibility of the consumer of the EFI_MP_SERVICES_PROTOCOL.StartupAllAPs()
249 to make sure that the nature of the code that is executed on the BSP and the
250 dispatched APs is well controlled. The MP Services Protocol does not guarantee
251 that the Procedure function is MP-safe. Hence, the tasks that can be run in
252 parallel are limited to certain independent tasks and well-controlled exclusive
253 code. EFI services and protocols may not be called by APs unless otherwise
254 specified.
255
256 In blocking execution mode, BSP waits until all APs finish or
257 TimeoutInMicroseconds expires.
258
259 In non-blocking execution mode, BSP is freed to return to the caller and then
260 proceed to the next task without having to wait for APs. The following
261 sequence needs to occur in a non-blocking execution mode:
262
263 -# The caller that intends to use this MP Services Protocol in non-blocking
264 mode creates WaitEvent by calling the EFI CreateEvent() service. The caller
265 invokes EFI_MP_SERVICES_PROTOCOL.StartupAllAPs(). If the parameter WaitEvent
266 is not NULL, then StartupAllAPs() executes in non-blocking mode. It requests
267 the function specified by Procedure to be started on all the enabled APs,
268 and releases the BSP to continue with other tasks.
269 -# The caller can use the CheckEvent() and WaitForEvent() services to check
270 the state of the WaitEvent created in step 1.
271 -# When the APs complete their task or TimeoutInMicroSecondss expires, the MP
272 Service signals WaitEvent by calling the EFI SignalEvent() function. If
273 FailedCpuList is not NULL, its content is available when WaitEvent is
274 signaled. If all APs returned from Procedure prior to the timeout, then
275 FailedCpuList is set to NULL. If not all APs return from Procedure before
276 the timeout, then FailedCpuList is filled in with the list of the failed
277 APs. The buffer is allocated by MP Service Protocol using AllocatePool().
278 It is the caller's responsibility to free the buffer with FreePool() service.
279 -# This invocation of SignalEvent() function informs the caller that invoked
280 EFI_MP_SERVICES_PROTOCOL.StartupAllAPs() that either all the APs completed
281 the specified task or a timeout occurred. The contents of FailedCpuList
282 can be examined to determine which APs did not complete the specified task
283 prior to the timeout.
284
285 @param[in] This A pointer to the EFI_MP_SERVICES_PROTOCOL
286 instance.
287 @param[in] Procedure A pointer to the function to be run on
288 enabled APs of the system. See type
289 EFI_AP_PROCEDURE.
290 @param[in] SingleThread If TRUE, then all the enabled APs execute
291 the function specified by Procedure one by
292 one, in ascending order of processor handle
293 number. If FALSE, then all the enabled APs
294 execute the function specified by Procedure
295 simultaneously.
296 @param[in] WaitEvent The event created by the caller with CreateEvent()
297 service. If it is NULL, then execute in
298 blocking mode. BSP waits until all APs finish
299 or TimeoutInMicroseconds expires. If it's
300 not NULL, then execute in non-blocking mode.
301 BSP requests the function specified by
302 Procedure to be started on all the enabled
303 APs, and go on executing immediately. If
304 all return from Procedure, or TimeoutInMicroseconds
305 expires, this event is signaled. The BSP
306 can use the CheckEvent() or WaitForEvent()
307 services to check the state of event. Type
308 EFI_EVENT is defined in CreateEvent() in
309 the Unified Extensible Firmware Interface
310 Specification.
311 @param[in] TimeoutInMicroseconds Indicates the time limit in microseconds for
312 APs to return from Procedure, either for
313 blocking or non-blocking mode. Zero means
314 infinity. If the timeout expires before
315 all APs return from Procedure, then Procedure
316 on the failed APs is terminated. All enabled
317 APs are available for next function assigned
318 by EFI_MP_SERVICES_PROTOCOL.StartupAllAPs()
319 or EFI_MP_SERVICES_PROTOCOL.StartupThisAP().
320 If the timeout expires in blocking mode,
321 BSP returns EFI_TIMEOUT. If the timeout
322 expires in non-blocking mode, WaitEvent
323 is signaled with SignalEvent().
324 @param[in] ProcedureArgument The parameter passed into Procedure for
325 all APs.
326 @param[out] FailedCpuList If NULL, this parameter is ignored. Otherwise,
327 if all APs finish successfully, then its
328 content is set to NULL. If not all APs
329 finish before timeout expires, then its
330 content is set to address of the buffer
331 holding handle numbers of the failed APs.
332 The buffer is allocated by MP Service Protocol,
333 and it's the caller's responsibility to
334 free the buffer with FreePool() service.
335 In blocking mode, it is ready for consumption
336 when the call returns. In non-blocking mode,
337 it is ready when WaitEvent is signaled. The
338 list of failed CPU is terminated by
339 END_OF_CPU_LIST.
340
341 @retval EFI_SUCCESS In blocking mode, all APs have finished before
342 the timeout expired.
343 @retval EFI_SUCCESS In non-blocking mode, function has been dispatched
344 to all enabled APs.
345 @retval EFI_UNSUPPORTED A non-blocking mode request was made after the
346 UEFI event EFI_EVENT_GROUP_READY_TO_BOOT was
347 signaled.
348 @retval EFI_DEVICE_ERROR Caller processor is AP.
349 @retval EFI_NOT_STARTED No enabled APs exist in the system.
350 @retval EFI_NOT_READY Any enabled APs are busy.
351 @retval EFI_TIMEOUT In blocking mode, the timeout expired before
352 all enabled APs have finished.
353 @retval EFI_INVALID_PARAMETER Procedure is NULL.
354
355 **/
356 EFI_STATUS
357 EFIAPI
358 StartupAllAPs (
359 IN EFI_MP_SERVICES_PROTOCOL *This,
360 IN EFI_AP_PROCEDURE Procedure,
361 IN BOOLEAN SingleThread,
362 IN EFI_EVENT WaitEvent OPTIONAL,
363 IN UINTN TimeoutInMicroseconds,
364 IN VOID *ProcedureArgument OPTIONAL,
365 OUT UINTN **FailedCpuList OPTIONAL
366 );
367
368 /**
369 This service lets the caller get one enabled AP to execute a caller-provided
370 function. The caller can request the BSP to either wait for the completion
371 of the AP or just proceed with the next task by using the EFI event mechanism.
372 See EFI_MP_SERVICES_PROTOCOL.StartupAllAPs() for more details on non-blocking
373 execution support. This service may only be called from the BSP.
374
375 This function is used to dispatch one enabled AP to the function specified by
376 Procedure passing in the argument specified by ProcedureArgument. If WaitEvent
377 is NULL, execution is in blocking mode. The BSP waits until the AP finishes or
378 TimeoutInMicroSecondss expires. Otherwise, execution is in non-blocking mode.
379 BSP proceeds to the next task without waiting for the AP. If a non-blocking mode
380 is requested after the UEFI Event EFI_EVENT_GROUP_READY_TO_BOOT is signaled,
381 then EFI_UNSUPPORTED must be returned.
382
383 If the timeout specified by TimeoutInMicroseconds expires before the AP returns
384 from Procedure, then execution of Procedure by the AP is terminated. The AP is
385 available for subsequent calls to EFI_MP_SERVICES_PROTOCOL.StartupAllAPs() and
386 EFI_MP_SERVICES_PROTOCOL.StartupThisAP().
387
388 @param[in] This A pointer to the EFI_MP_SERVICES_PROTOCOL
389 instance.
390 @param[in] Procedure A pointer to the function to be run on
391 enabled APs of the system. See type
392 EFI_AP_PROCEDURE.
393 @param[in] ProcessorNumber The handle number of the AP. The range is
394 from 0 to the total number of logical
395 processors minus 1. The total number of
396 logical processors can be retrieved by
397 EFI_MP_SERVICES_PROTOCOL.GetNumberOfProcessors().
398 @param[in] WaitEvent The event created by the caller with CreateEvent()
399 service. If it is NULL, then execute in
400 blocking mode. BSP waits until all APs finish
401 or TimeoutInMicroseconds expires. If it's
402 not NULL, then execute in non-blocking mode.
403 BSP requests the function specified by
404 Procedure to be started on all the enabled
405 APs, and go on executing immediately. If
406 all return from Procedure or TimeoutInMicroseconds
407 expires, this event is signaled. The BSP
408 can use the CheckEvent() or WaitForEvent()
409 services to check the state of event. Type
410 EFI_EVENT is defined in CreateEvent() in
411 the Unified Extensible Firmware Interface
412 Specification.
413 @param[in] TimeoutInMicroseconds Indicates the time limit in microseconds for
414 APs to return from Procedure, either for
415 blocking or non-blocking mode. Zero means
416 infinity. If the timeout expires before
417 all APs return from Procedure, then Procedure
418 on the failed APs is terminated. All enabled
419 APs are available for next function assigned
420 by EFI_MP_SERVICES_PROTOCOL.StartupAllAPs()
421 or EFI_MP_SERVICES_PROTOCOL.StartupThisAP().
422 If the timeout expires in blocking mode,
423 BSP returns EFI_TIMEOUT. If the timeout
424 expires in non-blocking mode, WaitEvent
425 is signaled with SignalEvent().
426 @param[in] ProcedureArgument The parameter passed into Procedure for
427 all APs.
428 @param[out] Finished If NULL, this parameter is ignored. In
429 blocking mode, this parameter is ignored.
430 In non-blocking mode, if AP returns from
431 Procedure before the timeout expires, its
432 content is set to TRUE. Otherwise, the
433 value is set to FALSE. The caller can
434 determine if the AP returned from Procedure
435 by evaluating this value.
436
437 @retval EFI_SUCCESS In blocking mode, specified AP finished before
438 the timeout expires.
439 @retval EFI_SUCCESS In non-blocking mode, the function has been
440 dispatched to specified AP.
441 @retval EFI_UNSUPPORTED A non-blocking mode request was made after the
442 UEFI event EFI_EVENT_GROUP_READY_TO_BOOT was
443 signaled.
444 @retval EFI_DEVICE_ERROR The calling processor is an AP.
445 @retval EFI_TIMEOUT In blocking mode, the timeout expired before
446 the specified AP has finished.
447 @retval EFI_NOT_READY The specified AP is busy.
448 @retval EFI_NOT_FOUND The processor with the handle specified by
449 ProcessorNumber does not exist.
450 @retval EFI_INVALID_PARAMETER ProcessorNumber specifies the BSP or disabled AP.
451 @retval EFI_INVALID_PARAMETER Procedure is NULL.
452
453 **/
454 EFI_STATUS
455 EFIAPI
456 StartupThisAP (
457 IN EFI_MP_SERVICES_PROTOCOL *This,
458 IN EFI_AP_PROCEDURE Procedure,
459 IN UINTN ProcessorNumber,
460 IN EFI_EVENT WaitEvent OPTIONAL,
461 IN UINTN TimeoutInMicroseconds,
462 IN VOID *ProcedureArgument OPTIONAL,
463 OUT BOOLEAN *Finished OPTIONAL
464 );
465
466 /**
467 This service switches the requested AP to be the BSP from that point onward.
468 This service changes the BSP for all purposes. This call can only be performed
469 by the current BSP.
470
471 This service switches the requested AP to be the BSP from that point onward.
472 This service changes the BSP for all purposes. The new BSP can take over the
473 execution of the old BSP and continue seamlessly from where the old one left
474 off. This service may not be supported after the UEFI Event EFI_EVENT_GROUP_READY_TO_BOOT
475 is signaled.
476
477 If the BSP cannot be switched prior to the return from this service, then
478 EFI_UNSUPPORTED must be returned.
479
480 @param[in] This A pointer to the EFI_MP_SERVICES_PROTOCOL instance.
481 @param[in] ProcessorNumber The handle number of AP that is to become the new
482 BSP. The range is from 0 to the total number of
483 logical processors minus 1. The total number of
484 logical processors can be retrieved by
485 EFI_MP_SERVICES_PROTOCOL.GetNumberOfProcessors().
486 @param[in] EnableOldBSP If TRUE, then the old BSP will be listed as an
487 enabled AP. Otherwise, it will be disabled.
488
489 @retval EFI_SUCCESS BSP successfully switched.
490 @retval EFI_UNSUPPORTED Switching the BSP cannot be completed prior to
491 this service returning.
492 @retval EFI_UNSUPPORTED Switching the BSP is not supported.
493 @retval EFI_SUCCESS The calling processor is an AP.
494 @retval EFI_NOT_FOUND The processor with the handle specified by
495 ProcessorNumber does not exist.
496 @retval EFI_INVALID_PARAMETER ProcessorNumber specifies the current BSP or
497 a disabled AP.
498 @retval EFI_NOT_READY The specified AP is busy.
499
500 **/
501 EFI_STATUS
502 EFIAPI
503 SwitchBSP (
504 IN EFI_MP_SERVICES_PROTOCOL *This,
505 IN UINTN ProcessorNumber,
506 IN BOOLEAN EnableOldBSP
507 );
508
509 /**
510 This service lets the caller enable or disable an AP from this point onward.
511 This service may only be called from the BSP.
512
513 This service allows the caller enable or disable an AP from this point onward.
514 The caller can optionally specify the health status of the AP by Health. If
515 an AP is being disabled, then the state of the disabled AP is implementation
516 dependent. If an AP is enabled, then the implementation must guarantee that a
517 complete initialization sequence is performed on the AP, so the AP is in a state
518 that is compatible with an MP operating system. This service may not be supported
519 after the UEFI Event EFI_EVENT_GROUP_READY_TO_BOOT is signaled.
520
521 If the enable or disable AP operation cannot be completed prior to the return
522 from this service, then EFI_UNSUPPORTED must be returned.
523
524 @param[in] This A pointer to the EFI_MP_SERVICES_PROTOCOL instance.
525 @param[in] ProcessorNumber The handle number of AP that is to become the new
526 BSP. The range is from 0 to the total number of
527 logical processors minus 1. The total number of
528 logical processors can be retrieved by
529 EFI_MP_SERVICES_PROTOCOL.GetNumberOfProcessors().
530 @param[in] EnableAP Specifies the new state for the processor for
531 enabled, FALSE for disabled.
532 @param[in] HealthFlag If not NULL, a pointer to a value that specifies
533 the new health status of the AP. This flag
534 corresponds to StatusFlag defined in
535 EFI_MP_SERVICES_PROTOCOL.GetProcessorInfo(). Only
536 the PROCESSOR_HEALTH_STATUS_BIT is used. All other
537 bits are ignored. If it is NULL, this parameter
538 is ignored.
539
540 @retval EFI_SUCCESS The specified AP was enabled or disabled successfully.
541 @retval EFI_UNSUPPORTED Enabling or disabling an AP cannot be completed
542 prior to this service returning.
543 @retval EFI_UNSUPPORTED Enabling or disabling an AP is not supported.
544 @retval EFI_DEVICE_ERROR The calling processor is an AP.
545 @retval EFI_NOT_FOUND Processor with the handle specified by ProcessorNumber
546 does not exist.
547 @retval EFI_INVALID_PARAMETER ProcessorNumber specifies the BSP.
548
549 **/
550 EFI_STATUS
551 EFIAPI
552 EnableDisableAP (
553 IN EFI_MP_SERVICES_PROTOCOL *This,
554 IN UINTN ProcessorNumber,
555 IN BOOLEAN EnableAP,
556 IN UINT32 *HealthFlag OPTIONAL
557 );
558
559 /**
560 This return the handle number for the calling processor. This service may be
561 called from the BSP and APs.
562
563 This service returns the processor handle number for the calling processor.
564 The returned value is in the range from 0 to the total number of logical
565 processors minus 1. The total number of logical processors can be retrieved
566 with EFI_MP_SERVICES_PROTOCOL.GetNumberOfProcessors(). This service may be
567 called from the BSP and APs. If ProcessorNumber is NULL, then EFI_INVALID_PARAMETER
568 is returned. Otherwise, the current processors handle number is returned in
569 ProcessorNumber, and EFI_SUCCESS is returned.
570
571 @param[in] This A pointer to the EFI_MP_SERVICES_PROTOCOL instance.
572 @param[out] ProcessorNumber The handle number of AP that is to become the new
573 BSP. The range is from 0 to the total number of
574 logical processors minus 1. The total number of
575 logical processors can be retrieved by
576 EFI_MP_SERVICES_PROTOCOL.GetNumberOfProcessors().
577
578 @retval EFI_SUCCESS The current processor handle number was returned
579 in ProcessorNumber.
580 @retval EFI_INVALID_PARAMETER ProcessorNumber is NULL.
581
582 **/
583 EFI_STATUS
584 EFIAPI
585 WhoAmI (
586 IN EFI_MP_SERVICES_PROTOCOL *This,
587 OUT UINTN *ProcessorNumber
588 );
589
590 /**
591 Terminate AP's task and set it to idle state.
592
593 This function terminates AP's task due to timeout by sending INIT-SIPI,
594 and sends it to idle state.
595
596 @param CpuData the pointer to CPU_DATA_BLOCK of specified AP
597
598 **/
599 VOID
600 ResetProcessorToIdleState (
601 IN CPU_DATA_BLOCK *CpuData
602 );
603
604 /**
605 Prepares Startup Code for APs.
606 This function prepares Startup Code for APs.
607
608 @retval EFI_SUCCESS The APs were started
609 @retval EFI_OUT_OF_RESOURCES Cannot allocate memory to start APs
610
611 **/
612 EFI_STATUS
613 PrepareAPStartupCode (
614 VOID
615 );
616
617 /**
618 Free the code buffer of startup AP.
619
620 **/
621 VOID
622 FreeApStartupCode (
623 VOID
624 );
625
626 /**
627 Resets the Application Processor and directs it to jump to the
628 specified routine.
629
630 The processor jumps to this code in flat mode, but the processor's
631 stack is not initialized.
632
633 @param ProcessorId the AP of ProcessorId was reset
634 **/
635 VOID
636 ResetApStackless (
637 IN UINT32 ProcessorId
638 );
639
640 #endif // _CPU_MP_H_
641