]> git.proxmox.com Git - mirror_edk2.git/blame - UefiCpuPkg/Library/MpInitLib/PeiMpLib.c
SignedCapsulePkg/IniParsingLib: Update struct name
[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
14e8137c
JF
324\r
325 if (CpuMpData->CpuCount == 1) {\r
326 //\r
327 // If only BSP exists, return\r
328 //\r
329 return;\r
330 }\r
331\r
6dc05093
JF
332 //\r
333 // Register an event for EndOfPei\r
334 //\r
335 Status = PeiServicesNotifyPpi (&mMpInitLibNotifyList);\r
336 ASSERT_EFI_ERROR (Status);\r
93ca4c0f
JF
337}\r
338\r
3e8ad6bd
JF
339/**\r
340 This service executes a caller provided function on all enabled APs.\r
341\r
342 @param[in] Procedure A pointer to the function to be run on\r
343 enabled APs of the system. See type\r
344 EFI_AP_PROCEDURE.\r
345 @param[in] SingleThread If TRUE, then all the enabled APs execute\r
346 the function specified by Procedure one by\r
347 one, in ascending order of processor handle\r
348 number. If FALSE, then all the enabled APs\r
349 execute the function specified by Procedure\r
350 simultaneously.\r
351 @param[in] WaitEvent The event created by the caller with CreateEvent()\r
352 service. If it is NULL, then execute in\r
353 blocking mode. BSP waits until all APs finish\r
354 or TimeoutInMicroSeconds expires. If it's\r
355 not NULL, then execute in non-blocking mode.\r
356 BSP requests the function specified by\r
357 Procedure to be started on all the enabled\r
358 APs, and go on executing immediately. If\r
359 all return from Procedure, or TimeoutInMicroSeconds\r
360 expires, this event is signaled. The BSP\r
361 can use the CheckEvent() or WaitForEvent()\r
362 services to check the state of event. Type\r
363 EFI_EVENT is defined in CreateEvent() in\r
364 the Unified Extensible Firmware Interface\r
365 Specification.\r
366 @param[in] TimeoutInMicrosecsond Indicates the time limit in microseconds for\r
367 APs to return from Procedure, either for\r
368 blocking or non-blocking mode. Zero means\r
369 infinity. If the timeout expires before\r
370 all APs return from Procedure, then Procedure\r
371 on the failed APs is terminated. All enabled\r
372 APs are available for next function assigned\r
373 by MpInitLibStartupAllAPs() or\r
374 MPInitLibStartupThisAP().\r
375 If the timeout expires in blocking mode,\r
376 BSP returns EFI_TIMEOUT. If the timeout\r
377 expires in non-blocking mode, WaitEvent\r
378 is signaled with SignalEvent().\r
379 @param[in] ProcedureArgument The parameter passed into Procedure for\r
380 all APs.\r
381 @param[out] FailedCpuList If NULL, this parameter is ignored. Otherwise,\r
382 if all APs finish successfully, then its\r
383 content is set to NULL. If not all APs\r
384 finish before timeout expires, then its\r
385 content is set to address of the buffer\r
386 holding handle numbers of the failed APs.\r
387 The buffer is allocated by MP Initialization\r
388 library, and it's the caller's responsibility to\r
389 free the buffer with FreePool() service.\r
390 In blocking mode, it is ready for consumption\r
391 when the call returns. In non-blocking mode,\r
392 it is ready when WaitEvent is signaled. The\r
393 list of failed CPU is terminated by\r
394 END_OF_CPU_LIST.\r
395\r
396 @retval EFI_SUCCESS In blocking mode, all APs have finished before\r
397 the timeout expired.\r
398 @retval EFI_SUCCESS In non-blocking mode, function has been dispatched\r
399 to all enabled APs.\r
400 @retval EFI_UNSUPPORTED A non-blocking mode request was made after the\r
401 UEFI event EFI_EVENT_GROUP_READY_TO_BOOT was\r
402 signaled.\r
403 @retval EFI_UNSUPPORTED WaitEvent is not NULL if non-blocking mode is not\r
404 supported.\r
405 @retval EFI_DEVICE_ERROR Caller processor is AP.\r
406 @retval EFI_NOT_STARTED No enabled APs exist in the system.\r
407 @retval EFI_NOT_READY Any enabled APs are busy.\r
408 @retval EFI_NOT_READY MP Initialize Library is not initialized.\r
409 @retval EFI_TIMEOUT In blocking mode, the timeout expired before\r
410 all enabled APs have finished.\r
411 @retval EFI_INVALID_PARAMETER Procedure is NULL.\r
412\r
413**/\r
414EFI_STATUS\r
415EFIAPI\r
416MpInitLibStartupAllAPs (\r
417 IN EFI_AP_PROCEDURE Procedure,\r
418 IN BOOLEAN SingleThread,\r
419 IN EFI_EVENT WaitEvent OPTIONAL,\r
420 IN UINTN TimeoutInMicroseconds,\r
421 IN VOID *ProcedureArgument OPTIONAL,\r
422 OUT UINTN **FailedCpuList OPTIONAL\r
423 )\r
424{\r
86efe976
JF
425 if (WaitEvent != NULL) {\r
426 return EFI_UNSUPPORTED;\r
427 }\r
428\r
429 return StartupAllAPsWorker (\r
430 Procedure,\r
431 SingleThread,\r
432 NULL,\r
433 TimeoutInMicroseconds,\r
434 ProcedureArgument,\r
435 FailedCpuList\r
436 );\r
3e8ad6bd
JF
437}\r
438\r
439/**\r
440 This service lets the caller get one enabled AP to execute a caller-provided\r
441 function.\r
442\r
443 @param[in] Procedure A pointer to the function to be run on the\r
444 designated AP of the system. See type\r
445 EFI_AP_PROCEDURE.\r
446 @param[in] ProcessorNumber The handle number of the AP. The range is\r
447 from 0 to the total number of logical\r
448 processors minus 1. The total number of\r
449 logical processors can be retrieved by\r
450 MpInitLibGetNumberOfProcessors().\r
451 @param[in] WaitEvent The event created by the caller with CreateEvent()\r
452 service. If it is NULL, then execute in\r
453 blocking mode. BSP waits until this AP finish\r
454 or TimeoutInMicroSeconds expires. If it's\r
455 not NULL, then execute in non-blocking mode.\r
456 BSP requests the function specified by\r
457 Procedure to be started on this AP,\r
458 and go on executing immediately. If this AP\r
459 return from Procedure or TimeoutInMicroSeconds\r
460 expires, this event is signaled. The BSP\r
461 can use the CheckEvent() or WaitForEvent()\r
462 services to check the state of event. Type\r
463 EFI_EVENT is defined in CreateEvent() in\r
464 the Unified Extensible Firmware Interface\r
465 Specification.\r
466 @param[in] TimeoutInMicrosecsond Indicates the time limit in microseconds for\r
467 this AP to finish this Procedure, either for\r
468 blocking or non-blocking mode. Zero means\r
469 infinity. If the timeout expires before\r
470 this AP returns from Procedure, then Procedure\r
471 on the AP is terminated. The\r
472 AP is available for next function assigned\r
473 by MpInitLibStartupAllAPs() or\r
474 MpInitLibStartupThisAP().\r
475 If the timeout expires in blocking mode,\r
476 BSP returns EFI_TIMEOUT. If the timeout\r
477 expires in non-blocking mode, WaitEvent\r
478 is signaled with SignalEvent().\r
479 @param[in] ProcedureArgument The parameter passed into Procedure on the\r
480 specified AP.\r
481 @param[out] Finished If NULL, this parameter is ignored. In\r
482 blocking mode, this parameter is ignored.\r
483 In non-blocking mode, if AP returns from\r
484 Procedure before the timeout expires, its\r
485 content is set to TRUE. Otherwise, the\r
486 value is set to FALSE. The caller can\r
487 determine if the AP returned from Procedure\r
488 by evaluating this value.\r
489\r
490 @retval EFI_SUCCESS In blocking mode, specified AP finished before\r
491 the timeout expires.\r
492 @retval EFI_SUCCESS In non-blocking mode, the function has been\r
493 dispatched to specified AP.\r
494 @retval EFI_UNSUPPORTED A non-blocking mode request was made after the\r
495 UEFI event EFI_EVENT_GROUP_READY_TO_BOOT was\r
496 signaled.\r
497 @retval EFI_UNSUPPORTED WaitEvent is not NULL if non-blocking mode is not\r
498 supported.\r
499 @retval EFI_DEVICE_ERROR The calling processor is an AP.\r
500 @retval EFI_TIMEOUT In blocking mode, the timeout expired before\r
501 the specified AP has finished.\r
502 @retval EFI_NOT_READY The specified AP is busy.\r
503 @retval EFI_NOT_READY MP Initialize Library is not initialized.\r
504 @retval EFI_NOT_FOUND The processor with the handle specified by\r
505 ProcessorNumber does not exist.\r
506 @retval EFI_INVALID_PARAMETER ProcessorNumber specifies the BSP or disabled AP.\r
507 @retval EFI_INVALID_PARAMETER Procedure is NULL.\r
508\r
509**/\r
510EFI_STATUS\r
511EFIAPI\r
512MpInitLibStartupThisAP (\r
513 IN EFI_AP_PROCEDURE Procedure,\r
514 IN UINTN ProcessorNumber,\r
515 IN EFI_EVENT WaitEvent OPTIONAL,\r
516 IN UINTN TimeoutInMicroseconds,\r
517 IN VOID *ProcedureArgument OPTIONAL,\r
518 OUT BOOLEAN *Finished OPTIONAL\r
519 )\r
520{\r
20ae5774
JF
521 if (WaitEvent != NULL) {\r
522 return EFI_UNSUPPORTED;\r
523 }\r
524\r
525 return StartupThisAPWorker (\r
526 Procedure,\r
527 ProcessorNumber,\r
528 NULL,\r
529 TimeoutInMicroseconds,\r
530 ProcedureArgument,\r
531 Finished\r
532 );\r
3e8ad6bd
JF
533}\r
534\r
535/**\r
536 This service switches the requested AP to be the BSP from that point onward.\r
537 This service changes the BSP for all purposes. This call can only be performed\r
538 by the current BSP.\r
539\r
540 @param[in] ProcessorNumber The handle number of AP that is to become the new\r
541 BSP. The range is from 0 to the total number of\r
542 logical processors minus 1. The total number of\r
543 logical processors can be retrieved by\r
544 MpInitLibGetNumberOfProcessors().\r
545 @param[in] EnableOldBSP If TRUE, then the old BSP will be listed as an\r
546 enabled AP. Otherwise, it will be disabled.\r
547\r
548 @retval EFI_SUCCESS BSP successfully switched.\r
549 @retval EFI_UNSUPPORTED Switching the BSP cannot be completed prior to\r
550 this service returning.\r
551 @retval EFI_UNSUPPORTED Switching the BSP is not supported.\r
552 @retval EFI_DEVICE_ERROR The calling processor is an AP.\r
553 @retval EFI_NOT_FOUND The processor with the handle specified by\r
554 ProcessorNumber does not exist.\r
555 @retval EFI_INVALID_PARAMETER ProcessorNumber specifies the current BSP or\r
556 a disabled AP.\r
557 @retval EFI_NOT_READY The specified AP is busy.\r
558 @retval EFI_NOT_READY MP Initialize Library is not initialized.\r
559\r
560**/\r
561EFI_STATUS\r
562EFIAPI\r
563MpInitLibSwitchBSP (\r
564 IN UINTN ProcessorNumber,\r
565 IN BOOLEAN EnableOldBSP\r
566 )\r
567{\r
41be0da5 568 return SwitchBSPWorker (ProcessorNumber, EnableOldBSP);\r
3e8ad6bd
JF
569}\r
570\r
571/**\r
572 This service lets the caller enable or disable an AP from this point onward.\r
573 This service may only be called from the BSP.\r
574\r
575 @param[in] ProcessorNumber The handle number of AP.\r
576 The range is from 0 to the total number of\r
577 logical processors minus 1. The total number of\r
578 logical processors can be retrieved by\r
579 MpInitLibGetNumberOfProcessors().\r
580 @param[in] EnableAP Specifies the new state for the processor for\r
581 enabled, FALSE for disabled.\r
582 @param[in] HealthFlag If not NULL, a pointer to a value that specifies\r
583 the new health status of the AP. This flag\r
584 corresponds to StatusFlag defined in\r
585 EFI_MP_SERVICES_PROTOCOL.GetProcessorInfo(). Only\r
586 the PROCESSOR_HEALTH_STATUS_BIT is used. All other\r
587 bits are ignored. If it is NULL, this parameter\r
588 is ignored.\r
589\r
590 @retval EFI_SUCCESS The specified AP was enabled or disabled successfully.\r
591 @retval EFI_UNSUPPORTED Enabling or disabling an AP cannot be completed\r
592 prior to this service returning.\r
593 @retval EFI_UNSUPPORTED Enabling or disabling an AP is not supported.\r
594 @retval EFI_DEVICE_ERROR The calling processor is an AP.\r
595 @retval EFI_NOT_FOUND Processor with the handle specified by ProcessorNumber\r
596 does not exist.\r
597 @retval EFI_INVALID_PARAMETER ProcessorNumber specifies the BSP.\r
598 @retval EFI_NOT_READY MP Initialize Library is not initialized.\r
599\r
600**/\r
601EFI_STATUS\r
602EFIAPI\r
603MpInitLibEnableDisableAP (\r
604 IN UINTN ProcessorNumber,\r
605 IN BOOLEAN EnableAP,\r
606 IN UINT32 *HealthFlag OPTIONAL\r
607 )\r
608{\r
e37109bc 609 return EnableDisableApWorker (ProcessorNumber, EnableAP, HealthFlag);\r
3e8ad6bd
JF
610}\r
611\r
612\r