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