4 Copyright (c) 2008 - 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
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.
18 UINTN gMaxLogicalProcessorNumber
;
20 UINTN gPollInterval
= 100; // 100 microseconds
22 MP_SYSTEM_DATA mMpSystemData
;
23 EFI_HANDLE mMpServiceHandle
= NULL
;
24 EFI_EVENT mExitBootServicesEvent
= (EFI_EVENT
)NULL
;
26 VOID
*mCommonStack
= 0;
27 VOID
*mTopOfApCommonStack
= 0;
28 VOID
*mApStackStart
= 0;
30 volatile BOOLEAN mAPsAlreadyInitFinished
= FALSE
;
31 volatile BOOLEAN mStopCheckAllAPsStatus
= TRUE
;
33 EFI_MP_SERVICES_PROTOCOL mMpServicesTemplate
= {
34 GetNumberOfProcessors
,
46 @param CpuData the pointer to CPU_DATA_BLOCK of specified processor
51 IN CPU_DATA_BLOCK
*CpuData
54 while (!AcquireSpinLockOrFail (&CpuData
->CpuDataLock
)) {
57 CpuData
->LockSelf
= GetApicId ();
61 Release Mp Service Lock.
63 @param CpuData the pointer to CPU_DATA_BLOCK of specified processor
68 IN CPU_DATA_BLOCK
*CpuData
71 ReleaseSpinLock (&CpuData
->CpuDataLock
);
75 Check whether caller processor is BSP.
77 @retval TRUE the caller is BSP
78 @retval FALSE the caller is AP
87 CPU_DATA_BLOCK
*CpuData
;
91 WhoAmI (&mMpServicesTemplate
, &CpuIndex
);
92 CpuData
= &mMpSystemData
.CpuDatas
[CpuIndex
];
94 return CpuData
->Info
.StatusFlag
& PROCESSOR_AS_BSP_BIT
? TRUE
: FALSE
;
98 Get the Application Processors state.
100 @param CpuData the pointer to CPU_DATA_BLOCK of specified AP
102 @retval CPU_STATE the AP status
107 IN CPU_DATA_BLOCK
*CpuData
112 GetMpSpinLock (CpuData
);
113 State
= CpuData
->State
;
114 ReleaseMpSpinLock (CpuData
);
120 Set the Application Processors state.
122 @param CpuData The pointer to CPU_DATA_BLOCK of specified AP
123 @param State The AP status
128 IN CPU_DATA_BLOCK
*CpuData
,
132 GetMpSpinLock (CpuData
);
133 CpuData
->State
= State
;
134 ReleaseMpSpinLock (CpuData
);
138 Set the Application Processor prepare to run a function specified
141 @param CpuData the pointer to CPU_DATA_BLOCK of specified AP
142 @param Procedure A pointer to the function to be run on enabled APs of the system
143 @param ProcedureArgument Pointer to the optional parameter of the assigned function
148 IN CPU_DATA_BLOCK
*CpuData
,
149 IN EFI_AP_PROCEDURE Procedure
,
150 IN VOID
*ProcedureArgument
153 GetMpSpinLock (CpuData
);
154 CpuData
->Parameter
= ProcedureArgument
;
155 CpuData
->Procedure
= Procedure
;
156 ReleaseMpSpinLock (CpuData
);
160 Check the Application Processors Status whether contains the Flags.
162 @param CpuData the pointer to CPU_DATA_BLOCK of specified AP
163 @param Flags the StatusFlag describing in EFI_PROCESSOR_INFORMATION
165 @retval TRUE the AP status includes the StatusFlag
166 @retval FALSE the AP status excludes the StatusFlag
171 IN CPU_DATA_BLOCK
*CpuData
,
177 GetMpSpinLock (CpuData
);
178 Ret
= CpuData
->Info
.StatusFlag
& Flags
;
179 ReleaseMpSpinLock (CpuData
);
181 return (BOOLEAN
) (Ret
!= 0);
185 Bitwise-Or of the Application Processors Status with the Flags.
187 @param CpuData the pointer to CPU_DATA_BLOCK of specified AP
188 @param Flags the StatusFlag describing in EFI_PROCESSOR_INFORMATION
193 IN CPU_DATA_BLOCK
*CpuData
,
197 GetMpSpinLock (CpuData
);
198 CpuData
->Info
.StatusFlag
|= Flags
;
199 ReleaseMpSpinLock (CpuData
);
203 Bitwise-AndNot of the Application Processors Status with the Flags.
205 @param CpuData the pointer to CPU_DATA_BLOCK of specified AP
206 @param Flags the StatusFlag describing in EFI_PROCESSOR_INFORMATION
210 CpuStatusFlagAndNot (
211 IN CPU_DATA_BLOCK
*CpuData
,
215 GetMpSpinLock (CpuData
);
216 CpuData
->Info
.StatusFlag
&= ~Flags
;
217 ReleaseMpSpinLock (CpuData
);
221 Searches for the next blocking AP.
223 Search for the next AP that is put in blocking state by single-threaded StartupAllAPs().
225 @param NextNumber Pointer to the processor number of the next blocking AP.
227 @retval EFI_SUCCESS The next blocking AP has been found.
228 @retval EFI_NOT_FOUND No blocking AP exists.
232 GetNextBlockedNumber (
233 OUT UINTN
*NextNumber
238 CPU_DATA_BLOCK
*CpuData
;
240 for (Number
= 0; Number
< mMpSystemData
.NumberOfProcessors
; Number
++) {
241 CpuData
= &mMpSystemData
.CpuDatas
[Number
];
242 if (TestCpuStatusFlag (CpuData
, PROCESSOR_AS_BSP_BIT
)) {
249 CpuState
= GetApState (CpuData
);
250 if (CpuState
== CpuStateBlocked
) {
251 *NextNumber
= Number
;
256 return EFI_NOT_FOUND
;
260 Check if the APs state are finished, and update them to idle state
265 CheckAndUpdateAllAPsToIdleState (
269 UINTN ProcessorNumber
;
271 CPU_DATA_BLOCK
*CpuData
;
275 for (ProcessorNumber
= 0; ProcessorNumber
< mMpSystemData
.NumberOfProcessors
; ProcessorNumber
++) {
276 CpuData
= &mMpSystemData
.CpuDatas
[ProcessorNumber
];
277 if (TestCpuStatusFlag (CpuData
, PROCESSOR_AS_BSP_BIT
)) {
284 if (!TestCpuStatusFlag (CpuData
, PROCESSOR_ENABLED_BIT
)) {
286 // Skip Disabled processors
291 CpuState
= GetApState (CpuData
);
292 if (CpuState
== CpuStateFinished
) {
293 mMpSystemData
.FinishCount
++;
294 if (mMpSystemData
.SingleThread
) {
295 Status
= GetNextBlockedNumber (&NextNumber
);
296 if (!EFI_ERROR (Status
)) {
297 SetApState (&mMpSystemData
.CpuDatas
[NextNumber
], CpuStateReady
);
298 SetApProcedure (&mMpSystemData
.CpuDatas
[NextNumber
],
299 mMpSystemData
.Procedure
,
300 mMpSystemData
.ProcedureArgument
);
304 SetApState (CpuData
, CpuStateIdle
);
310 If the timeout expires before all APs returns from Procedure,
311 we should forcibly terminate the executing AP and fill FailedList back
320 CPU_DATA_BLOCK
*CpuData
;
324 if (mMpSystemData
.FailedList
!= NULL
) {
325 *mMpSystemData
.FailedList
= AllocatePool ((mMpSystemData
.StartCount
- mMpSystemData
.FinishCount
+ 1) * sizeof(UINTN
));
326 ASSERT (*mMpSystemData
.FailedList
!= NULL
);
329 for (Number
= 0; Number
< mMpSystemData
.NumberOfProcessors
; Number
++) {
330 CpuData
= &mMpSystemData
.CpuDatas
[Number
];
331 if (TestCpuStatusFlag (CpuData
, PROCESSOR_AS_BSP_BIT
)) {
338 if (!TestCpuStatusFlag (CpuData
, PROCESSOR_ENABLED_BIT
)) {
340 // Skip Disabled processors
345 CpuState
= GetApState (CpuData
);
346 if (CpuState
!= CpuStateIdle
) {
347 if (mMpSystemData
.FailedList
!= NULL
) {
348 (*mMpSystemData
.FailedList
)[mMpSystemData
.FailedListIndex
++] = Number
;
350 ResetProcessorToIdleState (CpuData
);
354 if (mMpSystemData
.FailedList
!= NULL
) {
355 (*mMpSystemData
.FailedList
)[mMpSystemData
.FailedListIndex
] = END_OF_CPU_LIST
;
360 This service retrieves the number of logical processor in the platform
361 and the number of those logical processors that are enabled on this boot.
362 This service may only be called from the BSP.
364 This function is used to retrieve the following information:
365 - The number of logical processors that are present in the system.
366 - The number of enabled logical processors in the system at the instant
369 Because MP Service Protocol provides services to enable and disable processors
370 dynamically, the number of enabled logical processors may vary during the
371 course of a boot session.
373 If this service is called from an AP, then EFI_DEVICE_ERROR is returned.
374 If NumberOfProcessors or NumberOfEnabledProcessors is NULL, then
375 EFI_INVALID_PARAMETER is returned. Otherwise, the total number of processors
376 is returned in NumberOfProcessors, the number of currently enabled processor
377 is returned in NumberOfEnabledProcessors, and EFI_SUCCESS is returned.
379 @param[in] This A pointer to the EFI_MP_SERVICES_PROTOCOL
381 @param[out] NumberOfProcessors Pointer to the total number of logical
382 processors in the system, including the BSP
384 @param[out] NumberOfEnabledProcessors Pointer to the number of enabled logical
385 processors that exist in system, including
388 @retval EFI_SUCCESS The number of logical processors and enabled
389 logical processors was retrieved.
390 @retval EFI_DEVICE_ERROR The calling processor is an AP.
391 @retval EFI_INVALID_PARAMETER NumberOfProcessors is NULL.
392 @retval EFI_INVALID_PARAMETER NumberOfEnabledProcessors is NULL.
397 GetNumberOfProcessors (
398 IN EFI_MP_SERVICES_PROTOCOL
*This
,
399 OUT UINTN
*NumberOfProcessors
,
400 OUT UINTN
*NumberOfEnabledProcessors
403 if ((NumberOfProcessors
== NULL
) || (NumberOfEnabledProcessors
== NULL
)) {
404 return EFI_INVALID_PARAMETER
;
408 return EFI_DEVICE_ERROR
;
411 *NumberOfProcessors
= mMpSystemData
.NumberOfProcessors
;
412 *NumberOfEnabledProcessors
= mMpSystemData
.NumberOfEnabledProcessors
;
417 Gets detailed MP-related information on the requested processor at the
418 instant this call is made. This service may only be called from the BSP.
420 This service retrieves detailed MP-related information about any processor
421 on the platform. Note the following:
422 - The processor information may change during the course of a boot session.
423 - The information presented here is entirely MP related.
425 Information regarding the number of caches and their sizes, frequency of operation,
426 slot numbers is all considered platform-related information and is not provided
429 @param[in] This A pointer to the EFI_MP_SERVICES_PROTOCOL
431 @param[in] ProcessorNumber The handle number of processor.
432 @param[out] ProcessorInfoBuffer A pointer to the buffer where information for
433 the requested processor is deposited.
435 @retval EFI_SUCCESS Processor information was returned.
436 @retval EFI_DEVICE_ERROR The calling processor is an AP.
437 @retval EFI_INVALID_PARAMETER ProcessorInfoBuffer is NULL.
438 @retval EFI_NOT_FOUND The processor with the handle specified by
439 ProcessorNumber does not exist in the platform.
445 IN EFI_MP_SERVICES_PROTOCOL
*This
,
446 IN UINTN ProcessorNumber
,
447 OUT EFI_PROCESSOR_INFORMATION
*ProcessorInfoBuffer
450 if (ProcessorInfoBuffer
== NULL
) {
451 return EFI_INVALID_PARAMETER
;
455 return EFI_DEVICE_ERROR
;
458 if (ProcessorNumber
>= mMpSystemData
.NumberOfProcessors
) {
459 return EFI_NOT_FOUND
;
462 CopyMem (ProcessorInfoBuffer
, &mMpSystemData
.CpuDatas
[ProcessorNumber
], sizeof (EFI_PROCESSOR_INFORMATION
));
467 This service executes a caller provided function on all enabled APs. APs can
468 run either simultaneously or one at a time in sequence. This service supports
469 both blocking and non-blocking requests. The non-blocking requests use EFI
470 events so the BSP can detect when the APs have finished. This service may only
471 be called from the BSP.
473 This function is used to dispatch all the enabled APs to the function specified
474 by Procedure. If any enabled AP is busy, then EFI_NOT_READY is returned
475 immediately and Procedure is not started on any AP.
477 If SingleThread is TRUE, all the enabled APs execute the function specified by
478 Procedure one by one, in ascending order of processor handle number. Otherwise,
479 all the enabled APs execute the function specified by Procedure simultaneously.
481 If WaitEvent is NULL, execution is in blocking mode. The BSP waits until all
482 APs finish or TimeoutInMicroseconds expires. Otherwise, execution is in non-blocking
483 mode, and the BSP returns from this service without waiting for APs. If a
484 non-blocking mode is requested after the UEFI Event EFI_EVENT_GROUP_READY_TO_BOOT
485 is signaled, then EFI_UNSUPPORTED must be returned.
487 If the timeout specified by TimeoutInMicroseconds expires before all APs return
488 from Procedure, then Procedure on the failed APs is terminated. All enabled APs
489 are always available for further calls to EFI_MP_SERVICES_PROTOCOL.StartupAllAPs()
490 and EFI_MP_SERVICES_PROTOCOL.StartupThisAP(). If FailedCpuList is not NULL, its
491 content points to the list of processor handle numbers in which Procedure was
494 Note: It is the responsibility of the consumer of the EFI_MP_SERVICES_PROTOCOL.StartupAllAPs()
495 to make sure that the nature of the code that is executed on the BSP and the
496 dispatched APs is well controlled. The MP Services Protocol does not guarantee
497 that the Procedure function is MP-safe. Hence, the tasks that can be run in
498 parallel are limited to certain independent tasks and well-controlled exclusive
499 code. EFI services and protocols may not be called by APs unless otherwise
502 In blocking execution mode, BSP waits until all APs finish or
503 TimeoutInMicroseconds expires.
505 In non-blocking execution mode, BSP is freed to return to the caller and then
506 proceed to the next task without having to wait for APs. The following
507 sequence needs to occur in a non-blocking execution mode:
509 -# The caller that intends to use this MP Services Protocol in non-blocking
510 mode creates WaitEvent by calling the EFI CreateEvent() service. The caller
511 invokes EFI_MP_SERVICES_PROTOCOL.StartupAllAPs(). If the parameter WaitEvent
512 is not NULL, then StartupAllAPs() executes in non-blocking mode. It requests
513 the function specified by Procedure to be started on all the enabled APs,
514 and releases the BSP to continue with other tasks.
515 -# The caller can use the CheckEvent() and WaitForEvent() services to check
516 the state of the WaitEvent created in step 1.
517 -# When the APs complete their task or TimeoutInMicroSecondss expires, the MP
518 Service signals WaitEvent by calling the EFI SignalEvent() function. If
519 FailedCpuList is not NULL, its content is available when WaitEvent is
520 signaled. If all APs returned from Procedure prior to the timeout, then
521 FailedCpuList is set to NULL. If not all APs return from Procedure before
522 the timeout, then FailedCpuList is filled in with the list of the failed
523 APs. The buffer is allocated by MP Service Protocol using AllocatePool().
524 It is the caller's responsibility to free the buffer with FreePool() service.
525 -# This invocation of SignalEvent() function informs the caller that invoked
526 EFI_MP_SERVICES_PROTOCOL.StartupAllAPs() that either all the APs completed
527 the specified task or a timeout occurred. The contents of FailedCpuList
528 can be examined to determine which APs did not complete the specified task
529 prior to the timeout.
531 @param[in] This A pointer to the EFI_MP_SERVICES_PROTOCOL
533 @param[in] Procedure A pointer to the function to be run on
534 enabled APs of the system. See type
536 @param[in] SingleThread If TRUE, then all the enabled APs execute
537 the function specified by Procedure one by
538 one, in ascending order of processor handle
539 number. If FALSE, then all the enabled APs
540 execute the function specified by Procedure
542 @param[in] WaitEvent The event created by the caller with CreateEvent()
543 service. If it is NULL, then execute in
544 blocking mode. BSP waits until all APs finish
545 or TimeoutInMicroseconds expires. If it's
546 not NULL, then execute in non-blocking mode.
547 BSP requests the function specified by
548 Procedure to be started on all the enabled
549 APs, and go on executing immediately. If
550 all return from Procedure, or TimeoutInMicroseconds
551 expires, this event is signaled. The BSP
552 can use the CheckEvent() or WaitForEvent()
553 services to check the state of event. Type
554 EFI_EVENT is defined in CreateEvent() in
555 the Unified Extensible Firmware Interface
557 @param[in] TimeoutInMicroseconds Indicates the time limit in microseconds for
558 APs to return from Procedure, either for
559 blocking or non-blocking mode. Zero means
560 infinity. If the timeout expires before
561 all APs return from Procedure, then Procedure
562 on the failed APs is terminated. All enabled
563 APs are available for next function assigned
564 by EFI_MP_SERVICES_PROTOCOL.StartupAllAPs()
565 or EFI_MP_SERVICES_PROTOCOL.StartupThisAP().
566 If the timeout expires in blocking mode,
567 BSP returns EFI_TIMEOUT. If the timeout
568 expires in non-blocking mode, WaitEvent
569 is signaled with SignalEvent().
570 @param[in] ProcedureArgument The parameter passed into Procedure for
572 @param[out] FailedCpuList If NULL, this parameter is ignored. Otherwise,
573 if all APs finish successfully, then its
574 content is set to NULL. If not all APs
575 finish before timeout expires, then its
576 content is set to address of the buffer
577 holding handle numbers of the failed APs.
578 The buffer is allocated by MP Service Protocol,
579 and it's the caller's responsibility to
580 free the buffer with FreePool() service.
581 In blocking mode, it is ready for consumption
582 when the call returns. In non-blocking mode,
583 it is ready when WaitEvent is signaled. The
584 list of failed CPU is terminated by
587 @retval EFI_SUCCESS In blocking mode, all APs have finished before
589 @retval EFI_SUCCESS In non-blocking mode, function has been dispatched
591 @retval EFI_UNSUPPORTED A non-blocking mode request was made after the
592 UEFI event EFI_EVENT_GROUP_READY_TO_BOOT was
594 @retval EFI_DEVICE_ERROR Caller processor is AP.
595 @retval EFI_NOT_STARTED No enabled APs exist in the system.
596 @retval EFI_NOT_READY Any enabled APs are busy.
597 @retval EFI_TIMEOUT In blocking mode, the timeout expired before
598 all enabled APs have finished.
599 @retval EFI_INVALID_PARAMETER Procedure is NULL.
605 IN EFI_MP_SERVICES_PROTOCOL
*This
,
606 IN EFI_AP_PROCEDURE Procedure
,
607 IN BOOLEAN SingleThread
,
608 IN EFI_EVENT WaitEvent OPTIONAL
,
609 IN UINTN TimeoutInMicroseconds
,
610 IN VOID
*ProcedureArgument OPTIONAL
,
611 OUT UINTN
**FailedCpuList OPTIONAL
615 CPU_DATA_BLOCK
*CpuData
;
617 CPU_STATE APInitialState
;
621 if (FailedCpuList
!= NULL
) {
622 *FailedCpuList
= NULL
;
626 return EFI_DEVICE_ERROR
;
629 if (mMpSystemData
.NumberOfProcessors
== 1) {
630 return EFI_NOT_STARTED
;
633 if (Procedure
== NULL
) {
634 return EFI_INVALID_PARAMETER
;
638 // temporarily stop checkAllAPsStatus for avoid resource dead-lock.
640 mStopCheckAllAPsStatus
= TRUE
;
642 for (Number
= 0; Number
< mMpSystemData
.NumberOfProcessors
; Number
++) {
643 CpuData
= &mMpSystemData
.CpuDatas
[Number
];
644 if (TestCpuStatusFlag (CpuData
, PROCESSOR_AS_BSP_BIT
)) {
651 if (!TestCpuStatusFlag (CpuData
, PROCESSOR_ENABLED_BIT
)) {
653 // Skip Disabled processors
658 if (GetApState (CpuData
) != CpuStateIdle
) {
659 return EFI_NOT_READY
;
663 mMpSystemData
.Procedure
= Procedure
;
664 mMpSystemData
.ProcedureArgument
= ProcedureArgument
;
665 mMpSystemData
.WaitEvent
= WaitEvent
;
666 mMpSystemData
.Timeout
= TimeoutInMicroseconds
;
667 mMpSystemData
.TimeoutActive
= (BOOLEAN
) (TimeoutInMicroseconds
!= 0);
668 mMpSystemData
.FinishCount
= 0;
669 mMpSystemData
.StartCount
= 0;
670 mMpSystemData
.SingleThread
= SingleThread
;
671 mMpSystemData
.FailedList
= FailedCpuList
;
672 mMpSystemData
.FailedListIndex
= 0;
673 APInitialState
= CpuStateReady
;
675 for (Number
= 0; Number
< mMpSystemData
.NumberOfProcessors
; Number
++) {
676 CpuData
= &mMpSystemData
.CpuDatas
[Number
];
677 if (TestCpuStatusFlag (CpuData
, PROCESSOR_AS_BSP_BIT
)) {
684 if (!TestCpuStatusFlag (CpuData
, PROCESSOR_ENABLED_BIT
)) {
686 // Skip Disabled processors
692 // Get APs prepared, and put failing APs into FailedCpuList
693 // if "SingleThread", only 1 AP will put to ready state, other AP will be put to ready
694 // state 1 by 1, until the previous 1 finished its task
695 // if not "SingleThread", all APs are put to ready state from the beginning
697 if (GetApState (CpuData
) == CpuStateIdle
) {
698 mMpSystemData
.StartCount
++;
700 SetApState (CpuData
, APInitialState
);
702 if (APInitialState
== CpuStateReady
) {
703 SetApProcedure (CpuData
, Procedure
, ProcedureArgument
);
707 APInitialState
= CpuStateBlocked
;
712 mStopCheckAllAPsStatus
= FALSE
;
714 if (WaitEvent
!= NULL
) {
722 // Blocking temporarily stop CheckAllAPsStatus()
724 mStopCheckAllAPsStatus
= TRUE
;
727 CheckAndUpdateAllAPsToIdleState ();
728 if (mMpSystemData
.FinishCount
== mMpSystemData
.StartCount
) {
729 Status
= EFI_SUCCESS
;
736 if (mMpSystemData
.TimeoutActive
&& mMpSystemData
.Timeout
< 0) {
738 Status
= EFI_TIMEOUT
;
742 gBS
->Stall (gPollInterval
);
743 mMpSystemData
.Timeout
-= gPollInterval
;
752 This service lets the caller get one enabled AP to execute a caller-provided
753 function. The caller can request the BSP to either wait for the completion
754 of the AP or just proceed with the next task by using the EFI event mechanism.
755 See EFI_MP_SERVICES_PROTOCOL.StartupAllAPs() for more details on non-blocking
756 execution support. This service may only be called from the BSP.
758 This function is used to dispatch one enabled AP to the function specified by
759 Procedure passing in the argument specified by ProcedureArgument. If WaitEvent
760 is NULL, execution is in blocking mode. The BSP waits until the AP finishes or
761 TimeoutInMicroSecondss expires. Otherwise, execution is in non-blocking mode.
762 BSP proceeds to the next task without waiting for the AP. If a non-blocking mode
763 is requested after the UEFI Event EFI_EVENT_GROUP_READY_TO_BOOT is signaled,
764 then EFI_UNSUPPORTED must be returned.
766 If the timeout specified by TimeoutInMicroseconds expires before the AP returns
767 from Procedure, then execution of Procedure by the AP is terminated. The AP is
768 available for subsequent calls to EFI_MP_SERVICES_PROTOCOL.StartupAllAPs() and
769 EFI_MP_SERVICES_PROTOCOL.StartupThisAP().
771 @param[in] This A pointer to the EFI_MP_SERVICES_PROTOCOL
773 @param[in] Procedure A pointer to the function to be run on
774 enabled APs of the system. See type
776 @param[in] ProcessorNumber The handle number of the AP. The range is
777 from 0 to the total number of logical
778 processors minus 1. The total number of
779 logical processors can be retrieved by
780 EFI_MP_SERVICES_PROTOCOL.GetNumberOfProcessors().
781 @param[in] WaitEvent The event created by the caller with CreateEvent()
782 service. If it is NULL, then execute in
783 blocking mode. BSP waits until all APs finish
784 or TimeoutInMicroseconds expires. If it's
785 not NULL, then execute in non-blocking mode.
786 BSP requests the function specified by
787 Procedure to be started on all the enabled
788 APs, and go on executing immediately. If
789 all return from Procedure or TimeoutInMicroseconds
790 expires, this event is signaled. The BSP
791 can use the CheckEvent() or WaitForEvent()
792 services to check the state of event. Type
793 EFI_EVENT is defined in CreateEvent() in
794 the Unified Extensible Firmware Interface
796 @param[in] TimeoutInMicroseconds Indicates the time limit in microseconds for
797 APs to return from Procedure, either for
798 blocking or non-blocking mode. Zero means
799 infinity. If the timeout expires before
800 all APs return from Procedure, then Procedure
801 on the failed APs is terminated. All enabled
802 APs are available for next function assigned
803 by EFI_MP_SERVICES_PROTOCOL.StartupAllAPs()
804 or EFI_MP_SERVICES_PROTOCOL.StartupThisAP().
805 If the timeout expires in blocking mode,
806 BSP returns EFI_TIMEOUT. If the timeout
807 expires in non-blocking mode, WaitEvent
808 is signaled with SignalEvent().
809 @param[in] ProcedureArgument The parameter passed into Procedure for
811 @param[out] Finished If NULL, this parameter is ignored. In
812 blocking mode, this parameter is ignored.
813 In non-blocking mode, if AP returns from
814 Procedure before the timeout expires, its
815 content is set to TRUE. Otherwise, the
816 value is set to FALSE. The caller can
817 determine if the AP returned from Procedure
818 by evaluating this value.
820 @retval EFI_SUCCESS In blocking mode, specified AP finished before
822 @retval EFI_SUCCESS In non-blocking mode, the function has been
823 dispatched to specified AP.
824 @retval EFI_UNSUPPORTED A non-blocking mode request was made after the
825 UEFI event EFI_EVENT_GROUP_READY_TO_BOOT was
827 @retval EFI_DEVICE_ERROR The calling processor is an AP.
828 @retval EFI_TIMEOUT In blocking mode, the timeout expired before
829 the specified AP has finished.
830 @retval EFI_NOT_READY The specified AP is busy.
831 @retval EFI_NOT_FOUND The processor with the handle specified by
832 ProcessorNumber does not exist.
833 @retval EFI_INVALID_PARAMETER ProcessorNumber specifies the BSP or disabled AP.
834 @retval EFI_INVALID_PARAMETER Procedure is NULL.
840 IN EFI_MP_SERVICES_PROTOCOL
*This
,
841 IN EFI_AP_PROCEDURE Procedure
,
842 IN UINTN ProcessorNumber
,
843 IN EFI_EVENT WaitEvent OPTIONAL
,
844 IN UINTN TimeoutInMicroseconds
,
845 IN VOID
*ProcedureArgument OPTIONAL
,
846 OUT BOOLEAN
*Finished OPTIONAL
849 CPU_DATA_BLOCK
*CpuData
;
853 if (Finished
!= NULL
) {
858 return EFI_DEVICE_ERROR
;
861 if (Procedure
== NULL
) {
862 return EFI_INVALID_PARAMETER
;
865 if (ProcessorNumber
>= mMpSystemData
.NumberOfProcessors
) {
866 return EFI_NOT_FOUND
;
870 // temporarily stop checkAllAPsStatus for avoid resource dead-lock.
872 mStopCheckAllAPsStatus
= TRUE
;
874 CpuData
= &mMpSystemData
.CpuDatas
[ProcessorNumber
];
875 if (TestCpuStatusFlag (CpuData
, PROCESSOR_AS_BSP_BIT
) ||
876 !TestCpuStatusFlag (CpuData
, PROCESSOR_ENABLED_BIT
)) {
877 return EFI_INVALID_PARAMETER
;
880 if (GetApState (CpuData
) != CpuStateIdle
) {
881 return EFI_NOT_READY
;
884 SetApState (CpuData
, CpuStateReady
);
886 SetApProcedure (CpuData
, Procedure
, ProcedureArgument
);
888 CpuData
->Timeout
= TimeoutInMicroseconds
;
889 CpuData
->WaitEvent
= WaitEvent
;
890 CpuData
->TimeoutActive
= (BOOLEAN
) (TimeoutInMicroseconds
!= 0);
891 CpuData
->Finished
= Finished
;
893 mStopCheckAllAPsStatus
= FALSE
;
895 if (WaitEvent
!= NULL
) {
906 if (GetApState (CpuData
) == CpuStateFinished
) {
907 SetApState (CpuData
, CpuStateIdle
);
911 if (CpuData
->TimeoutActive
&& CpuData
->Timeout
< 0) {
912 ResetProcessorToIdleState (CpuData
);
916 gBS
->Stall (gPollInterval
);
917 CpuData
->Timeout
-= gPollInterval
;
924 This service switches the requested AP to be the BSP from that point onward.
925 This service changes the BSP for all purposes. This call can only be performed
928 This service switches the requested AP to be the BSP from that point onward.
929 This service changes the BSP for all purposes. The new BSP can take over the
930 execution of the old BSP and continue seamlessly from where the old one left
931 off. This service may not be supported after the UEFI Event EFI_EVENT_GROUP_READY_TO_BOOT
934 If the BSP cannot be switched prior to the return from this service, then
935 EFI_UNSUPPORTED must be returned.
937 @param[in] This A pointer to the EFI_MP_SERVICES_PROTOCOL instance.
938 @param[in] ProcessorNumber The handle number of AP that is to become the new
939 BSP. The range is from 0 to the total number of
940 logical processors minus 1. The total number of
941 logical processors can be retrieved by
942 EFI_MP_SERVICES_PROTOCOL.GetNumberOfProcessors().
943 @param[in] EnableOldBSP If TRUE, then the old BSP will be listed as an
944 enabled AP. Otherwise, it will be disabled.
946 @retval EFI_SUCCESS BSP successfully switched.
947 @retval EFI_UNSUPPORTED Switching the BSP cannot be completed prior to
948 this service returning.
949 @retval EFI_UNSUPPORTED Switching the BSP is not supported.
950 @retval EFI_SUCCESS The calling processor is an AP.
951 @retval EFI_NOT_FOUND The processor with the handle specified by
952 ProcessorNumber does not exist.
953 @retval EFI_INVALID_PARAMETER ProcessorNumber specifies the current BSP or
955 @retval EFI_NOT_READY The specified AP is busy.
961 IN EFI_MP_SERVICES_PROTOCOL
*This
,
962 IN UINTN ProcessorNumber
,
963 IN BOOLEAN EnableOldBSP
967 // Current always return unsupported.
969 return EFI_UNSUPPORTED
;
973 This service lets the caller enable or disable an AP from this point onward.
974 This service may only be called from the BSP.
976 This service allows the caller enable or disable an AP from this point onward.
977 The caller can optionally specify the health status of the AP by Health. If
978 an AP is being disabled, then the state of the disabled AP is implementation
979 dependent. If an AP is enabled, then the implementation must guarantee that a
980 complete initialization sequence is performed on the AP, so the AP is in a state
981 that is compatible with an MP operating system. This service may not be supported
982 after the UEFI Event EFI_EVENT_GROUP_READY_TO_BOOT is signaled.
984 If the enable or disable AP operation cannot be completed prior to the return
985 from this service, then EFI_UNSUPPORTED must be returned.
987 @param[in] This A pointer to the EFI_MP_SERVICES_PROTOCOL instance.
988 @param[in] ProcessorNumber The handle number of AP that is to become the new
989 BSP. The range is from 0 to the total number of
990 logical processors minus 1. The total number of
991 logical processors can be retrieved by
992 EFI_MP_SERVICES_PROTOCOL.GetNumberOfProcessors().
993 @param[in] EnableAP Specifies the new state for the processor for
994 enabled, FALSE for disabled.
995 @param[in] HealthFlag If not NULL, a pointer to a value that specifies
996 the new health status of the AP. This flag
997 corresponds to StatusFlag defined in
998 EFI_MP_SERVICES_PROTOCOL.GetProcessorInfo(). Only
999 the PROCESSOR_HEALTH_STATUS_BIT is used. All other
1000 bits are ignored. If it is NULL, this parameter
1003 @retval EFI_SUCCESS The specified AP was enabled or disabled successfully.
1004 @retval EFI_UNSUPPORTED Enabling or disabling an AP cannot be completed
1005 prior to this service returning.
1006 @retval EFI_UNSUPPORTED Enabling or disabling an AP is not supported.
1007 @retval EFI_DEVICE_ERROR The calling processor is an AP.
1008 @retval EFI_NOT_FOUND Processor with the handle specified by ProcessorNumber
1010 @retval EFI_INVALID_PARAMETER ProcessorNumber specifies the BSP.
1016 IN EFI_MP_SERVICES_PROTOCOL
*This
,
1017 IN UINTN ProcessorNumber
,
1018 IN BOOLEAN EnableAP
,
1019 IN UINT32
*HealthFlag OPTIONAL
1022 CPU_DATA_BLOCK
*CpuData
;
1023 BOOLEAN TempStopCheckState
;
1026 TempStopCheckState
= FALSE
;
1029 return EFI_DEVICE_ERROR
;
1032 if (ProcessorNumber
>= mMpSystemData
.NumberOfProcessors
) {
1033 return EFI_NOT_FOUND
;
1037 // temporarily stop checkAllAPsStatus for initialize parameters.
1039 if (!mStopCheckAllAPsStatus
) {
1040 mStopCheckAllAPsStatus
= TRUE
;
1041 TempStopCheckState
= TRUE
;
1044 CpuData
= &mMpSystemData
.CpuDatas
[ProcessorNumber
];
1045 if (TestCpuStatusFlag (CpuData
, PROCESSOR_AS_BSP_BIT
)) {
1046 return EFI_INVALID_PARAMETER
;
1049 if (GetApState (CpuData
) != CpuStateIdle
) {
1050 return EFI_UNSUPPORTED
;
1054 if (!(TestCpuStatusFlag (CpuData
, PROCESSOR_ENABLED_BIT
))) {
1055 mMpSystemData
.NumberOfEnabledProcessors
++;
1057 CpuStatusFlagOr (CpuData
, PROCESSOR_ENABLED_BIT
);
1059 if (TestCpuStatusFlag (CpuData
, PROCESSOR_ENABLED_BIT
)) {
1060 mMpSystemData
.NumberOfEnabledProcessors
--;
1062 CpuStatusFlagAndNot (CpuData
, PROCESSOR_ENABLED_BIT
);
1065 if (HealthFlag
!= NULL
) {
1066 CpuStatusFlagAndNot (CpuData
, (UINT32
)~PROCESSOR_HEALTH_STATUS_BIT
);
1067 CpuStatusFlagOr (CpuData
, (*HealthFlag
& PROCESSOR_HEALTH_STATUS_BIT
));
1070 if (TempStopCheckState
) {
1071 mStopCheckAllAPsStatus
= FALSE
;
1078 This return the handle number for the calling processor. This service may be
1079 called from the BSP and APs.
1081 This service returns the processor handle number for the calling processor.
1082 The returned value is in the range from 0 to the total number of logical
1083 processors minus 1. The total number of logical processors can be retrieved
1084 with EFI_MP_SERVICES_PROTOCOL.GetNumberOfProcessors(). This service may be
1085 called from the BSP and APs. If ProcessorNumber is NULL, then EFI_INVALID_PARAMETER
1086 is returned. Otherwise, the current processors handle number is returned in
1087 ProcessorNumber, and EFI_SUCCESS is returned.
1089 @param[in] This A pointer to the EFI_MP_SERVICES_PROTOCOL instance.
1090 @param[out] ProcessorNumber The handle number of AP that is to become the new
1091 BSP. The range is from 0 to the total number of
1092 logical processors minus 1. The total number of
1093 logical processors can be retrieved by
1094 EFI_MP_SERVICES_PROTOCOL.GetNumberOfProcessors().
1096 @retval EFI_SUCCESS The current processor handle number was returned
1098 @retval EFI_INVALID_PARAMETER ProcessorNumber is NULL.
1104 IN EFI_MP_SERVICES_PROTOCOL
*This
,
1105 OUT UINTN
*ProcessorNumber
1111 if (ProcessorNumber
== NULL
) {
1112 return EFI_INVALID_PARAMETER
;
1115 ProcessorId
= GetApicId ();
1116 for (Index
= 0; Index
< mMpSystemData
.NumberOfProcessors
; Index
++) {
1117 if (mMpSystemData
.CpuDatas
[Index
].Info
.ProcessorId
== ProcessorId
) {
1122 *ProcessorNumber
= Index
;
1127 Terminate AP's task and set it to idle state.
1129 This function terminates AP's task due to timeout by sending INIT-SIPI,
1130 and sends it to idle state.
1132 @param CpuData the pointer to CPU_DATA_BLOCK of specified AP
1136 ResetProcessorToIdleState (
1137 IN CPU_DATA_BLOCK
*CpuData
1140 ResetApStackless ((UINT32
)CpuData
->Info
.ProcessorId
);
1144 Application Processors do loop routine
1145 after switch to its own stack.
1147 @param Context1 A pointer to the context to pass into the function.
1148 @param Context2 A pointer to the context to pass into the function.
1152 ProcessorToIdleState (
1153 IN VOID
*Context1
, OPTIONAL
1154 IN VOID
*Context2 OPTIONAL
1157 UINTN ProcessorNumber
;
1158 CPU_DATA_BLOCK
*CpuData
;
1159 EFI_AP_PROCEDURE Procedure
;
1160 VOID
*ProcedureArgument
;
1162 AsmApDoneWithCommonStack ();
1164 while (!mAPsAlreadyInitFinished
) {
1168 WhoAmI (&mMpServicesTemplate
, &ProcessorNumber
);
1169 CpuData
= &mMpSystemData
.CpuDatas
[ProcessorNumber
];
1172 // Avoid forcibly reset AP caused the AP got lock not release.
1174 if (CpuData
->LockSelf
== (INTN
) GetApicId ()) {
1175 ReleaseSpinLock (&CpuData
->CpuDataLock
);
1179 // Avoid forcibly reset AP caused the AP State is not updated.
1181 GetMpSpinLock (CpuData
);
1182 CpuData
->State
= CpuStateIdle
;
1183 CpuData
->Procedure
= NULL
;
1184 ReleaseMpSpinLock (CpuData
);
1187 GetMpSpinLock (CpuData
);
1188 ProcedureArgument
= CpuData
->Parameter
;
1189 Procedure
= CpuData
->Procedure
;
1190 ReleaseMpSpinLock (CpuData
);
1192 if (Procedure
!= NULL
) {
1193 Procedure (ProcedureArgument
);
1195 GetMpSpinLock (CpuData
);
1196 CpuData
->Procedure
= NULL
;
1197 CpuData
->State
= CpuStateFinished
;
1198 ReleaseMpSpinLock (CpuData
);
1209 Checks AP' status periodically.
1211 This function is triggerred by timer perodically to check the
1212 state of AP forStartupThisAP() executed in non-blocking mode.
1214 @param Event Event triggered.
1215 @param Context Parameter passed with the event.
1225 CPU_DATA_BLOCK
*CpuData
;
1228 CpuData
= (CPU_DATA_BLOCK
*) Context
;
1229 if (CpuData
->TimeoutActive
) {
1230 CpuData
->Timeout
-= gPollInterval
;
1233 CpuState
= GetApState (CpuData
);
1235 if (CpuState
== CpuStateFinished
) {
1236 if (CpuData
->Finished
) {
1237 *CpuData
->Finished
= TRUE
;
1239 SetApState (CpuData
, CpuStateIdle
);
1243 if (CpuData
->TimeoutActive
&& CpuData
->Timeout
< 0) {
1244 if (CpuState
!= CpuStateIdle
&&
1245 CpuData
->Finished
) {
1246 *CpuData
->Finished
= FALSE
;
1248 ResetProcessorToIdleState (CpuData
);
1255 CpuData
->TimeoutActive
= FALSE
;
1256 gBS
->SignalEvent (CpuData
->WaitEvent
);
1257 CpuData
->WaitEvent
= NULL
;
1261 Checks APs' status periodically.
1263 This function is triggerred by timer perodically to check the
1264 state of APs for StartupAllAPs() executed in non-blocking mode.
1266 @param Event Event triggered.
1267 @param Context Parameter passed with the event.
1277 CPU_DATA_BLOCK
*CpuData
;
1281 if (mMpSystemData
.TimeoutActive
) {
1282 mMpSystemData
.Timeout
-= gPollInterval
;
1285 if (mStopCheckAllAPsStatus
) {
1290 // avoid next timer enter.
1292 Status
= gBS
->SetTimer (
1293 mMpSystemData
.CheckAllAPsEvent
,
1297 ASSERT_EFI_ERROR (Status
);
1299 if (mMpSystemData
.WaitEvent
!= NULL
) {
1300 CheckAndUpdateAllAPsToIdleState ();
1304 if (mMpSystemData
.TimeoutActive
&& mMpSystemData
.Timeout
< 0) {
1305 ResetAllFailedAPs();
1309 mMpSystemData
.FinishCount
= mMpSystemData
.StartCount
;
1312 if (mMpSystemData
.FinishCount
!= mMpSystemData
.StartCount
) {
1316 mMpSystemData
.TimeoutActive
= FALSE
;
1317 gBS
->SignalEvent (mMpSystemData
.WaitEvent
);
1318 mMpSystemData
.WaitEvent
= NULL
;
1319 mStopCheckAllAPsStatus
= TRUE
;
1325 // check each AP status for StartupThisAP
1327 for (Number
= 0; Number
< mMpSystemData
.NumberOfProcessors
; Number
++) {
1328 CpuData
= &mMpSystemData
.CpuDatas
[Number
];
1329 if (CpuData
->WaitEvent
) {
1330 CheckThisAPStatus (NULL
, (VOID
*)CpuData
);
1335 Status
= gBS
->SetTimer (
1336 mMpSystemData
.CheckAllAPsEvent
,
1338 EFI_TIMER_PERIOD_MICROSECONDS (100)
1340 ASSERT_EFI_ERROR (Status
);
1344 Application Processor C code entry point.
1354 UINTN ProcessorNumber
;
1356 if (!mAPsAlreadyInitFinished
) {
1357 FillInProcessorInformation (FALSE
, mMpSystemData
.NumberOfProcessors
);
1358 TopOfApStack
= (UINT8
*)mApStackStart
+ gApStackSize
;
1359 mApStackStart
= TopOfApStack
;
1362 // Store the Stack address, when reset the AP, We can found the original address.
1364 mMpSystemData
.CpuDatas
[mMpSystemData
.NumberOfProcessors
].TopOfStack
= TopOfApStack
;
1365 mMpSystemData
.NumberOfProcessors
++;
1366 mMpSystemData
.NumberOfEnabledProcessors
++;
1368 WhoAmI (&mMpServicesTemplate
, &ProcessorNumber
);
1370 // Get the original stack address.
1372 TopOfApStack
= mMpSystemData
.CpuDatas
[ProcessorNumber
].TopOfStack
;
1376 (SWITCH_STACK_ENTRY_POINT
)(UINTN
)ProcessorToIdleState
,
1383 This function is called by all processors (both BSP and AP) once and collects MP related data.
1385 @param Bsp TRUE if the CPU is BSP
1386 @param ProcessorNumber The specific processor number
1388 @retval EFI_SUCCESS Data for the processor collected and filled in
1392 FillInProcessorInformation (
1394 IN UINTN ProcessorNumber
1397 CPU_DATA_BLOCK
*CpuData
;
1400 CpuData
= &mMpSystemData
.CpuDatas
[ProcessorNumber
];
1401 ProcessorId
= GetApicId ();
1402 CpuData
->Info
.ProcessorId
= ProcessorId
;
1403 CpuData
->Info
.StatusFlag
= PROCESSOR_ENABLED_BIT
| PROCESSOR_HEALTH_STATUS_BIT
;
1405 CpuData
->Info
.StatusFlag
|= PROCESSOR_AS_BSP_BIT
;
1407 CpuData
->Info
.Location
.Package
= ProcessorId
;
1408 CpuData
->Info
.Location
.Core
= 0;
1409 CpuData
->Info
.Location
.Thread
= 0;
1410 CpuData
->State
= Bsp
? CpuStateBuzy
: CpuStateIdle
;
1412 CpuData
->Procedure
= NULL
;
1413 CpuData
->Parameter
= NULL
;
1414 InitializeSpinLock (&CpuData
->CpuDataLock
);
1415 CpuData
->LockSelf
= -1;
1421 Prepare the System Data.
1423 @retval EFI_SUCCESS the System Data finished initilization.
1433 ZeroMem (&mMpSystemData
, sizeof (MP_SYSTEM_DATA
));
1435 mMpSystemData
.NumberOfProcessors
= 1;
1436 mMpSystemData
.NumberOfEnabledProcessors
= 1;
1438 mMpSystemData
.CpuDatas
= AllocateZeroPool (sizeof (CPU_DATA_BLOCK
) * gMaxLogicalProcessorNumber
);
1439 ASSERT(mMpSystemData
.CpuDatas
!= NULL
);
1441 Status
= gBS
->CreateEvent (
1442 EVT_TIMER
| EVT_NOTIFY_SIGNAL
,
1446 &mMpSystemData
.CheckAllAPsEvent
1448 ASSERT_EFI_ERROR (Status
);
1451 // Set timer to check all APs status.
1453 Status
= gBS
->SetTimer (
1454 mMpSystemData
.CheckAllAPsEvent
,
1456 EFI_TIMER_PERIOD_MICROSECONDS (100)
1458 ASSERT_EFI_ERROR (Status
);
1463 FillInProcessorInformation (TRUE
, 0);
1469 Callback function for ExitBootServices.
1471 @param Event Event whose notification function is being invoked.
1472 @param Context The pointer to the notification function's context,
1473 which is implementation-dependent.
1478 ExitBootServicesCallback (
1484 // Avoid APs access invalid buff datas which allocated by BootServices,
1485 // so we send INIT IPI to APs to let them wait for SIPI state.
1487 SendInitIpiAllExcludingSelf ();
1491 Initialize Multi-processor support.
1495 InitializeMpSupport (
1501 gMaxLogicalProcessorNumber
= (UINTN
) PcdGet32 (PcdCpuMaxLogicalProcessorNumber
);
1502 if (gMaxLogicalProcessorNumber
< 1) {
1503 DEBUG ((DEBUG_ERROR
, "Setting PcdCpuMaxLogicalProcessorNumber should be more than zero.\n"));
1507 if (gMaxLogicalProcessorNumber
== 1) {
1511 gApStackSize
= (UINTN
) PcdGet32 (PcdCpuApStackSize
);
1512 ASSERT ((gApStackSize
& (SIZE_4KB
- 1)) == 0);
1514 mApStackStart
= AllocatePages (EFI_SIZE_TO_PAGES (gMaxLogicalProcessorNumber
* gApStackSize
));
1515 ASSERT (mApStackStart
!= NULL
);
1518 // the first buffer of stack size used for common stack, when the amount of AP
1519 // more than 1, we should never free the common stack which maybe used for AP reset.
1521 mCommonStack
= mApStackStart
;
1522 mTopOfApCommonStack
= (UINT8
*) mApStackStart
+ gApStackSize
;
1523 mApStackStart
= mTopOfApCommonStack
;
1525 InitMpSystemData ();
1527 PrepareAPStartupCode ();
1529 StartApsStackless ();
1531 DEBUG ((DEBUG_INFO
, "Detect CPU count: %d\n", mMpSystemData
.NumberOfProcessors
));
1532 if (mMpSystemData
.NumberOfProcessors
== 1) {
1533 FreeApStartupCode ();
1534 FreePages (mCommonStack
, EFI_SIZE_TO_PAGES (gMaxLogicalProcessorNumber
* gApStackSize
));
1538 mMpSystemData
.CpuDatas
= ReallocatePool (
1539 sizeof (CPU_DATA_BLOCK
) * gMaxLogicalProcessorNumber
,
1540 sizeof (CPU_DATA_BLOCK
) * mMpSystemData
.NumberOfProcessors
,
1541 mMpSystemData
.CpuDatas
);
1543 mAPsAlreadyInitFinished
= TRUE
;
1545 Status
= gBS
->InstallMultipleProtocolInterfaces (
1547 &gEfiMpServiceProtocolGuid
, &mMpServicesTemplate
,
1550 ASSERT_EFI_ERROR (Status
);
1552 if (mMpSystemData
.NumberOfProcessors
< gMaxLogicalProcessorNumber
) {
1553 FreePages (mApStackStart
, EFI_SIZE_TO_PAGES (
1554 (gMaxLogicalProcessorNumber
- mMpSystemData
.NumberOfProcessors
) *
1558 Status
= gBS
->CreateEvent (
1559 EVT_SIGNAL_EXIT_BOOT_SERVICES
,
1561 ExitBootServicesCallback
,
1563 &mExitBootServicesEvent
1565 ASSERT_EFI_ERROR (Status
);