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