]> git.proxmox.com Git - mirror_edk2.git/blame - UefiCpuPkg/CpuDxe/CpuMp.h
UefiCpuPkg/CpuDxe: Get CPU BIST information from Guided HOB
[mirror_edk2.git] / UefiCpuPkg / CpuDxe / CpuMp.h
CommitLineData
6022e28c
JJ
1/** @file\r
2 CPU DXE MP support\r
3\r
db61e163 4 Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>\r
6022e28c
JJ
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#ifndef _CPU_MP_H_\r
16#define _CPU_MP_H_\r
17\r
db61e163
JF
18#include <Ppi/SecPlatformInformation.h>\r
19#include <Ppi/SecPlatformInformation2.h>\r
003973d9 20#include <Protocol/MpService.h>\r
03673ae1 21#include <Library/SynchronizationLib.h>\r
db61e163
JF
22#include <Library/HobLib.h>\r
23#include <Library/ReportStatusCodeLib.h>\r
003973d9 24\r
6022e28c
JJ
25/**\r
26 Initialize Multi-processor support.\r
27\r
28**/\r
29VOID\r
30InitializeMpSupport (\r
31 VOID\r
32 );\r
33\r
533263ee
JJ
34typedef\r
35VOID\r
36(EFIAPI *STACKLESS_AP_ENTRY_POINT)(\r
37 VOID\r
38 );\r
39\r
40/**\r
41 Starts the Application Processors and directs them to jump to the\r
42 specified routine.\r
43\r
44 The processor jumps to this code in flat mode, but the processor's\r
45 stack is not initialized.\r
46\r
533263ee 47 @retval EFI_SUCCESS The APs were started\r
533263ee
JJ
48\r
49**/\r
50EFI_STATUS\r
51StartApsStackless (\r
fe078dd5 52 VOID\r
533263ee
JJ
53 );\r
54\r
fab82c18
JJ
55/**\r
56 The AP entry point that the Startup-IPI target code will jump to.\r
57\r
58 The processor jumps to this code in flat mode, but the processor's\r
59 stack is not initialized.\r
60\r
61**/\r
62VOID\r
63EFIAPI\r
64AsmApEntryPoint (\r
65 VOID\r
66 );\r
67\r
68/**\r
69 Releases the lock preventing other APs from using the shared AP\r
70 stack.\r
71\r
72 Once the AP has transitioned to using a new stack, it can call this\r
73 function to allow another AP to proceed with using the shared stack.\r
74\r
75**/\r
76VOID\r
77EFIAPI\r
78AsmApDoneWithCommonStack (\r
79 VOID\r
80 );\r
81\r
03673ae1
CF
82typedef enum {\r
83 CpuStateIdle,\r
84 CpuStateBlocked,\r
85 CpuStateReady,\r
b302a978 86 CpuStateBusy,\r
68f06742
CF
87 CpuStateFinished,\r
88 CpuStateSleeping\r
03673ae1
CF
89} CPU_STATE;\r
90\r
91/**\r
92 Define Individual Processor Data block.\r
93\r
94**/\r
95typedef struct {\r
96 EFI_PROCESSOR_INFORMATION Info;\r
97 SPIN_LOCK CpuDataLock;\r
0e724fc1 98 INTN LockSelf;\r
03673ae1
CF
99 volatile CPU_STATE State;\r
100\r
33f413f0
CF
101 volatile EFI_AP_PROCEDURE Procedure;\r
102 volatile VOID* Parameter;\r
3f4f0af8
CF
103 BOOLEAN *Finished;\r
104 INTN Timeout;\r
105 EFI_EVENT WaitEvent;\r
106 BOOLEAN TimeoutActive;\r
107 EFI_EVENT CheckThisAPEvent;\r
ac9dbb3b 108 VOID *TopOfStack;\r
03673ae1
CF
109} CPU_DATA_BLOCK;\r
110\r
111/**\r
112 Define MP data block which consumes individual processor block.\r
113\r
114**/\r
115typedef struct {\r
116 CPU_DATA_BLOCK *CpuDatas;\r
117 UINTN NumberOfProcessors;\r
118 UINTN NumberOfEnabledProcessors;\r
5fee172f
CF
119\r
120 EFI_AP_PROCEDURE Procedure;\r
121 VOID *ProcedureArgument;\r
122 UINTN StartCount;\r
123 UINTN FinishCount;\r
124 BOOLEAN SingleThread;\r
125 UINTN **FailedList;\r
126 UINTN FailedListIndex;\r
127 INTN Timeout;\r
128 EFI_EVENT WaitEvent;\r
129 BOOLEAN TimeoutActive;\r
130 EFI_EVENT CheckAllAPsEvent;\r
03673ae1
CF
131} MP_SYSTEM_DATA;\r
132\r
133/**\r
134 This function is called by all processors (both BSP and AP) once and collects MP related data.\r
135\r
136 @param Bsp TRUE if the CPU is BSP\r
137 @param ProcessorNumber The specific processor number\r
138\r
139 @retval EFI_SUCCESS Data for the processor collected and filled in\r
140\r
141**/\r
142EFI_STATUS\r
143FillInProcessorInformation (\r
144 IN BOOLEAN Bsp,\r
145 IN UINTN ProcessorNumber\r
146 );\r
147\r
d894d8b7
CF
148/**\r
149 This service retrieves the number of logical processor in the platform\r
150 and the number of those logical processors that are enabled on this boot.\r
151 This service may only be called from the BSP.\r
152\r
153 This function is used to retrieve the following information:\r
154 - The number of logical processors that are present in the system.\r
155 - The number of enabled logical processors in the system at the instant\r
156 this call is made.\r
157\r
158 Because MP Service Protocol provides services to enable and disable processors\r
159 dynamically, the number of enabled logical processors may vary during the\r
160 course of a boot session.\r
161\r
162 If this service is called from an AP, then EFI_DEVICE_ERROR is returned.\r
163 If NumberOfProcessors or NumberOfEnabledProcessors is NULL, then\r
164 EFI_INVALID_PARAMETER is returned. Otherwise, the total number of processors\r
165 is returned in NumberOfProcessors, the number of currently enabled processor\r
166 is returned in NumberOfEnabledProcessors, and EFI_SUCCESS is returned.\r
167\r
168 @param[in] This A pointer to the EFI_MP_SERVICES_PROTOCOL\r
169 instance.\r
170 @param[out] NumberOfProcessors Pointer to the total number of logical\r
171 processors in the system, including the BSP\r
172 and disabled APs.\r
173 @param[out] NumberOfEnabledProcessors Pointer to the number of enabled logical\r
174 processors that exist in system, including\r
175 the BSP.\r
176\r
177 @retval EFI_SUCCESS The number of logical processors and enabled\r
178 logical processors was retrieved.\r
179 @retval EFI_DEVICE_ERROR The calling processor is an AP.\r
180 @retval EFI_INVALID_PARAMETER NumberOfProcessors is NULL.\r
181 @retval EFI_INVALID_PARAMETER NumberOfEnabledProcessors is NULL.\r
182\r
183**/\r
184EFI_STATUS\r
185EFIAPI\r
186GetNumberOfProcessors (\r
187 IN EFI_MP_SERVICES_PROTOCOL *This,\r
188 OUT UINTN *NumberOfProcessors,\r
189 OUT UINTN *NumberOfEnabledProcessors\r
190 );\r
191\r
e7938b5a
CF
192/**\r
193 Gets detailed MP-related information on the requested processor at the\r
194 instant this call is made. This service may only be called from the BSP.\r
195\r
196 This service retrieves detailed MP-related information about any processor\r
197 on the platform. Note the following:\r
198 - The processor information may change during the course of a boot session.\r
199 - The information presented here is entirely MP related.\r
200\r
201 Information regarding the number of caches and their sizes, frequency of operation,\r
202 slot numbers is all considered platform-related information and is not provided\r
203 by this service.\r
204\r
205 @param[in] This A pointer to the EFI_MP_SERVICES_PROTOCOL\r
206 instance.\r
207 @param[in] ProcessorNumber The handle number of processor.\r
208 @param[out] ProcessorInfoBuffer A pointer to the buffer where information for\r
209 the requested processor is deposited.\r
210\r
211 @retval EFI_SUCCESS Processor information was returned.\r
212 @retval EFI_DEVICE_ERROR The calling processor is an AP.\r
213 @retval EFI_INVALID_PARAMETER ProcessorInfoBuffer is NULL.\r
214 @retval EFI_NOT_FOUND The processor with the handle specified by\r
215 ProcessorNumber does not exist in the platform.\r
216\r
217**/\r
218EFI_STATUS\r
219EFIAPI\r
220GetProcessorInfo (\r
221 IN EFI_MP_SERVICES_PROTOCOL *This,\r
222 IN UINTN ProcessorNumber,\r
223 OUT EFI_PROCESSOR_INFORMATION *ProcessorInfoBuffer\r
224 );\r
225\r
5fee172f
CF
226/**\r
227 This service executes a caller provided function on all enabled APs. APs can\r
228 run either simultaneously or one at a time in sequence. This service supports\r
229 both blocking and non-blocking requests. The non-blocking requests use EFI\r
230 events so the BSP can detect when the APs have finished. This service may only\r
231 be called from the BSP.\r
232\r
233 This function is used to dispatch all the enabled APs to the function specified\r
234 by Procedure. If any enabled AP is busy, then EFI_NOT_READY is returned\r
235 immediately and Procedure is not started on any AP.\r
236\r
237 If SingleThread is TRUE, all the enabled APs execute the function specified by\r
238 Procedure one by one, in ascending order of processor handle number. Otherwise,\r
239 all the enabled APs execute the function specified by Procedure simultaneously.\r
240\r
241 If WaitEvent is NULL, execution is in blocking mode. The BSP waits until all\r
242 APs finish or TimeoutInMicroseconds expires. Otherwise, execution is in non-blocking\r
243 mode, and the BSP returns from this service without waiting for APs. If a\r
244 non-blocking mode is requested after the UEFI Event EFI_EVENT_GROUP_READY_TO_BOOT\r
245 is signaled, then EFI_UNSUPPORTED must be returned.\r
246\r
247 If the timeout specified by TimeoutInMicroseconds expires before all APs return\r
248 from Procedure, then Procedure on the failed APs is terminated. All enabled APs\r
249 are always available for further calls to EFI_MP_SERVICES_PROTOCOL.StartupAllAPs()\r
250 and EFI_MP_SERVICES_PROTOCOL.StartupThisAP(). If FailedCpuList is not NULL, its\r
251 content points to the list of processor handle numbers in which Procedure was\r
252 terminated.\r
253\r
254 Note: It is the responsibility of the consumer of the EFI_MP_SERVICES_PROTOCOL.StartupAllAPs()\r
255 to make sure that the nature of the code that is executed on the BSP and the\r
256 dispatched APs is well controlled. The MP Services Protocol does not guarantee\r
257 that the Procedure function is MP-safe. Hence, the tasks that can be run in\r
258 parallel are limited to certain independent tasks and well-controlled exclusive\r
259 code. EFI services and protocols may not be called by APs unless otherwise\r
260 specified.\r
261\r
262 In blocking execution mode, BSP waits until all APs finish or\r
263 TimeoutInMicroseconds expires.\r
264\r
265 In non-blocking execution mode, BSP is freed to return to the caller and then\r
266 proceed to the next task without having to wait for APs. The following\r
267 sequence needs to occur in a non-blocking execution mode:\r
268\r
269 -# The caller that intends to use this MP Services Protocol in non-blocking\r
270 mode creates WaitEvent by calling the EFI CreateEvent() service. The caller\r
271 invokes EFI_MP_SERVICES_PROTOCOL.StartupAllAPs(). If the parameter WaitEvent\r
272 is not NULL, then StartupAllAPs() executes in non-blocking mode. It requests\r
273 the function specified by Procedure to be started on all the enabled APs,\r
274 and releases the BSP to continue with other tasks.\r
275 -# The caller can use the CheckEvent() and WaitForEvent() services to check\r
276 the state of the WaitEvent created in step 1.\r
277 -# When the APs complete their task or TimeoutInMicroSecondss expires, the MP\r
278 Service signals WaitEvent by calling the EFI SignalEvent() function. If\r
279 FailedCpuList is not NULL, its content is available when WaitEvent is\r
280 signaled. If all APs returned from Procedure prior to the timeout, then\r
281 FailedCpuList is set to NULL. If not all APs return from Procedure before\r
282 the timeout, then FailedCpuList is filled in with the list of the failed\r
283 APs. The buffer is allocated by MP Service Protocol using AllocatePool().\r
284 It is the caller's responsibility to free the buffer with FreePool() service.\r
285 -# This invocation of SignalEvent() function informs the caller that invoked\r
286 EFI_MP_SERVICES_PROTOCOL.StartupAllAPs() that either all the APs completed\r
287 the specified task or a timeout occurred. The contents of FailedCpuList\r
288 can be examined to determine which APs did not complete the specified task\r
289 prior to the timeout.\r
290\r
291 @param[in] This A pointer to the EFI_MP_SERVICES_PROTOCOL\r
292 instance.\r
293 @param[in] Procedure A pointer to the function to be run on\r
294 enabled APs of the system. See type\r
295 EFI_AP_PROCEDURE.\r
296 @param[in] SingleThread If TRUE, then all the enabled APs execute\r
297 the function specified by Procedure one by\r
298 one, in ascending order of processor handle\r
299 number. If FALSE, then all the enabled APs\r
300 execute the function specified by Procedure\r
301 simultaneously.\r
302 @param[in] WaitEvent The event created by the caller with CreateEvent()\r
303 service. If it is NULL, then execute in\r
304 blocking mode. BSP waits until all APs finish\r
305 or TimeoutInMicroseconds expires. If it's\r
306 not NULL, then execute in non-blocking mode.\r
307 BSP requests the function specified by\r
308 Procedure to be started on all the enabled\r
309 APs, and go on executing immediately. If\r
310 all return from Procedure, or TimeoutInMicroseconds\r
311 expires, this event is signaled. The BSP\r
312 can use the CheckEvent() or WaitForEvent()\r
313 services to check the state of event. Type\r
314 EFI_EVENT is defined in CreateEvent() in\r
315 the Unified Extensible Firmware Interface\r
316 Specification.\r
317 @param[in] TimeoutInMicroseconds Indicates the time limit in microseconds for\r
318 APs to return from Procedure, either for\r
319 blocking or non-blocking mode. Zero means\r
320 infinity. If the timeout expires before\r
321 all APs return from Procedure, then Procedure\r
322 on the failed APs is terminated. All enabled\r
323 APs are available for next function assigned\r
324 by EFI_MP_SERVICES_PROTOCOL.StartupAllAPs()\r
325 or EFI_MP_SERVICES_PROTOCOL.StartupThisAP().\r
326 If the timeout expires in blocking mode,\r
327 BSP returns EFI_TIMEOUT. If the timeout\r
328 expires in non-blocking mode, WaitEvent\r
329 is signaled with SignalEvent().\r
330 @param[in] ProcedureArgument The parameter passed into Procedure for\r
331 all APs.\r
332 @param[out] FailedCpuList If NULL, this parameter is ignored. Otherwise,\r
333 if all APs finish successfully, then its\r
334 content is set to NULL. If not all APs\r
335 finish before timeout expires, then its\r
336 content is set to address of the buffer\r
337 holding handle numbers of the failed APs.\r
338 The buffer is allocated by MP Service Protocol,\r
339 and it's the caller's responsibility to\r
340 free the buffer with FreePool() service.\r
341 In blocking mode, it is ready for consumption\r
342 when the call returns. In non-blocking mode,\r
343 it is ready when WaitEvent is signaled. The\r
344 list of failed CPU is terminated by\r
345 END_OF_CPU_LIST.\r
346\r
347 @retval EFI_SUCCESS In blocking mode, all APs have finished before\r
348 the timeout expired.\r
349 @retval EFI_SUCCESS In non-blocking mode, function has been dispatched\r
350 to all enabled APs.\r
351 @retval EFI_UNSUPPORTED A non-blocking mode request was made after the\r
352 UEFI event EFI_EVENT_GROUP_READY_TO_BOOT was\r
353 signaled.\r
354 @retval EFI_DEVICE_ERROR Caller processor is AP.\r
355 @retval EFI_NOT_STARTED No enabled APs exist in the system.\r
356 @retval EFI_NOT_READY Any enabled APs are busy.\r
357 @retval EFI_TIMEOUT In blocking mode, the timeout expired before\r
358 all enabled APs have finished.\r
359 @retval EFI_INVALID_PARAMETER Procedure is NULL.\r
360\r
361**/\r
362EFI_STATUS\r
363EFIAPI\r
364StartupAllAPs (\r
365 IN EFI_MP_SERVICES_PROTOCOL *This,\r
366 IN EFI_AP_PROCEDURE Procedure,\r
367 IN BOOLEAN SingleThread,\r
368 IN EFI_EVENT WaitEvent OPTIONAL,\r
369 IN UINTN TimeoutInMicroseconds,\r
370 IN VOID *ProcedureArgument OPTIONAL,\r
371 OUT UINTN **FailedCpuList OPTIONAL\r
372 );\r
373\r
3f4f0af8
CF
374/**\r
375 This service lets the caller get one enabled AP to execute a caller-provided\r
376 function. The caller can request the BSP to either wait for the completion\r
377 of the AP or just proceed with the next task by using the EFI event mechanism.\r
378 See EFI_MP_SERVICES_PROTOCOL.StartupAllAPs() for more details on non-blocking\r
379 execution support. This service may only be called from the BSP.\r
380\r
381 This function is used to dispatch one enabled AP to the function specified by\r
382 Procedure passing in the argument specified by ProcedureArgument. If WaitEvent\r
383 is NULL, execution is in blocking mode. The BSP waits until the AP finishes or\r
384 TimeoutInMicroSecondss expires. Otherwise, execution is in non-blocking mode.\r
385 BSP proceeds to the next task without waiting for the AP. If a non-blocking mode\r
386 is requested after the UEFI Event EFI_EVENT_GROUP_READY_TO_BOOT is signaled,\r
387 then EFI_UNSUPPORTED must be returned.\r
388\r
389 If the timeout specified by TimeoutInMicroseconds expires before the AP returns\r
390 from Procedure, then execution of Procedure by the AP is terminated. The AP is\r
391 available for subsequent calls to EFI_MP_SERVICES_PROTOCOL.StartupAllAPs() and\r
392 EFI_MP_SERVICES_PROTOCOL.StartupThisAP().\r
393\r
394 @param[in] This A pointer to the EFI_MP_SERVICES_PROTOCOL\r
395 instance.\r
396 @param[in] Procedure A pointer to the function to be run on\r
397 enabled APs of the system. See type\r
398 EFI_AP_PROCEDURE.\r
399 @param[in] ProcessorNumber The handle number of the AP. The range is\r
400 from 0 to the total number of logical\r
401 processors minus 1. The total number of\r
402 logical processors can be retrieved by\r
403 EFI_MP_SERVICES_PROTOCOL.GetNumberOfProcessors().\r
404 @param[in] WaitEvent The event created by the caller with CreateEvent()\r
405 service. If it is NULL, then execute in\r
406 blocking mode. BSP waits until all APs finish\r
407 or TimeoutInMicroseconds expires. If it's\r
408 not NULL, then execute in non-blocking mode.\r
409 BSP requests the function specified by\r
410 Procedure to be started on all the enabled\r
411 APs, and go on executing immediately. If\r
412 all return from Procedure or TimeoutInMicroseconds\r
413 expires, this event is signaled. The BSP\r
414 can use the CheckEvent() or WaitForEvent()\r
415 services to check the state of event. Type\r
416 EFI_EVENT is defined in CreateEvent() in\r
417 the Unified Extensible Firmware Interface\r
418 Specification.\r
419 @param[in] TimeoutInMicroseconds Indicates the time limit in microseconds for\r
420 APs to return from Procedure, either for\r
421 blocking or non-blocking mode. Zero means\r
422 infinity. If the timeout expires before\r
423 all APs return from Procedure, then Procedure\r
424 on the failed APs is terminated. All enabled\r
425 APs are available for next function assigned\r
426 by EFI_MP_SERVICES_PROTOCOL.StartupAllAPs()\r
427 or EFI_MP_SERVICES_PROTOCOL.StartupThisAP().\r
428 If the timeout expires in blocking mode,\r
429 BSP returns EFI_TIMEOUT. If the timeout\r
430 expires in non-blocking mode, WaitEvent\r
431 is signaled with SignalEvent().\r
432 @param[in] ProcedureArgument The parameter passed into Procedure for\r
433 all APs.\r
434 @param[out] Finished If NULL, this parameter is ignored. In\r
435 blocking mode, this parameter is ignored.\r
436 In non-blocking mode, if AP returns from\r
437 Procedure before the timeout expires, its\r
438 content is set to TRUE. Otherwise, the\r
439 value is set to FALSE. The caller can\r
440 determine if the AP returned from Procedure\r
441 by evaluating this value.\r
442\r
443 @retval EFI_SUCCESS In blocking mode, specified AP finished before\r
444 the timeout expires.\r
445 @retval EFI_SUCCESS In non-blocking mode, the function has been\r
446 dispatched to specified AP.\r
447 @retval EFI_UNSUPPORTED A non-blocking mode request was made after the\r
448 UEFI event EFI_EVENT_GROUP_READY_TO_BOOT was\r
449 signaled.\r
450 @retval EFI_DEVICE_ERROR The calling processor is an AP.\r
451 @retval EFI_TIMEOUT In blocking mode, the timeout expired before\r
452 the specified AP has finished.\r
453 @retval EFI_NOT_READY The specified AP is busy.\r
454 @retval EFI_NOT_FOUND The processor with the handle specified by\r
455 ProcessorNumber does not exist.\r
456 @retval EFI_INVALID_PARAMETER ProcessorNumber specifies the BSP or disabled AP.\r
457 @retval EFI_INVALID_PARAMETER Procedure is NULL.\r
458\r
459**/\r
460EFI_STATUS\r
461EFIAPI\r
462StartupThisAP (\r
463 IN EFI_MP_SERVICES_PROTOCOL *This,\r
464 IN EFI_AP_PROCEDURE Procedure,\r
465 IN UINTN ProcessorNumber,\r
466 IN EFI_EVENT WaitEvent OPTIONAL,\r
467 IN UINTN TimeoutInMicroseconds,\r
468 IN VOID *ProcedureArgument OPTIONAL,\r
469 OUT BOOLEAN *Finished OPTIONAL\r
470 );\r
471\r
b7c05ba5
CF
472/**\r
473 This service switches the requested AP to be the BSP from that point onward.\r
474 This service changes the BSP for all purposes. This call can only be performed\r
475 by the current BSP.\r
476\r
477 This service switches the requested AP to be the BSP from that point onward.\r
478 This service changes the BSP for all purposes. The new BSP can take over the\r
479 execution of the old BSP and continue seamlessly from where the old one left\r
480 off. This service may not be supported after the UEFI Event EFI_EVENT_GROUP_READY_TO_BOOT\r
481 is signaled.\r
482\r
483 If the BSP cannot be switched prior to the return from this service, then\r
484 EFI_UNSUPPORTED must be returned.\r
485\r
486 @param[in] This A pointer to the EFI_MP_SERVICES_PROTOCOL instance.\r
487 @param[in] ProcessorNumber The handle number of AP that is to become the new\r
488 BSP. The range is from 0 to the total number of\r
489 logical processors minus 1. The total number of\r
490 logical processors can be retrieved by\r
491 EFI_MP_SERVICES_PROTOCOL.GetNumberOfProcessors().\r
492 @param[in] EnableOldBSP If TRUE, then the old BSP will be listed as an\r
493 enabled AP. Otherwise, it will be disabled.\r
494\r
495 @retval EFI_SUCCESS BSP successfully switched.\r
496 @retval EFI_UNSUPPORTED Switching the BSP cannot be completed prior to\r
497 this service returning.\r
498 @retval EFI_UNSUPPORTED Switching the BSP is not supported.\r
499 @retval EFI_SUCCESS The calling processor is an AP.\r
500 @retval EFI_NOT_FOUND The processor with the handle specified by\r
501 ProcessorNumber does not exist.\r
502 @retval EFI_INVALID_PARAMETER ProcessorNumber specifies the current BSP or\r
503 a disabled AP.\r
504 @retval EFI_NOT_READY The specified AP is busy.\r
505\r
506**/\r
507EFI_STATUS\r
508EFIAPI\r
509SwitchBSP (\r
510 IN EFI_MP_SERVICES_PROTOCOL *This,\r
511 IN UINTN ProcessorNumber,\r
512 IN BOOLEAN EnableOldBSP\r
513 );\r
514\r
fa7ce675
CF
515/**\r
516 This service lets the caller enable or disable an AP from this point onward.\r
517 This service may only be called from the BSP.\r
518\r
519 This service allows the caller enable or disable an AP from this point onward.\r
520 The caller can optionally specify the health status of the AP by Health. If\r
521 an AP is being disabled, then the state of the disabled AP is implementation\r
522 dependent. If an AP is enabled, then the implementation must guarantee that a\r
523 complete initialization sequence is performed on the AP, so the AP is in a state\r
524 that is compatible with an MP operating system. This service may not be supported\r
525 after the UEFI Event EFI_EVENT_GROUP_READY_TO_BOOT is signaled.\r
526\r
527 If the enable or disable AP operation cannot be completed prior to the return\r
528 from this service, then EFI_UNSUPPORTED must be returned.\r
529\r
530 @param[in] This A pointer to the EFI_MP_SERVICES_PROTOCOL instance.\r
531 @param[in] ProcessorNumber The handle number of AP that is to become the new\r
532 BSP. The range is from 0 to the total number of\r
533 logical processors minus 1. The total number of\r
534 logical processors can be retrieved by\r
535 EFI_MP_SERVICES_PROTOCOL.GetNumberOfProcessors().\r
536 @param[in] EnableAP Specifies the new state for the processor for\r
537 enabled, FALSE for disabled.\r
538 @param[in] HealthFlag If not NULL, a pointer to a value that specifies\r
539 the new health status of the AP. This flag\r
540 corresponds to StatusFlag defined in\r
541 EFI_MP_SERVICES_PROTOCOL.GetProcessorInfo(). Only\r
542 the PROCESSOR_HEALTH_STATUS_BIT is used. All other\r
543 bits are ignored. If it is NULL, this parameter\r
544 is ignored.\r
545\r
546 @retval EFI_SUCCESS The specified AP was enabled or disabled successfully.\r
547 @retval EFI_UNSUPPORTED Enabling or disabling an AP cannot be completed\r
548 prior to this service returning.\r
549 @retval EFI_UNSUPPORTED Enabling or disabling an AP is not supported.\r
550 @retval EFI_DEVICE_ERROR The calling processor is an AP.\r
551 @retval EFI_NOT_FOUND Processor with the handle specified by ProcessorNumber\r
552 does not exist.\r
553 @retval EFI_INVALID_PARAMETER ProcessorNumber specifies the BSP.\r
554\r
555**/\r
556EFI_STATUS\r
557EFIAPI\r
558EnableDisableAP (\r
559 IN EFI_MP_SERVICES_PROTOCOL *This,\r
560 IN UINTN ProcessorNumber,\r
561 IN BOOLEAN EnableAP,\r
562 IN UINT32 *HealthFlag OPTIONAL\r
563 );\r
564\r
cfa2fac1
CF
565/**\r
566 This return the handle number for the calling processor. This service may be\r
567 called from the BSP and APs.\r
568\r
569 This service returns the processor handle number for the calling processor.\r
570 The returned value is in the range from 0 to the total number of logical\r
571 processors minus 1. The total number of logical processors can be retrieved\r
572 with EFI_MP_SERVICES_PROTOCOL.GetNumberOfProcessors(). This service may be\r
573 called from the BSP and APs. If ProcessorNumber is NULL, then EFI_INVALID_PARAMETER\r
574 is returned. Otherwise, the current processors handle number is returned in\r
575 ProcessorNumber, and EFI_SUCCESS is returned.\r
576\r
577 @param[in] This A pointer to the EFI_MP_SERVICES_PROTOCOL instance.\r
578 @param[out] ProcessorNumber The handle number of AP that is to become the new\r
579 BSP. The range is from 0 to the total number of\r
580 logical processors minus 1. The total number of\r
581 logical processors can be retrieved by\r
582 EFI_MP_SERVICES_PROTOCOL.GetNumberOfProcessors().\r
583\r
584 @retval EFI_SUCCESS The current processor handle number was returned\r
585 in ProcessorNumber.\r
586 @retval EFI_INVALID_PARAMETER ProcessorNumber is NULL.\r
587\r
588**/\r
589EFI_STATUS\r
590EFIAPI\r
591WhoAmI (\r
592 IN EFI_MP_SERVICES_PROTOCOL *This,\r
593 OUT UINTN *ProcessorNumber\r
594 );\r
595\r
3f4f0af8
CF
596/**\r
597 Terminate AP's task and set it to idle state.\r
598\r
599 This function terminates AP's task due to timeout by sending INIT-SIPI,\r
600 and sends it to idle state.\r
601\r
602 @param CpuData the pointer to CPU_DATA_BLOCK of specified AP\r
603\r
604**/\r
605VOID\r
606ResetProcessorToIdleState (\r
607 IN CPU_DATA_BLOCK *CpuData\r
608 );\r
609\r
fe078dd5
CF
610/**\r
611 Prepares Startup Code for APs.\r
612 This function prepares Startup Code for APs.\r
613\r
614 @retval EFI_SUCCESS The APs were started\r
615 @retval EFI_OUT_OF_RESOURCES Cannot allocate memory to start APs\r
616\r
617**/\r
618EFI_STATUS\r
619PrepareAPStartupCode (\r
620 VOID\r
621 );\r
622\r
623/**\r
624 Free the code buffer of startup AP.\r
625\r
626**/\r
627VOID\r
628FreeApStartupCode (\r
629 VOID\r
630 );\r
631\r
ac9dbb3b
CF
632/**\r
633 Resets the Application Processor and directs it to jump to the\r
634 specified routine.\r
635\r
636 The processor jumps to this code in flat mode, but the processor's\r
637 stack is not initialized.\r
638\r
639 @param ProcessorId the AP of ProcessorId was reset\r
640**/\r
641VOID\r
642ResetApStackless (\r
643 IN UINT32 ProcessorId\r
644 );\r
645\r
6022e28c
JJ
646#endif // _CPU_MP_H_\r
647\r