]> git.proxmox.com Git - mirror_edk2.git/blob - UefiCpuPkg/Library/MpInitLib/DxeMpLib.c
UefiCpuPkg/DxeMpLib: Place APs to suitable state on Legacy OS boot
[mirror_edk2.git] / UefiCpuPkg / Library / MpInitLib / DxeMpLib.c
1 /** @file
2 MP initialize support functions for DXE phase.
3
4 Copyright (c) 2016, 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 #include "MpLib.h"
16
17 #include <Library/UefiLib.h>
18 #include <Library/UefiBootServicesTableLib.h>
19
20 #define AP_CHECK_INTERVAL (EFI_TIMER_PERIOD_MILLISECONDS (100))
21
22 CPU_MP_DATA *mCpuMpData = NULL;
23 EFI_EVENT mCheckAllApsEvent = NULL;
24 EFI_EVENT mMpInitExitBootServicesEvent = NULL;
25 EFI_EVENT mLegacyBootEvent = NULL;
26 volatile BOOLEAN mStopCheckAllApsStatus = TRUE;
27 VOID *mReservedApLoopFunc = NULL;
28
29 /**
30 Get the pointer to CPU MP Data structure.
31
32 @return The pointer to CPU MP Data structure.
33 **/
34 CPU_MP_DATA *
35 GetCpuMpData (
36 VOID
37 )
38 {
39 ASSERT (mCpuMpData != NULL);
40 return mCpuMpData;
41 }
42
43 /**
44 Save the pointer to CPU MP Data structure.
45
46 @param[in] CpuMpData The pointer to CPU MP Data structure will be saved.
47 **/
48 VOID
49 SaveCpuMpData (
50 IN CPU_MP_DATA *CpuMpData
51 )
52 {
53 mCpuMpData = CpuMpData;
54 }
55
56 /**
57 Allocate reset vector buffer.
58
59 @param[in, out] CpuMpData The pointer to CPU MP Data structure.
60 **/
61 VOID
62 AllocateResetVector (
63 IN OUT CPU_MP_DATA *CpuMpData
64 )
65 {
66 EFI_STATUS Status;
67 UINTN ApResetVectorSize;
68 EFI_PHYSICAL_ADDRESS StartAddress;
69
70 if (CpuMpData->SaveRestoreFlag) {
71 BackupAndPrepareWakeupBuffer (CpuMpData);
72 } else {
73 ApResetVectorSize = CpuMpData->AddressMap.RendezvousFunnelSize +
74 sizeof (MP_CPU_EXCHANGE_INFO);
75
76 StartAddress = BASE_1MB;
77 Status = gBS->AllocatePages (
78 AllocateMaxAddress,
79 EfiACPIMemoryNVS,
80 EFI_SIZE_TO_PAGES (ApResetVectorSize),
81 &StartAddress
82 );
83 ASSERT_EFI_ERROR (Status);
84
85 CpuMpData->WakeupBuffer = (UINTN) StartAddress;
86 CpuMpData->MpCpuExchangeInfo = (MP_CPU_EXCHANGE_INFO *) (UINTN)
87 (CpuMpData->WakeupBuffer + CpuMpData->AddressMap.RendezvousFunnelSize);
88 //
89 // copy AP reset code in it
90 //
91 CopyMem (
92 (VOID *) CpuMpData->WakeupBuffer,
93 (VOID *) CpuMpData->AddressMap.RendezvousFunnelAddress,
94 CpuMpData->AddressMap.RendezvousFunnelSize
95 );
96 }
97 }
98
99 /**
100 Free AP reset vector buffer.
101
102 @param[in] CpuMpData The pointer to CPU MP Data structure.
103 **/
104 VOID
105 FreeResetVector (
106 IN CPU_MP_DATA *CpuMpData
107 )
108 {
109 EFI_STATUS Status;
110 UINTN ApResetVectorSize;
111
112 if (CpuMpData->SaveRestoreFlag) {
113 RestoreWakeupBuffer (CpuMpData);
114 } else {
115 ApResetVectorSize = CpuMpData->AddressMap.RendezvousFunnelSize +
116 sizeof (MP_CPU_EXCHANGE_INFO);
117 Status = gBS->FreePages(
118 (EFI_PHYSICAL_ADDRESS)CpuMpData->WakeupBuffer,
119 EFI_SIZE_TO_PAGES (ApResetVectorSize)
120 );
121 ASSERT_EFI_ERROR (Status);
122 }
123 }
124
125 /**
126 Checks APs status and updates APs status if needed.
127
128 **/
129 VOID
130 CheckAndUpdateApsStatus (
131 VOID
132 )
133 {
134 UINTN ProcessorNumber;
135 EFI_STATUS Status;
136 CPU_MP_DATA *CpuMpData;
137
138 CpuMpData = GetCpuMpData ();
139
140 //
141 // First, check whether pending StartupAllAPs() exists.
142 //
143 if (CpuMpData->WaitEvent != NULL) {
144
145 Status = CheckAllAPs ();
146 //
147 // If all APs finish for StartupAllAPs(), signal the WaitEvent for it.
148 //
149 if (Status != EFI_NOT_READY) {
150 Status = gBS->SignalEvent (CpuMpData->WaitEvent);
151 CpuMpData->WaitEvent = NULL;
152 }
153 }
154
155 //
156 // Second, check whether pending StartupThisAPs() callings exist.
157 //
158 for (ProcessorNumber = 0; ProcessorNumber < CpuMpData->CpuCount; ProcessorNumber++) {
159
160 if (CpuMpData->CpuData[ProcessorNumber].WaitEvent == NULL) {
161 continue;
162 }
163
164 Status = CheckThisAP (ProcessorNumber);
165
166 if (Status != EFI_NOT_READY) {
167 gBS->SignalEvent (CpuMpData->CpuData[ProcessorNumber].WaitEvent);
168 CpuMpData->CpuData[ProcessorNumber].WaitEvent = NULL;
169 }
170 }
171 }
172
173 /**
174 Checks APs' status periodically.
175
176 This function is triggered by timer periodically to check the
177 state of APs for StartupAllAPs() and StartupThisAP() executed
178 in non-blocking mode.
179
180 @param[in] Event Event triggered.
181 @param[in] Context Parameter passed with the event.
182
183 **/
184 VOID
185 EFIAPI
186 CheckApsStatus (
187 IN EFI_EVENT Event,
188 IN VOID *Context
189 )
190 {
191 //
192 // If CheckApsStatus() is not stopped, otherwise return immediately.
193 //
194 if (!mStopCheckAllApsStatus) {
195 CheckAndUpdateApsStatus ();
196 }
197 }
198
199 /**
200 Get Protected mode code segment from current GDT table.
201
202 @return Protected mode code segment value.
203 **/
204 UINT16
205 GetProtectedModeCS (
206 VOID
207 )
208 {
209 IA32_DESCRIPTOR GdtrDesc;
210 IA32_SEGMENT_DESCRIPTOR *GdtEntry;
211 UINTN GdtEntryCount;
212 UINT16 Index;
213
214 Index = (UINT16) -1;
215 AsmReadGdtr (&GdtrDesc);
216 GdtEntryCount = (GdtrDesc.Limit + 1) / sizeof (IA32_SEGMENT_DESCRIPTOR);
217 GdtEntry = (IA32_SEGMENT_DESCRIPTOR *) GdtrDesc.Base;
218 for (Index = 0; Index < GdtEntryCount; Index++) {
219 if (GdtEntry->Bits.L == 0) {
220 if (GdtEntry->Bits.Type > 8 && GdtEntry->Bits.L == 0) {
221 break;
222 }
223 }
224 GdtEntry++;
225 }
226 ASSERT (Index != -1);
227 return Index * 8;
228 }
229
230 /**
231 Do sync on APs.
232
233 @param[in, out] Buffer Pointer to private data buffer.
234 **/
235 VOID
236 EFIAPI
237 RelocateApLoop (
238 IN OUT VOID *Buffer
239 )
240 {
241 CPU_MP_DATA *CpuMpData;
242 BOOLEAN MwaitSupport;
243 ASM_RELOCATE_AP_LOOP AsmRelocateApLoopFunc;
244
245 CpuMpData = GetCpuMpData ();
246 MwaitSupport = IsMwaitSupport ();
247 AsmRelocateApLoopFunc = (ASM_RELOCATE_AP_LOOP) (UINTN) Buffer;
248 AsmRelocateApLoopFunc (MwaitSupport, CpuMpData->ApTargetCState, CpuMpData->PmCodeSegment);
249 //
250 // It should never reach here
251 //
252 ASSERT (FALSE);
253 }
254
255 /**
256 Callback function for ExitBootServices.
257
258 @param[in] Event Event whose notification function is being invoked.
259 @param[in] Context The pointer to the notification function's context,
260 which is implementation-dependent.
261
262 **/
263 VOID
264 EFIAPI
265 MpInitChangeApLoopCallback (
266 IN EFI_EVENT Event,
267 IN VOID *Context
268 )
269 {
270 CPU_MP_DATA *CpuMpData;
271
272 CpuMpData = GetCpuMpData ();
273 CpuMpData->SaveRestoreFlag = TRUE;
274 CpuMpData->PmCodeSegment = GetProtectedModeCS ();
275 CpuMpData->ApLoopMode = PcdGet8 (PcdCpuApLoopMode);
276 WakeUpAP (CpuMpData, TRUE, 0, RelocateApLoop, mReservedApLoopFunc);
277 DEBUG ((DEBUG_INFO, "%a() done!\n", __FUNCTION__));
278 }
279
280 /**
281 Initialize global data for MP support.
282
283 @param[in] CpuMpData The pointer to CPU MP Data structure.
284 **/
285 VOID
286 InitMpGlobalData (
287 IN CPU_MP_DATA *CpuMpData
288 )
289 {
290 EFI_STATUS Status;
291 EFI_PHYSICAL_ADDRESS Address;
292
293 SaveCpuMpData (CpuMpData);
294
295 if (CpuMpData->CpuCount == 1) {
296 //
297 // If only BSP exists, return
298 //
299 return;
300 }
301
302 //
303 // Avoid APs access invalid buffer data which allocated by BootServices,
304 // so we will allocate reserved data for AP loop code. We also need to
305 // allocate this buffer below 4GB due to APs may be transferred to 32bit
306 // protected mode on long mode DXE.
307 // Allocating it in advance since memory services are not available in
308 // Exit Boot Services callback function.
309 //
310 Address = BASE_4GB - 1;
311 Status = gBS->AllocatePages (
312 AllocateMaxAddress,
313 EfiReservedMemoryType,
314 EFI_SIZE_TO_PAGES (sizeof (CpuMpData->AddressMap.RelocateApLoopFuncSize)),
315 &Address
316 );
317 ASSERT_EFI_ERROR (Status);
318 mReservedApLoopFunc = (VOID *) (UINTN) Address;
319 ASSERT (mReservedApLoopFunc != NULL);
320 CopyMem (
321 mReservedApLoopFunc,
322 CpuMpData->AddressMap.RelocateApLoopFuncAddress,
323 CpuMpData->AddressMap.RelocateApLoopFuncSize
324 );
325
326 Status = gBS->CreateEvent (
327 EVT_TIMER | EVT_NOTIFY_SIGNAL,
328 TPL_NOTIFY,
329 CheckApsStatus,
330 NULL,
331 &mCheckAllApsEvent
332 );
333 ASSERT_EFI_ERROR (Status);
334
335 //
336 // Set timer to check all APs status.
337 //
338 Status = gBS->SetTimer (
339 mCheckAllApsEvent,
340 TimerPeriodic,
341 AP_CHECK_INTERVAL
342 );
343 ASSERT_EFI_ERROR (Status);
344
345 Status = gBS->CreateEvent (
346 EVT_SIGNAL_EXIT_BOOT_SERVICES,
347 TPL_CALLBACK,
348 MpInitChangeApLoopCallback,
349 NULL,
350 &mMpInitExitBootServicesEvent
351 );
352 ASSERT_EFI_ERROR (Status);
353
354 Status = gBS->CreateEventEx (
355 EVT_NOTIFY_SIGNAL,
356 TPL_CALLBACK,
357 MpInitChangeApLoopCallback,
358 NULL,
359 &gEfiEventLegacyBootGuid,
360 &mLegacyBootEvent
361 );
362 ASSERT_EFI_ERROR (Status);
363 }
364
365 /**
366 This service executes a caller provided function on all enabled APs.
367
368 @param[in] Procedure A pointer to the function to be run on
369 enabled APs of the system. See type
370 EFI_AP_PROCEDURE.
371 @param[in] SingleThread If TRUE, then all the enabled APs execute
372 the function specified by Procedure one by
373 one, in ascending order of processor handle
374 number. If FALSE, then all the enabled APs
375 execute the function specified by Procedure
376 simultaneously.
377 @param[in] WaitEvent The event created by the caller with CreateEvent()
378 service. If it is NULL, then execute in
379 blocking mode. BSP waits until all APs finish
380 or TimeoutInMicroSeconds expires. If it's
381 not NULL, then execute in non-blocking mode.
382 BSP requests the function specified by
383 Procedure to be started on all the enabled
384 APs, and go on executing immediately. If
385 all return from Procedure, or TimeoutInMicroSeconds
386 expires, this event is signaled. The BSP
387 can use the CheckEvent() or WaitForEvent()
388 services to check the state of event. Type
389 EFI_EVENT is defined in CreateEvent() in
390 the Unified Extensible Firmware Interface
391 Specification.
392 @param[in] TimeoutInMicrosecsond Indicates the time limit in microseconds for
393 APs to return from Procedure, either for
394 blocking or non-blocking mode. Zero means
395 infinity. If the timeout expires before
396 all APs return from Procedure, then Procedure
397 on the failed APs is terminated. All enabled
398 APs are available for next function assigned
399 by MpInitLibStartupAllAPs() or
400 MPInitLibStartupThisAP().
401 If the timeout expires in blocking mode,
402 BSP returns EFI_TIMEOUT. If the timeout
403 expires in non-blocking mode, WaitEvent
404 is signaled with SignalEvent().
405 @param[in] ProcedureArgument The parameter passed into Procedure for
406 all APs.
407 @param[out] FailedCpuList If NULL, this parameter is ignored. Otherwise,
408 if all APs finish successfully, then its
409 content is set to NULL. If not all APs
410 finish before timeout expires, then its
411 content is set to address of the buffer
412 holding handle numbers of the failed APs.
413 The buffer is allocated by MP Initialization
414 library, and it's the caller's responsibility to
415 free the buffer with FreePool() service.
416 In blocking mode, it is ready for consumption
417 when the call returns. In non-blocking mode,
418 it is ready when WaitEvent is signaled. The
419 list of failed CPU is terminated by
420 END_OF_CPU_LIST.
421
422 @retval EFI_SUCCESS In blocking mode, all APs have finished before
423 the timeout expired.
424 @retval EFI_SUCCESS In non-blocking mode, function has been dispatched
425 to all enabled APs.
426 @retval EFI_UNSUPPORTED A non-blocking mode request was made after the
427 UEFI event EFI_EVENT_GROUP_READY_TO_BOOT was
428 signaled.
429 @retval EFI_UNSUPPORTED WaitEvent is not NULL if non-blocking mode is not
430 supported.
431 @retval EFI_DEVICE_ERROR Caller processor is AP.
432 @retval EFI_NOT_STARTED No enabled APs exist in the system.
433 @retval EFI_NOT_READY Any enabled APs are busy.
434 @retval EFI_NOT_READY MP Initialize Library is not initialized.
435 @retval EFI_TIMEOUT In blocking mode, the timeout expired before
436 all enabled APs have finished.
437 @retval EFI_INVALID_PARAMETER Procedure is NULL.
438
439 **/
440 EFI_STATUS
441 EFIAPI
442 MpInitLibStartupAllAPs (
443 IN EFI_AP_PROCEDURE Procedure,
444 IN BOOLEAN SingleThread,
445 IN EFI_EVENT WaitEvent OPTIONAL,
446 IN UINTN TimeoutInMicroseconds,
447 IN VOID *ProcedureArgument OPTIONAL,
448 OUT UINTN **FailedCpuList OPTIONAL
449 )
450 {
451 EFI_STATUS Status;
452
453 //
454 // Temporarily stop checkAllApsStatus for avoid resource dead-lock.
455 //
456 mStopCheckAllApsStatus = TRUE;
457
458 Status = StartupAllAPsWorker (
459 Procedure,
460 SingleThread,
461 WaitEvent,
462 TimeoutInMicroseconds,
463 ProcedureArgument,
464 FailedCpuList
465 );
466
467 //
468 // Start checkAllApsStatus
469 //
470 mStopCheckAllApsStatus = FALSE;
471
472 return Status;
473 }
474
475 /**
476 This service lets the caller get one enabled AP to execute a caller-provided
477 function.
478
479 @param[in] Procedure A pointer to the function to be run on the
480 designated AP of the system. See type
481 EFI_AP_PROCEDURE.
482 @param[in] ProcessorNumber The handle number of the AP. The range is
483 from 0 to the total number of logical
484 processors minus 1. The total number of
485 logical processors can be retrieved by
486 MpInitLibGetNumberOfProcessors().
487 @param[in] WaitEvent The event created by the caller with CreateEvent()
488 service. If it is NULL, then execute in
489 blocking mode. BSP waits until this AP finish
490 or TimeoutInMicroSeconds expires. If it's
491 not NULL, then execute in non-blocking mode.
492 BSP requests the function specified by
493 Procedure to be started on this AP,
494 and go on executing immediately. If this AP
495 return from Procedure or TimeoutInMicroSeconds
496 expires, this event is signaled. The BSP
497 can use the CheckEvent() or WaitForEvent()
498 services to check the state of event. Type
499 EFI_EVENT is defined in CreateEvent() in
500 the Unified Extensible Firmware Interface
501 Specification.
502 @param[in] TimeoutInMicrosecsond Indicates the time limit in microseconds for
503 this AP to finish this Procedure, either for
504 blocking or non-blocking mode. Zero means
505 infinity. If the timeout expires before
506 this AP returns from Procedure, then Procedure
507 on the AP is terminated. The
508 AP is available for next function assigned
509 by MpInitLibStartupAllAPs() or
510 MpInitLibStartupThisAP().
511 If the timeout expires in blocking mode,
512 BSP returns EFI_TIMEOUT. If the timeout
513 expires in non-blocking mode, WaitEvent
514 is signaled with SignalEvent().
515 @param[in] ProcedureArgument The parameter passed into Procedure on the
516 specified AP.
517 @param[out] Finished If NULL, this parameter is ignored. In
518 blocking mode, this parameter is ignored.
519 In non-blocking mode, if AP returns from
520 Procedure before the timeout expires, its
521 content is set to TRUE. Otherwise, the
522 value is set to FALSE. The caller can
523 determine if the AP returned from Procedure
524 by evaluating this value.
525
526 @retval EFI_SUCCESS In blocking mode, specified AP finished before
527 the timeout expires.
528 @retval EFI_SUCCESS In non-blocking mode, the function has been
529 dispatched to specified AP.
530 @retval EFI_UNSUPPORTED A non-blocking mode request was made after the
531 UEFI event EFI_EVENT_GROUP_READY_TO_BOOT was
532 signaled.
533 @retval EFI_UNSUPPORTED WaitEvent is not NULL if non-blocking mode is not
534 supported.
535 @retval EFI_DEVICE_ERROR The calling processor is an AP.
536 @retval EFI_TIMEOUT In blocking mode, the timeout expired before
537 the specified AP has finished.
538 @retval EFI_NOT_READY The specified AP is busy.
539 @retval EFI_NOT_READY MP Initialize Library is not initialized.
540 @retval EFI_NOT_FOUND The processor with the handle specified by
541 ProcessorNumber does not exist.
542 @retval EFI_INVALID_PARAMETER ProcessorNumber specifies the BSP or disabled AP.
543 @retval EFI_INVALID_PARAMETER Procedure is NULL.
544
545 **/
546 EFI_STATUS
547 EFIAPI
548 MpInitLibStartupThisAP (
549 IN EFI_AP_PROCEDURE Procedure,
550 IN UINTN ProcessorNumber,
551 IN EFI_EVENT WaitEvent OPTIONAL,
552 IN UINTN TimeoutInMicroseconds,
553 IN VOID *ProcedureArgument OPTIONAL,
554 OUT BOOLEAN *Finished OPTIONAL
555 )
556 {
557 EFI_STATUS Status;
558
559 //
560 // temporarily stop checkAllApsStatus for avoid resource dead-lock.
561 //
562 mStopCheckAllApsStatus = TRUE;
563
564 Status = StartupThisAPWorker (
565 Procedure,
566 ProcessorNumber,
567 WaitEvent,
568 TimeoutInMicroseconds,
569 ProcedureArgument,
570 Finished
571 );
572
573 mStopCheckAllApsStatus = FALSE;
574
575 return Status;
576 }
577
578 /**
579 This service switches the requested AP to be the BSP from that point onward.
580 This service changes the BSP for all purposes. This call can only be performed
581 by the current BSP.
582
583 @param[in] ProcessorNumber The handle number of AP that is to become the new
584 BSP. The range is from 0 to the total number of
585 logical processors minus 1. The total number of
586 logical processors can be retrieved by
587 MpInitLibGetNumberOfProcessors().
588 @param[in] EnableOldBSP If TRUE, then the old BSP will be listed as an
589 enabled AP. Otherwise, it will be disabled.
590
591 @retval EFI_SUCCESS BSP successfully switched.
592 @retval EFI_UNSUPPORTED Switching the BSP cannot be completed prior to
593 this service returning.
594 @retval EFI_UNSUPPORTED Switching the BSP is not supported.
595 @retval EFI_DEVICE_ERROR The calling processor is an AP.
596 @retval EFI_NOT_FOUND The processor with the handle specified by
597 ProcessorNumber does not exist.
598 @retval EFI_INVALID_PARAMETER ProcessorNumber specifies the current BSP or
599 a disabled AP.
600 @retval EFI_NOT_READY The specified AP is busy.
601 @retval EFI_NOT_READY MP Initialize Library is not initialized.
602
603 **/
604 EFI_STATUS
605 EFIAPI
606 MpInitLibSwitchBSP (
607 IN UINTN ProcessorNumber,
608 IN BOOLEAN EnableOldBSP
609 )
610 {
611 EFI_STATUS Status;
612 BOOLEAN OldInterruptState;
613
614 //
615 // Before send both BSP and AP to a procedure to exchange their roles,
616 // interrupt must be disabled. This is because during the exchange role
617 // process, 2 CPU may use 1 stack. If interrupt happens, the stack will
618 // be corrupted, since interrupt return address will be pushed to stack
619 // by hardware.
620 //
621 OldInterruptState = SaveAndDisableInterrupts ();
622
623 //
624 // Mask LINT0 & LINT1 for the old BSP
625 //
626 DisableLvtInterrupts ();
627
628 Status = SwitchBSPWorker (ProcessorNumber, EnableOldBSP);
629
630 //
631 // Restore interrupt state.
632 //
633 SetInterruptState (OldInterruptState);
634
635 return Status;
636 }
637
638 /**
639 This service lets the caller enable or disable an AP from this point onward.
640 This service may only be called from the BSP.
641
642 @param[in] ProcessorNumber The handle number of AP.
643 The range is from 0 to the total number of
644 logical processors minus 1. The total number of
645 logical processors can be retrieved by
646 MpInitLibGetNumberOfProcessors().
647 @param[in] EnableAP Specifies the new state for the processor for
648 enabled, FALSE for disabled.
649 @param[in] HealthFlag If not NULL, a pointer to a value that specifies
650 the new health status of the AP. This flag
651 corresponds to StatusFlag defined in
652 EFI_MP_SERVICES_PROTOCOL.GetProcessorInfo(). Only
653 the PROCESSOR_HEALTH_STATUS_BIT is used. All other
654 bits are ignored. If it is NULL, this parameter
655 is ignored.
656
657 @retval EFI_SUCCESS The specified AP was enabled or disabled successfully.
658 @retval EFI_UNSUPPORTED Enabling or disabling an AP cannot be completed
659 prior to this service returning.
660 @retval EFI_UNSUPPORTED Enabling or disabling an AP is not supported.
661 @retval EFI_DEVICE_ERROR The calling processor is an AP.
662 @retval EFI_NOT_FOUND Processor with the handle specified by ProcessorNumber
663 does not exist.
664 @retval EFI_INVALID_PARAMETER ProcessorNumber specifies the BSP.
665 @retval EFI_NOT_READY MP Initialize Library is not initialized.
666
667 **/
668 EFI_STATUS
669 EFIAPI
670 MpInitLibEnableDisableAP (
671 IN UINTN ProcessorNumber,
672 IN BOOLEAN EnableAP,
673 IN UINT32 *HealthFlag OPTIONAL
674 )
675 {
676 EFI_STATUS Status;
677 BOOLEAN TempStopCheckState;
678
679 TempStopCheckState = FALSE;
680 //
681 // temporarily stop checkAllAPsStatus for initialize parameters.
682 //
683 if (!mStopCheckAllApsStatus) {
684 mStopCheckAllApsStatus = TRUE;
685 TempStopCheckState = TRUE;
686 }
687
688 Status = EnableDisableApWorker (ProcessorNumber, EnableAP, HealthFlag);
689
690 if (TempStopCheckState) {
691 mStopCheckAllApsStatus = FALSE;
692 }
693
694 return Status;
695 }