]> git.proxmox.com Git - mirror_edk2.git/blame - UefiCpuPkg/Library/MpInitLib/PeiMpLib.c
UefiCpuPkg/MpInitLib: Move two functions location
[mirror_edk2.git] / UefiCpuPkg / Library / MpInitLib / PeiMpLib.c
CommitLineData
3e8ad6bd
JF
1/** @file\r
2 MP initialize support functions for PEI phase.\r
3\r
4 Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>\r
5 This program and the accompanying materials\r
6 are licensed and made available under the terms and conditions of the BSD License\r
7 which accompanies this distribution. The full text of the license may be found at\r
8 http://opensource.org/licenses/bsd-license.php\r
9\r
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13**/\r
14\r
15#include "MpLib.h"\r
6dc05093
JF
16#include <Ppi/EndOfPeiPhase.h>\r
17#include <Library/PeiServicesLib.h>\r
18\r
19//\r
20// Global PEI notify function descriptor on EndofPei event\r
21//\r
22GLOBAL_REMOVE_IF_UNREFERENCED EFI_PEI_NOTIFY_DESCRIPTOR mMpInitLibNotifyList = {\r
23 (EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),\r
24 &gEfiEndOfPeiSignalPpiGuid,\r
25 CpuMpEndOfPeiCallback\r
26};\r
3e8ad6bd 27\r
93ca4c0f
JF
28/**\r
29 Get pointer to CPU MP Data structure.\r
30\r
31 @return The pointer to CPU MP Data structure.\r
32**/\r
33CPU_MP_DATA *\r
34GetCpuMpData (\r
35 VOID\r
36 )\r
37{\r
38 CPU_MP_DATA *CpuMpData;\r
39\r
40 CpuMpData = GetCpuMpDataFromGuidedHob ();\r
41 ASSERT (CpuMpData != NULL);\r
42 return CpuMpData;\r
43}\r
44\r
45/**\r
46 Save the pointer to CPU MP Data structure.\r
47\r
48 @param[in] CpuMpData The pointer to CPU MP Data structure will be saved.\r
49**/\r
50VOID\r
51SaveCpuMpData (\r
52 IN CPU_MP_DATA *CpuMpData\r
53 )\r
54{\r
55 UINT64 Data64;\r
56 //\r
57 // Build location of CPU MP DATA buffer in HOB\r
58 //\r
59 Data64 = (UINT64) (UINTN) CpuMpData;\r
60 BuildGuidDataHob (\r
61 &mCpuInitMpLibHobGuid,\r
62 (VOID *) &Data64,\r
63 sizeof (UINT64)\r
64 );\r
65}\r
66\r
6dc05093
JF
67/**\r
68 Notify function on End Of PEI PPI.\r
69\r
70 On S3 boot, this function will restore wakeup buffer data.\r
71 On normal boot, this function will flag wakeup buffer to be un-used type.\r
72\r
73 @param[in] PeiServices The pointer to the PEI Services Table.\r
74 @param[in] NotifyDescriptor Address of the notification descriptor data structure.\r
75 @param[in] Ppi Address of the PPI that was installed.\r
76\r
77 @retval EFI_SUCCESS When everything is OK.\r
78**/\r
79EFI_STATUS\r
80EFIAPI\r
81CpuMpEndOfPeiCallback (\r
82 IN EFI_PEI_SERVICES **PeiServices,\r
83 IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,\r
84 IN VOID *Ppi\r
85 )\r
86{\r
ed66e0e3
JF
87 EFI_STATUS Status;\r
88 EFI_BOOT_MODE BootMode;\r
89 CPU_MP_DATA *CpuMpData;\r
90 EFI_PEI_HOB_POINTERS Hob;\r
91 EFI_HOB_MEMORY_ALLOCATION *MemoryHob;\r
6dc05093
JF
92\r
93 DEBUG ((DEBUG_INFO, "PeiMpInitLib: CpuMpEndOfPeiCallback () invoked\n"));\r
94\r
ed66e0e3
JF
95 Status = PeiServicesGetBootMode (&BootMode);\r
96 ASSERT_EFI_ERROR (Status);\r
97\r
98 CpuMpData = GetCpuMpData ();\r
99 if (BootMode != BOOT_ON_S3_RESUME) {\r
100 //\r
101 // Get the HOB list for processing\r
102 //\r
103 Hob.Raw = GetHobList ();\r
104 //\r
105 // Collect memory ranges\r
106 //\r
107 while (!END_OF_HOB_LIST (Hob)) {\r
108 if (Hob.Header->HobType == EFI_HOB_TYPE_MEMORY_ALLOCATION) {\r
109 MemoryHob = Hob.MemoryAllocation;\r
110 if (MemoryHob->AllocDescriptor.MemoryBaseAddress == CpuMpData->WakeupBuffer) {\r
111 //\r
112 // Flag this HOB type to un-used\r
113 //\r
114 GET_HOB_TYPE (Hob) = EFI_HOB_TYPE_UNUSED;\r
115 break;\r
116 }\r
117 }\r
118 Hob.Raw = GET_NEXT_HOB (Hob);\r
119 }\r
120 } else {\r
d11f10d1 121 CpuMpData->SaveRestoreFlag = TRUE;\r
ed66e0e3
JF
122 RestoreWakeupBuffer (CpuMpData);\r
123 }\r
6dc05093
JF
124 return EFI_SUCCESS;\r
125}\r
ed66e0e3
JF
126\r
127/**\r
128 Check if AP wakeup buffer is overlapped with existing allocated buffer.\r
129\r
130 @param[in] WakeupBufferStart AP wakeup buffer start address.\r
131 @param[in] WakeupBufferEnd AP wakeup buffer end address.\r
132\r
133 @retval TRUE There is overlap.\r
134 @retval FALSE There is no overlap.\r
135**/\r
136BOOLEAN\r
137CheckOverlapWithAllocatedBuffer (\r
138 IN UINTN WakeupBufferStart,\r
139 IN UINTN WakeupBufferEnd\r
140 )\r
141{\r
142 EFI_PEI_HOB_POINTERS Hob;\r
143 EFI_HOB_MEMORY_ALLOCATION *MemoryHob;\r
144 BOOLEAN Overlapped;\r
145 UINTN MemoryStart;\r
146 UINTN MemoryEnd;\r
147\r
148 Overlapped = FALSE;\r
149 //\r
150 // Get the HOB list for processing\r
151 //\r
152 Hob.Raw = GetHobList ();\r
153 //\r
154 // Collect memory ranges\r
155 //\r
156 while (!END_OF_HOB_LIST (Hob)) {\r
157 if (Hob.Header->HobType == EFI_HOB_TYPE_MEMORY_ALLOCATION) {\r
158 MemoryHob = Hob.MemoryAllocation;\r
159 MemoryStart = (UINTN) MemoryHob->AllocDescriptor.MemoryBaseAddress;\r
160 MemoryEnd = (UINTN) (MemoryHob->AllocDescriptor.MemoryBaseAddress +\r
161 MemoryHob->AllocDescriptor.MemoryLength);\r
162 if (!((WakeupBufferStart >= MemoryEnd) || (WakeupBufferEnd <= MemoryStart))) {\r
163 Overlapped = TRUE;\r
164 break;\r
165 }\r
166 }\r
167 Hob.Raw = GET_NEXT_HOB (Hob);\r
168 }\r
169 return Overlapped;\r
170}\r
171\r
172/**\r
173 Get available system memory below 1MB by specified size.\r
174\r
175 @param[in] WakeupBufferSize Wakeup buffer size required\r
176\r
177 @retval other Return wakeup buffer address below 1MB.\r
178 @retval -1 Cannot find free memory below 1MB.\r
179**/\r
180UINTN\r
181GetWakeupBuffer (\r
182 IN UINTN WakeupBufferSize\r
183 )\r
184{\r
185 EFI_PEI_HOB_POINTERS Hob;\r
186 UINTN WakeupBufferStart;\r
187 UINTN WakeupBufferEnd;\r
188\r
189 WakeupBufferSize = (WakeupBufferSize + SIZE_4KB - 1) & ~(SIZE_4KB - 1);\r
190\r
191 //\r
192 // Get the HOB list for processing\r
193 //\r
194 Hob.Raw = GetHobList ();\r
195\r
196 //\r
197 // Collect memory ranges\r
198 //\r
199 while (!END_OF_HOB_LIST (Hob)) {\r
200 if (Hob.Header->HobType == EFI_HOB_TYPE_RESOURCE_DESCRIPTOR) {\r
201 if ((Hob.ResourceDescriptor->PhysicalStart < BASE_1MB) &&\r
202 (Hob.ResourceDescriptor->ResourceType == EFI_RESOURCE_SYSTEM_MEMORY) &&\r
203 ((Hob.ResourceDescriptor->ResourceAttribute &\r
204 (EFI_RESOURCE_ATTRIBUTE_READ_PROTECTED |\r
205 EFI_RESOURCE_ATTRIBUTE_WRITE_PROTECTED |\r
206 EFI_RESOURCE_ATTRIBUTE_EXECUTION_PROTECTED\r
207 )) == 0)\r
208 ) {\r
209 //\r
210 // Need memory under 1MB to be collected here\r
211 //\r
212 WakeupBufferEnd = (UINTN) (Hob.ResourceDescriptor->PhysicalStart + Hob.ResourceDescriptor->ResourceLength);\r
213 if (WakeupBufferEnd > BASE_1MB) {\r
214 //\r
215 // Wakeup buffer should be under 1MB\r
216 //\r
217 WakeupBufferEnd = BASE_1MB;\r
218 }\r
219 while (WakeupBufferEnd > WakeupBufferSize) {\r
220 //\r
221 // Wakeup buffer should be aligned on 4KB\r
222 //\r
223 WakeupBufferStart = (WakeupBufferEnd - WakeupBufferSize) & ~(SIZE_4KB - 1);\r
224 if (WakeupBufferStart < Hob.ResourceDescriptor->PhysicalStart) {\r
225 break;\r
226 }\r
227 if (CheckOverlapWithAllocatedBuffer (WakeupBufferStart, WakeupBufferEnd)) {\r
228 //\r
229 // If this range is overlapped with existing allocated buffer, skip it\r
230 // and find the next range\r
231 //\r
232 WakeupBufferEnd -= WakeupBufferSize;\r
233 continue;\r
234 }\r
235 DEBUG ((DEBUG_INFO, "WakeupBufferStart = %x, WakeupBufferSize = %x\n",\r
236 WakeupBufferStart, WakeupBufferSize));\r
237 //\r
238 // Create a memory allocation HOB.\r
239 //\r
240 BuildMemoryAllocationHob (\r
241 WakeupBufferStart,\r
242 WakeupBufferSize,\r
243 EfiBootServicesData\r
244 );\r
245 return WakeupBufferStart;\r
246 }\r
247 }\r
248 }\r
249 //\r
250 // Find the next HOB\r
251 //\r
252 Hob.Raw = GET_NEXT_HOB (Hob);\r
253 }\r
254\r
255 return (UINTN) -1;\r
256}\r
257\r
258/**\r
259 Allocate reset vector buffer.\r
260\r
261 @param[in, out] CpuMpData The pointer to CPU MP Data structure.\r
262**/\r
263VOID\r
264AllocateResetVector (\r
265 IN OUT CPU_MP_DATA *CpuMpData\r
266 )\r
267{\r
268 UINTN ApResetVectorSize;\r
269\r
270 if (CpuMpData->WakeupBuffer == (UINTN) -1) {\r
271 ApResetVectorSize = CpuMpData->AddressMap.RendezvousFunnelSize +\r
272 sizeof (MP_CPU_EXCHANGE_INFO);\r
273\r
274 CpuMpData->WakeupBuffer = GetWakeupBuffer (ApResetVectorSize);\r
275 CpuMpData->MpCpuExchangeInfo = (MP_CPU_EXCHANGE_INFO *) (UINTN)\r
276 (CpuMpData->WakeupBuffer + CpuMpData->AddressMap.RendezvousFunnelSize);\r
277 BackupAndPrepareWakeupBuffer (CpuMpData);\r
278 }\r
279\r
d11f10d1 280 if (CpuMpData->SaveRestoreFlag) {\r
ed66e0e3
JF
281 BackupAndPrepareWakeupBuffer (CpuMpData);\r
282 }\r
283}\r
284\r
285/**\r
286 Free AP reset vector buffer.\r
287\r
288 @param[in] CpuMpData The pointer to CPU MP Data structure.\r
289**/\r
290VOID\r
291FreeResetVector (\r
292 IN CPU_MP_DATA *CpuMpData\r
293 )\r
294{\r
d11f10d1 295 if (CpuMpData->SaveRestoreFlag) {\r
ed66e0e3
JF
296 RestoreWakeupBuffer (CpuMpData);\r
297 }\r
298}\r
299\r
08085f08
JF
300/**\r
301 Checks APs status and updates APs status if needed.\r
302\r
303**/\r
304VOID\r
305CheckAndUpdateApsStatus (\r
306 VOID\r
307 )\r
308{\r
309}\r
310\r
93ca4c0f
JF
311/**\r
312 Initialize global data for MP support.\r
313\r
314 @param[in] CpuMpData The pointer to CPU MP Data structure.\r
315**/\r
316VOID\r
317InitMpGlobalData (\r
318 IN CPU_MP_DATA *CpuMpData\r
319 )\r
320{\r
6dc05093 321 EFI_STATUS Status;\r
93ca4c0f
JF
322\r
323 SaveCpuMpData (CpuMpData);\r
6dc05093
JF
324 //\r
325 // Register an event for EndOfPei\r
326 //\r
327 Status = PeiServicesNotifyPpi (&mMpInitLibNotifyList);\r
328 ASSERT_EFI_ERROR (Status);\r
93ca4c0f
JF
329}\r
330\r
3e8ad6bd
JF
331/**\r
332 This service executes a caller provided function on all enabled APs.\r
333\r
334 @param[in] Procedure A pointer to the function to be run on\r
335 enabled APs of the system. See type\r
336 EFI_AP_PROCEDURE.\r
337 @param[in] SingleThread If TRUE, then all the enabled APs execute\r
338 the function specified by Procedure one by\r
339 one, in ascending order of processor handle\r
340 number. If FALSE, then all the enabled APs\r
341 execute the function specified by Procedure\r
342 simultaneously.\r
343 @param[in] WaitEvent The event created by the caller with CreateEvent()\r
344 service. If it is NULL, then execute in\r
345 blocking mode. BSP waits until all APs finish\r
346 or TimeoutInMicroSeconds expires. If it's\r
347 not NULL, then execute in non-blocking mode.\r
348 BSP requests the function specified by\r
349 Procedure to be started on all the enabled\r
350 APs, and go on executing immediately. If\r
351 all return from Procedure, or TimeoutInMicroSeconds\r
352 expires, this event is signaled. The BSP\r
353 can use the CheckEvent() or WaitForEvent()\r
354 services to check the state of event. Type\r
355 EFI_EVENT is defined in CreateEvent() in\r
356 the Unified Extensible Firmware Interface\r
357 Specification.\r
358 @param[in] TimeoutInMicrosecsond Indicates the time limit in microseconds for\r
359 APs to return from Procedure, either for\r
360 blocking or non-blocking mode. Zero means\r
361 infinity. If the timeout expires before\r
362 all APs return from Procedure, then Procedure\r
363 on the failed APs is terminated. All enabled\r
364 APs are available for next function assigned\r
365 by MpInitLibStartupAllAPs() or\r
366 MPInitLibStartupThisAP().\r
367 If the timeout expires in blocking mode,\r
368 BSP returns EFI_TIMEOUT. If the timeout\r
369 expires in non-blocking mode, WaitEvent\r
370 is signaled with SignalEvent().\r
371 @param[in] ProcedureArgument The parameter passed into Procedure for\r
372 all APs.\r
373 @param[out] FailedCpuList If NULL, this parameter is ignored. Otherwise,\r
374 if all APs finish successfully, then its\r
375 content is set to NULL. If not all APs\r
376 finish before timeout expires, then its\r
377 content is set to address of the buffer\r
378 holding handle numbers of the failed APs.\r
379 The buffer is allocated by MP Initialization\r
380 library, and it's the caller's responsibility to\r
381 free the buffer with FreePool() service.\r
382 In blocking mode, it is ready for consumption\r
383 when the call returns. In non-blocking mode,\r
384 it is ready when WaitEvent is signaled. The\r
385 list of failed CPU is terminated by\r
386 END_OF_CPU_LIST.\r
387\r
388 @retval EFI_SUCCESS In blocking mode, all APs have finished before\r
389 the timeout expired.\r
390 @retval EFI_SUCCESS In non-blocking mode, function has been dispatched\r
391 to all enabled APs.\r
392 @retval EFI_UNSUPPORTED A non-blocking mode request was made after the\r
393 UEFI event EFI_EVENT_GROUP_READY_TO_BOOT was\r
394 signaled.\r
395 @retval EFI_UNSUPPORTED WaitEvent is not NULL if non-blocking mode is not\r
396 supported.\r
397 @retval EFI_DEVICE_ERROR Caller processor is AP.\r
398 @retval EFI_NOT_STARTED No enabled APs exist in the system.\r
399 @retval EFI_NOT_READY Any enabled APs are busy.\r
400 @retval EFI_NOT_READY MP Initialize Library is not initialized.\r
401 @retval EFI_TIMEOUT In blocking mode, the timeout expired before\r
402 all enabled APs have finished.\r
403 @retval EFI_INVALID_PARAMETER Procedure is NULL.\r
404\r
405**/\r
406EFI_STATUS\r
407EFIAPI\r
408MpInitLibStartupAllAPs (\r
409 IN EFI_AP_PROCEDURE Procedure,\r
410 IN BOOLEAN SingleThread,\r
411 IN EFI_EVENT WaitEvent OPTIONAL,\r
412 IN UINTN TimeoutInMicroseconds,\r
413 IN VOID *ProcedureArgument OPTIONAL,\r
414 OUT UINTN **FailedCpuList OPTIONAL\r
415 )\r
416{\r
86efe976
JF
417 if (WaitEvent != NULL) {\r
418 return EFI_UNSUPPORTED;\r
419 }\r
420\r
421 return StartupAllAPsWorker (\r
422 Procedure,\r
423 SingleThread,\r
424 NULL,\r
425 TimeoutInMicroseconds,\r
426 ProcedureArgument,\r
427 FailedCpuList\r
428 );\r
3e8ad6bd
JF
429}\r
430\r
431/**\r
432 This service lets the caller get one enabled AP to execute a caller-provided\r
433 function.\r
434\r
435 @param[in] Procedure A pointer to the function to be run on the\r
436 designated AP of the system. See type\r
437 EFI_AP_PROCEDURE.\r
438 @param[in] ProcessorNumber The handle number of the AP. The range is\r
439 from 0 to the total number of logical\r
440 processors minus 1. The total number of\r
441 logical processors can be retrieved by\r
442 MpInitLibGetNumberOfProcessors().\r
443 @param[in] WaitEvent The event created by the caller with CreateEvent()\r
444 service. If it is NULL, then execute in\r
445 blocking mode. BSP waits until this AP finish\r
446 or TimeoutInMicroSeconds expires. If it's\r
447 not NULL, then execute in non-blocking mode.\r
448 BSP requests the function specified by\r
449 Procedure to be started on this AP,\r
450 and go on executing immediately. If this AP\r
451 return from Procedure or TimeoutInMicroSeconds\r
452 expires, this event is signaled. The BSP\r
453 can use the CheckEvent() or WaitForEvent()\r
454 services to check the state of event. Type\r
455 EFI_EVENT is defined in CreateEvent() in\r
456 the Unified Extensible Firmware Interface\r
457 Specification.\r
458 @param[in] TimeoutInMicrosecsond Indicates the time limit in microseconds for\r
459 this AP to finish this Procedure, either for\r
460 blocking or non-blocking mode. Zero means\r
461 infinity. If the timeout expires before\r
462 this AP returns from Procedure, then Procedure\r
463 on the AP is terminated. The\r
464 AP is available for next function assigned\r
465 by MpInitLibStartupAllAPs() or\r
466 MpInitLibStartupThisAP().\r
467 If the timeout expires in blocking mode,\r
468 BSP returns EFI_TIMEOUT. If the timeout\r
469 expires in non-blocking mode, WaitEvent\r
470 is signaled with SignalEvent().\r
471 @param[in] ProcedureArgument The parameter passed into Procedure on the\r
472 specified AP.\r
473 @param[out] Finished If NULL, this parameter is ignored. In\r
474 blocking mode, this parameter is ignored.\r
475 In non-blocking mode, if AP returns from\r
476 Procedure before the timeout expires, its\r
477 content is set to TRUE. Otherwise, the\r
478 value is set to FALSE. The caller can\r
479 determine if the AP returned from Procedure\r
480 by evaluating this value.\r
481\r
482 @retval EFI_SUCCESS In blocking mode, specified AP finished before\r
483 the timeout expires.\r
484 @retval EFI_SUCCESS In non-blocking mode, the function has been\r
485 dispatched to specified AP.\r
486 @retval EFI_UNSUPPORTED A non-blocking mode request was made after the\r
487 UEFI event EFI_EVENT_GROUP_READY_TO_BOOT was\r
488 signaled.\r
489 @retval EFI_UNSUPPORTED WaitEvent is not NULL if non-blocking mode is not\r
490 supported.\r
491 @retval EFI_DEVICE_ERROR The calling processor is an AP.\r
492 @retval EFI_TIMEOUT In blocking mode, the timeout expired before\r
493 the specified AP has finished.\r
494 @retval EFI_NOT_READY The specified AP is busy.\r
495 @retval EFI_NOT_READY MP Initialize Library is not initialized.\r
496 @retval EFI_NOT_FOUND The processor with the handle specified by\r
497 ProcessorNumber does not exist.\r
498 @retval EFI_INVALID_PARAMETER ProcessorNumber specifies the BSP or disabled AP.\r
499 @retval EFI_INVALID_PARAMETER Procedure is NULL.\r
500\r
501**/\r
502EFI_STATUS\r
503EFIAPI\r
504MpInitLibStartupThisAP (\r
505 IN EFI_AP_PROCEDURE Procedure,\r
506 IN UINTN ProcessorNumber,\r
507 IN EFI_EVENT WaitEvent OPTIONAL,\r
508 IN UINTN TimeoutInMicroseconds,\r
509 IN VOID *ProcedureArgument OPTIONAL,\r
510 OUT BOOLEAN *Finished OPTIONAL\r
511 )\r
512{\r
20ae5774
JF
513 if (WaitEvent != NULL) {\r
514 return EFI_UNSUPPORTED;\r
515 }\r
516\r
517 return StartupThisAPWorker (\r
518 Procedure,\r
519 ProcessorNumber,\r
520 NULL,\r
521 TimeoutInMicroseconds,\r
522 ProcedureArgument,\r
523 Finished\r
524 );\r
3e8ad6bd
JF
525}\r
526\r
527/**\r
528 This service switches the requested AP to be the BSP from that point onward.\r
529 This service changes the BSP for all purposes. This call can only be performed\r
530 by the current BSP.\r
531\r
532 @param[in] ProcessorNumber The handle number of AP that is to become the new\r
533 BSP. The range is from 0 to the total number of\r
534 logical processors minus 1. The total number of\r
535 logical processors can be retrieved by\r
536 MpInitLibGetNumberOfProcessors().\r
537 @param[in] EnableOldBSP If TRUE, then the old BSP will be listed as an\r
538 enabled AP. Otherwise, it will be disabled.\r
539\r
540 @retval EFI_SUCCESS BSP successfully switched.\r
541 @retval EFI_UNSUPPORTED Switching the BSP cannot be completed prior to\r
542 this service returning.\r
543 @retval EFI_UNSUPPORTED Switching the BSP is not supported.\r
544 @retval EFI_DEVICE_ERROR The calling processor is an AP.\r
545 @retval EFI_NOT_FOUND The processor with the handle specified by\r
546 ProcessorNumber does not exist.\r
547 @retval EFI_INVALID_PARAMETER ProcessorNumber specifies the current BSP or\r
548 a disabled AP.\r
549 @retval EFI_NOT_READY The specified AP is busy.\r
550 @retval EFI_NOT_READY MP Initialize Library is not initialized.\r
551\r
552**/\r
553EFI_STATUS\r
554EFIAPI\r
555MpInitLibSwitchBSP (\r
556 IN UINTN ProcessorNumber,\r
557 IN BOOLEAN EnableOldBSP\r
558 )\r
559{\r
41be0da5 560 return SwitchBSPWorker (ProcessorNumber, EnableOldBSP);\r
3e8ad6bd
JF
561}\r
562\r
563/**\r
564 This service lets the caller enable or disable an AP from this point onward.\r
565 This service may only be called from the BSP.\r
566\r
567 @param[in] ProcessorNumber The handle number of AP.\r
568 The range is from 0 to the total number of\r
569 logical processors minus 1. The total number of\r
570 logical processors can be retrieved by\r
571 MpInitLibGetNumberOfProcessors().\r
572 @param[in] EnableAP Specifies the new state for the processor for\r
573 enabled, FALSE for disabled.\r
574 @param[in] HealthFlag If not NULL, a pointer to a value that specifies\r
575 the new health status of the AP. This flag\r
576 corresponds to StatusFlag defined in\r
577 EFI_MP_SERVICES_PROTOCOL.GetProcessorInfo(). Only\r
578 the PROCESSOR_HEALTH_STATUS_BIT is used. All other\r
579 bits are ignored. If it is NULL, this parameter\r
580 is ignored.\r
581\r
582 @retval EFI_SUCCESS The specified AP was enabled or disabled successfully.\r
583 @retval EFI_UNSUPPORTED Enabling or disabling an AP cannot be completed\r
584 prior to this service returning.\r
585 @retval EFI_UNSUPPORTED Enabling or disabling an AP is not supported.\r
586 @retval EFI_DEVICE_ERROR The calling processor is an AP.\r
587 @retval EFI_NOT_FOUND Processor with the handle specified by ProcessorNumber\r
588 does not exist.\r
589 @retval EFI_INVALID_PARAMETER ProcessorNumber specifies the BSP.\r
590 @retval EFI_NOT_READY MP Initialize Library is not initialized.\r
591\r
592**/\r
593EFI_STATUS\r
594EFIAPI\r
595MpInitLibEnableDisableAP (\r
596 IN UINTN ProcessorNumber,\r
597 IN BOOLEAN EnableAP,\r
598 IN UINT32 *HealthFlag OPTIONAL\r
599 )\r
600{\r
e37109bc 601 return EnableDisableApWorker (ProcessorNumber, EnableAP, HealthFlag);\r
3e8ad6bd
JF
602}\r
603\r
604\r