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