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