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