]>
Commit | Line | Data |
---|---|---|
3e8ad6bd JF |
1 | /** @file\r |
2 | Common header file for MP Initialize Library.\r | |
3 | \r | |
ee0c39fa | 4 | Copyright (c) 2016 - 2019, Intel Corporation. All rights reserved.<BR>\r |
0acd8697 | 5 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
3e8ad6bd JF |
6 | \r |
7 | **/\r | |
8 | \r | |
9 | #ifndef _MP_LIB_H_\r | |
10 | #define _MP_LIB_H_\r | |
11 | \r | |
12 | #include <PiPei.h>\r | |
13 | \r | |
01acb06c RN |
14 | #include <Register/Intel/Cpuid.h>\r |
15 | #include <Register/Intel/Msr.h>\r | |
16 | #include <Register/Intel/LocalApic.h>\r | |
17 | #include <Register/Intel/Microcode.h>\r | |
3e8ad6bd JF |
18 | \r |
19 | #include <Library/MpInitLib.h>\r | |
20 | #include <Library/BaseLib.h>\r | |
21 | #include <Library/BaseMemoryLib.h>\r | |
22 | #include <Library/MemoryAllocationLib.h>\r | |
23 | #include <Library/DebugLib.h>\r | |
24 | #include <Library/LocalApicLib.h>\r | |
25 | #include <Library/CpuLib.h>\r | |
26 | #include <Library/UefiCpuLib.h>\r | |
27 | #include <Library/TimerLib.h>\r | |
28 | #include <Library/SynchronizationLib.h>\r | |
29 | #include <Library/MtrrLib.h>\r | |
30 | #include <Library/HobLib.h>\r | |
31 | \r | |
b8b04307 JF |
32 | #define WAKEUP_AP_SIGNAL SIGNATURE_32 ('S', 'T', 'A', 'P')\r |
33 | \r | |
93ca4c0f JF |
34 | #define CPU_INIT_MP_LIB_HOB_GUID \\r |
35 | { \\r | |
36 | 0x58eb6a19, 0x3699, 0x4c68, { 0xa8, 0x36, 0xda, 0xcd, 0x8e, 0xdc, 0xad, 0x4a } \\r | |
37 | }\r | |
38 | \r | |
41be0da5 JF |
39 | //\r |
40 | // The MP data for switch BSP\r | |
41 | //\r | |
42 | #define CPU_SWITCH_STATE_IDLE 0\r | |
43 | #define CPU_SWITCH_STATE_STORED 1\r | |
44 | #define CPU_SWITCH_STATE_LOADED 2\r | |
45 | \r | |
46 | //\r | |
47 | // CPU exchange information for switch BSP\r | |
48 | //\r | |
49 | typedef struct {\r | |
50 | UINT8 State; // offset 0\r | |
51 | UINTN StackPointer; // offset 4 / 8\r | |
52 | IA32_DESCRIPTOR Gdtr; // offset 8 / 16\r | |
53 | IA32_DESCRIPTOR Idtr; // offset 14 / 26\r | |
54 | } CPU_EXCHANGE_ROLE_INFO;\r | |
55 | \r | |
9ebcf0f4 JF |
56 | //\r |
57 | // AP loop state when APs are in idle state\r | |
58 | // It's value is the same with PcdCpuApLoopMode\r | |
59 | //\r | |
60 | typedef enum {\r | |
61 | ApInHltLoop = 1,\r | |
62 | ApInMwaitLoop = 2,\r | |
63 | ApInRunLoop = 3\r | |
64 | } AP_LOOP_MODE;\r | |
65 | \r | |
e59f8f6b JF |
66 | //\r |
67 | // AP initialization state during APs wakeup\r | |
68 | //\r | |
69 | typedef enum {\r | |
70 | ApInitConfig = 1,\r | |
71 | ApInitReconfig = 2,\r | |
72 | ApInitDone = 3\r | |
73 | } AP_INIT_STATE;\r | |
74 | \r | |
03a1a925 JF |
75 | //\r |
76 | // AP state\r | |
77 | //\r | |
2a5997f8 ED |
78 | // The state transitions for an AP when it process a procedure are:\r |
79 | // Idle ----> Ready ----> Busy ----> Idle\r | |
80 | // [BSP] [AP] [AP]\r | |
81 | //\r | |
03a1a925 JF |
82 | typedef enum {\r |
83 | CpuStateIdle,\r | |
84 | CpuStateReady,\r | |
85 | CpuStateBusy,\r | |
e048ce88 | 86 | CpuStateFinished,\r |
03a1a925 JF |
87 | CpuStateDisabled\r |
88 | } CPU_STATE;\r | |
89 | \r | |
68cb9330 JF |
90 | //\r |
91 | // CPU volatile registers around INIT-SIPI-SIPI\r | |
92 | //\r | |
93 | typedef struct {\r | |
94 | UINTN Cr0;\r | |
95 | UINTN Cr3;\r | |
96 | UINTN Cr4;\r | |
97 | UINTN Dr0;\r | |
98 | UINTN Dr1;\r | |
99 | UINTN Dr2;\r | |
100 | UINTN Dr3;\r | |
101 | UINTN Dr6;\r | |
102 | UINTN Dr7;\r | |
e9415e48 JW |
103 | IA32_DESCRIPTOR Gdtr;\r |
104 | IA32_DESCRIPTOR Idtr;\r | |
105 | UINT16 Tr;\r | |
68cb9330 JF |
106 | } CPU_VOLATILE_REGISTERS;\r |
107 | \r | |
e59f8f6b JF |
108 | //\r |
109 | // AP related data\r | |
110 | //\r | |
111 | typedef struct {\r | |
112 | SPIN_LOCK ApLock;\r | |
113 | volatile UINT32 *StartupApSignal;\r | |
114 | volatile UINTN ApFunction;\r | |
115 | volatile UINTN ApFunctionArgument;\r | |
e59f8f6b | 116 | BOOLEAN CpuHealthy;\r |
03a1a925 | 117 | volatile CPU_STATE State;\r |
68cb9330 | 118 | CPU_VOLATILE_REGISTERS VolatileRegisters;\r |
e59f8f6b JF |
119 | BOOLEAN Waiting;\r |
120 | BOOLEAN *Finished;\r | |
121 | UINT64 ExpectedTime;\r | |
122 | UINT64 CurrentTime;\r | |
123 | UINT64 TotalTime;\r | |
124 | EFI_EVENT WaitEvent;\r | |
999463c8 HW |
125 | UINT32 ProcessorSignature;\r |
126 | UINT8 PlatformId;\r | |
e59f8f6b JF |
127 | } CPU_AP_DATA;\r |
128 | \r | |
129 | //\r | |
130 | // Basic CPU information saved in Guided HOB.\r | |
131 | // Because the contents will be shard between PEI and DXE,\r | |
132 | // we need to make sure the each fields offset same in different\r | |
133 | // architecture.\r | |
134 | //\r | |
dd3fa0cd | 135 | #pragma pack (1)\r |
e59f8f6b JF |
136 | typedef struct {\r |
137 | UINT32 InitialApicId;\r | |
138 | UINT32 ApicId;\r | |
139 | UINT32 Health;\r | |
dd3fa0cd | 140 | UINT64 ApTopOfStack;\r |
e59f8f6b | 141 | } CPU_INFO_IN_HOB;\r |
dd3fa0cd | 142 | #pragma pack ()\r |
e59f8f6b | 143 | \r |
f7f85d83 JF |
144 | //\r |
145 | // AP reset code information including code address and size,\r | |
146 | // this structure will be shared be C code and assembly code.\r | |
147 | // It is natural aligned by design.\r | |
148 | //\r | |
149 | typedef struct {\r | |
150 | UINT8 *RendezvousFunnelAddress;\r | |
151 | UINTN ModeEntryOffset;\r | |
152 | UINTN RendezvousFunnelSize;\r | |
153 | UINT8 *RelocateApLoopFuncAddress;\r | |
154 | UINTN RelocateApLoopFuncSize;\r | |
f32bfe6d | 155 | UINTN ModeTransitionOffset;\r |
f7f85d83 | 156 | } MP_ASSEMBLY_ADDRESS_MAP;\r |
3e8ad6bd | 157 | \r |
e59f8f6b JF |
158 | typedef struct _CPU_MP_DATA CPU_MP_DATA;\r |
159 | \r | |
d94e5f67 JF |
160 | #pragma pack(1)\r |
161 | \r | |
162 | //\r | |
163 | // MP CPU exchange information for AP reset code\r | |
164 | // This structure is required to be packed because fixed field offsets\r | |
165 | // into this structure are used in assembly code in this module\r | |
166 | //\r | |
167 | typedef struct {\r | |
168 | UINTN Lock;\r | |
169 | UINTN StackStart;\r | |
170 | UINTN StackSize;\r | |
171 | UINTN CFunction;\r | |
172 | IA32_DESCRIPTOR GdtrProfile;\r | |
173 | IA32_DESCRIPTOR IdtrProfile;\r | |
174 | UINTN BufferStart;\r | |
175 | UINTN ModeOffset;\r | |
37676b9f | 176 | UINTN ApIndex;\r |
d94e5f67 JF |
177 | UINTN CodeSegment;\r |
178 | UINTN DataSegment;\r | |
5c66d125 | 179 | UINTN EnableExecuteDisable;\r |
d94e5f67 | 180 | UINTN Cr3;\r |
46d4b885 JF |
181 | UINTN InitFlag;\r |
182 | CPU_INFO_IN_HOB *CpuInfo;\r | |
0594ec41 | 183 | UINTN NumApsExecuting;\r |
e59f8f6b | 184 | CPU_MP_DATA *CpuMpData;\r |
3b2928b4 | 185 | UINTN InitializeFloatingPointUnitsAddress;\r |
f32bfe6d JW |
186 | UINT32 ModeTransitionMemory;\r |
187 | UINT16 ModeTransitionSegment;\r | |
188 | UINT32 ModeHighMemory;\r | |
189 | UINT16 ModeHighSegment;\r | |
09f69a87 RN |
190 | //\r |
191 | // Enable5LevelPaging indicates whether 5-level paging is enabled in long mode.\r | |
192 | //\r | |
193 | BOOLEAN Enable5LevelPaging;\r | |
d94e5f67 JF |
194 | } MP_CPU_EXCHANGE_INFO;\r |
195 | \r | |
196 | #pragma pack()\r | |
e59f8f6b JF |
197 | \r |
198 | //\r | |
199 | // CPU MP Data save in memory\r | |
200 | //\r | |
201 | struct _CPU_MP_DATA {\r | |
202 | UINT64 CpuInfoInHob;\r | |
203 | UINT32 CpuCount;\r | |
204 | UINT32 BspNumber;\r | |
205 | //\r | |
206 | // The above fields data will be passed from PEI to DXE\r | |
207 | // Please make sure the fields offset same in the different\r | |
208 | // architecture.\r | |
209 | //\r | |
210 | SPIN_LOCK MpLock;\r | |
211 | UINTN Buffer;\r | |
212 | UINTN CpuApStackSize;\r | |
213 | MP_ASSEMBLY_ADDRESS_MAP AddressMap;\r | |
214 | UINTN WakeupBuffer;\r | |
66833b2a | 215 | UINTN WakeupBufferHigh;\r |
e59f8f6b JF |
216 | UINTN BackupBuffer;\r |
217 | UINTN BackupBufferSize;\r | |
e59f8f6b | 218 | \r |
e59f8f6b | 219 | volatile UINT32 FinishedCount;\r |
2da3e96c | 220 | UINT32 RunningCount;\r |
e59f8f6b JF |
221 | BOOLEAN SingleThread;\r |
222 | EFI_AP_PROCEDURE Procedure;\r | |
223 | VOID *ProcArguments;\r | |
224 | BOOLEAN *Finished;\r | |
225 | UINT64 ExpectedTime;\r | |
226 | UINT64 CurrentTime;\r | |
227 | UINT64 TotalTime;\r | |
228 | EFI_EVENT WaitEvent;\r | |
229 | UINTN **FailedCpuList;\r | |
230 | \r | |
231 | AP_INIT_STATE InitFlag;\r | |
41be0da5 | 232 | BOOLEAN SwitchBspFlag;\r |
b3775af2 | 233 | UINTN NewBspNumber;\r |
41be0da5 JF |
234 | CPU_EXCHANGE_ROLE_INFO BSPInfo;\r |
235 | CPU_EXCHANGE_ROLE_INFO APInfo;\r | |
e59f8f6b JF |
236 | MTRR_SETTINGS MtrrTable;\r |
237 | UINT8 ApLoopMode;\r | |
238 | UINT8 ApTargetCState;\r | |
239 | UINT16 PmCodeSegment;\r | |
240 | CPU_AP_DATA *CpuData;\r | |
241 | volatile MP_CPU_EXCHANGE_INFO *MpCpuExchangeInfo;\r | |
ffab2442 JF |
242 | \r |
243 | UINT32 CurrentTimerCount;\r | |
244 | UINTN DivideValue;\r | |
245 | UINT8 Vector;\r | |
246 | BOOLEAN PeriodicMode;\r | |
247 | BOOLEAN TimerInterruptState;\r | |
1e3f7a37 ED |
248 | UINT64 MicrocodePatchAddress;\r |
249 | UINT64 MicrocodePatchRegionSize;\r | |
2a089134 ED |
250 | \r |
251 | UINT32 ProcessorSignature;\r | |
252 | UINT32 ProcessorFlags;\r | |
253 | UINT64 MicrocodeDataAddress;\r | |
254 | UINT32 MicrocodeRevision;\r | |
58942277 ED |
255 | \r |
256 | //\r | |
257 | // Whether need to use Init-Sipi-Sipi to wake up the APs.\r | |
258 | // Two cases need to set this value to TRUE. One is in HLT\r | |
259 | // loop mode, the other is resume from S3 which loop mode\r | |
e23d9c3e | 260 | // will be hardcode change to HLT mode by PiSmmCpuDxeSmm\r |
58942277 ED |
261 | // driver.\r |
262 | //\r | |
263 | BOOLEAN WakeUpByInitSipiSipi;\r | |
e59f8f6b | 264 | };\r |
93ca4c0f JF |
265 | \r |
266 | extern EFI_GUID mCpuInitMpLibHobGuid;\r | |
267 | \r | |
76157021 JF |
268 | /**\r |
269 | Assembly code to place AP into safe loop mode.\r | |
270 | \r | |
271 | Place AP into targeted C-State if MONITOR is supported, otherwise\r | |
272 | place AP into hlt state.\r | |
273 | Place AP in protected mode if the current is long mode. Due to AP maybe\r | |
274 | wakeup by some hardware event. It could avoid accessing page table that\r | |
275 | may not available during booting to OS.\r | |
276 | \r | |
277 | @param[in] MwaitSupport TRUE indicates MONITOR is supported.\r | |
278 | FALSE indicates MONITOR is not supported.\r | |
279 | @param[in] ApTargetCState Target C-State value.\r | |
280 | @param[in] PmCodeSegment Protected mode code segment value.\r | |
281 | **/\r | |
282 | typedef\r | |
283 | VOID\r | |
284 | (EFIAPI * ASM_RELOCATE_AP_LOOP) (\r | |
285 | IN BOOLEAN MwaitSupport,\r | |
286 | IN UINTN ApTargetCState,\r | |
bf2786dc | 287 | IN UINTN PmCodeSegment,\r |
9f91cb01 JF |
288 | IN UINTN TopOfApStack,\r |
289 | IN UINTN NumberToFinish\r | |
76157021 | 290 | );\r |
f7f85d83 JF |
291 | \r |
292 | /**\r | |
293 | Assembly code to get starting address and size of the rendezvous entry for APs.\r | |
294 | Information for fixing a jump instruction in the code is also returned.\r | |
295 | \r | |
296 | @param[out] AddressMap Output buffer for address map information.\r | |
297 | **/\r | |
298 | VOID\r | |
299 | EFIAPI\r | |
300 | AsmGetAddressMap (\r | |
301 | OUT MP_ASSEMBLY_ADDRESS_MAP *AddressMap\r | |
302 | );\r | |
303 | \r | |
41be0da5 JF |
304 | /**\r |
305 | This function is called by both the BSP and the AP which is to become the BSP to\r | |
306 | Exchange execution context including stack between them. After return from this\r | |
307 | function, the BSP becomes AP and the AP becomes the BSP.\r | |
308 | \r | |
309 | @param[in] MyInfo Pointer to buffer holding the exchanging information for the executing processor.\r | |
310 | @param[in] OthersInfo Pointer to buffer holding the exchanging information for the peer.\r | |
311 | \r | |
312 | **/\r | |
313 | VOID\r | |
314 | EFIAPI\r | |
315 | AsmExchangeRole (\r | |
316 | IN CPU_EXCHANGE_ROLE_INFO *MyInfo,\r | |
317 | IN CPU_EXCHANGE_ROLE_INFO *OthersInfo\r | |
318 | );\r | |
319 | \r | |
93ca4c0f JF |
320 | /**\r |
321 | Get the pointer to CPU MP Data structure.\r | |
322 | \r | |
323 | @return The pointer to CPU MP Data structure.\r | |
324 | **/\r | |
325 | CPU_MP_DATA *\r | |
326 | GetCpuMpData (\r | |
327 | VOID\r | |
328 | );\r | |
329 | \r | |
330 | /**\r | |
331 | Save the pointer to CPU MP Data structure.\r | |
332 | \r | |
333 | @param[in] CpuMpData The pointer to CPU MP Data structure will be saved.\r | |
334 | **/\r | |
335 | VOID\r | |
336 | SaveCpuMpData (\r | |
337 | IN CPU_MP_DATA *CpuMpData\r | |
338 | );\r | |
339 | \r | |
ed66e0e3 JF |
340 | \r |
341 | /**\r | |
a6b3d753 | 342 | Get available system memory below 1MB by specified size.\r |
ed66e0e3 | 343 | \r |
a6b3d753 SZ |
344 | @param[in] WakeupBufferSize Wakeup buffer size required\r |
345 | \r | |
346 | @retval other Return wakeup buffer address below 1MB.\r | |
347 | @retval -1 Cannot find free memory below 1MB.\r | |
ed66e0e3 | 348 | **/\r |
a6b3d753 SZ |
349 | UINTN\r |
350 | GetWakeupBuffer (\r | |
351 | IN UINTN WakeupBufferSize\r | |
ed66e0e3 JF |
352 | );\r |
353 | \r | |
f32bfe6d JW |
354 | /**\r |
355 | Get available EfiBootServicesCode memory below 4GB by specified size.\r | |
356 | \r | |
357 | This buffer is required to safely transfer AP from real address mode to\r | |
358 | protected mode or long mode, due to the fact that the buffer returned by\r | |
359 | GetWakeupBuffer() may be marked as non-executable.\r | |
360 | \r | |
361 | @param[in] BufferSize Wakeup transition buffer size.\r | |
362 | \r | |
363 | @retval other Return wakeup transition buffer address below 4GB.\r | |
364 | @retval 0 Cannot find free memory below 4GB.\r | |
365 | **/\r | |
366 | UINTN\r | |
367 | GetModeTransitionBuffer (\r | |
368 | IN UINTN BufferSize\r | |
369 | );\r | |
370 | \r | |
96f5920d JF |
371 | /**\r |
372 | This function will be called by BSP to wakeup AP.\r | |
373 | \r | |
374 | @param[in] CpuMpData Pointer to CPU MP Data\r | |
375 | @param[in] Broadcast TRUE: Send broadcast IPI to all APs\r | |
376 | FALSE: Send IPI to AP by ApicId\r | |
377 | @param[in] ProcessorNumber The handle number of specified processor\r | |
378 | @param[in] Procedure The function to be invoked by AP\r | |
379 | @param[in] ProcedureArgument The argument to be passed into AP function\r | |
cf4e79e4 | 380 | @param[in] WakeUpDisabledAps Whether need to wake up disabled APs in broadcast mode.\r |
96f5920d JF |
381 | **/\r |
382 | VOID\r | |
383 | WakeUpAP (\r | |
384 | IN CPU_MP_DATA *CpuMpData,\r | |
385 | IN BOOLEAN Broadcast,\r | |
386 | IN UINTN ProcessorNumber,\r | |
387 | IN EFI_AP_PROCEDURE Procedure, OPTIONAL\r | |
cf4e79e4 ED |
388 | IN VOID *ProcedureArgument, OPTIONAL\r |
389 | IN BOOLEAN WakeUpDisabledAps OPTIONAL\r | |
96f5920d JF |
390 | );\r |
391 | \r | |
93ca4c0f JF |
392 | /**\r |
393 | Initialize global data for MP support.\r | |
394 | \r | |
395 | @param[in] CpuMpData The pointer to CPU MP Data structure.\r | |
396 | **/\r | |
397 | VOID\r | |
398 | InitMpGlobalData (\r | |
399 | IN CPU_MP_DATA *CpuMpData\r | |
400 | );\r | |
401 | \r | |
86efe976 JF |
402 | /**\r |
403 | Worker function to execute a caller provided function on all enabled APs.\r | |
404 | \r | |
405 | @param[in] Procedure A pointer to the function to be run on\r | |
406 | enabled APs of the system.\r | |
407 | @param[in] SingleThread If TRUE, then all the enabled APs execute\r | |
408 | the function specified by Procedure one by\r | |
409 | one, in ascending order of processor handle\r | |
410 | number. If FALSE, then all the enabled APs\r | |
411 | execute the function specified by Procedure\r | |
412 | simultaneously.\r | |
ee0c39fa | 413 | @param[in] ExcludeBsp Whether let BSP also trig this task.\r |
86efe976 JF |
414 | @param[in] WaitEvent The event created by the caller with CreateEvent()\r |
415 | service.\r | |
367284e7 | 416 | @param[in] TimeoutInMicroseconds Indicates the time limit in microseconds for\r |
86efe976 JF |
417 | APs to return from Procedure, either for\r |
418 | blocking or non-blocking mode.\r | |
419 | @param[in] ProcedureArgument The parameter passed into Procedure for\r | |
420 | all APs.\r | |
421 | @param[out] FailedCpuList If all APs finish successfully, then its\r | |
422 | content is set to NULL. If not all APs\r | |
423 | finish before timeout expires, then its\r | |
424 | content is set to address of the buffer\r | |
425 | holding handle numbers of the failed APs.\r | |
426 | \r | |
427 | @retval EFI_SUCCESS In blocking mode, all APs have finished before\r | |
428 | the timeout expired.\r | |
429 | @retval EFI_SUCCESS In non-blocking mode, function has been dispatched\r | |
430 | to all enabled APs.\r | |
431 | @retval others Failed to Startup all APs.\r | |
432 | \r | |
433 | **/\r | |
434 | EFI_STATUS\r | |
ee0c39fa | 435 | StartupAllCPUsWorker (\r |
86efe976 JF |
436 | IN EFI_AP_PROCEDURE Procedure,\r |
437 | IN BOOLEAN SingleThread,\r | |
ee0c39fa | 438 | IN BOOLEAN ExcludeBsp,\r |
86efe976 JF |
439 | IN EFI_EVENT WaitEvent OPTIONAL,\r |
440 | IN UINTN TimeoutInMicroseconds,\r | |
441 | IN VOID *ProcedureArgument OPTIONAL,\r | |
442 | OUT UINTN **FailedCpuList OPTIONAL\r | |
443 | );\r | |
444 | \r | |
20ae5774 JF |
445 | /**\r |
446 | Worker function to let the caller get one enabled AP to execute a caller-provided\r | |
447 | function.\r | |
448 | \r | |
449 | @param[in] Procedure A pointer to the function to be run on\r | |
450 | enabled APs of the system.\r | |
451 | @param[in] ProcessorNumber The handle number of the AP.\r | |
452 | @param[in] WaitEvent The event created by the caller with CreateEvent()\r | |
453 | service.\r | |
367284e7 | 454 | @param[in] TimeoutInMicroseconds Indicates the time limit in microseconds for\r |
20ae5774 JF |
455 | APs to return from Procedure, either for\r |
456 | blocking or non-blocking mode.\r | |
457 | @param[in] ProcedureArgument The parameter passed into Procedure for\r | |
458 | all APs.\r | |
459 | @param[out] Finished If AP returns from Procedure before the\r | |
460 | timeout expires, its content is set to TRUE.\r | |
461 | Otherwise, the value is set to FALSE.\r | |
462 | \r | |
463 | @retval EFI_SUCCESS In blocking mode, specified AP finished before\r | |
464 | the timeout expires.\r | |
465 | @retval others Failed to Startup AP.\r | |
466 | \r | |
467 | **/\r | |
468 | EFI_STATUS\r | |
469 | StartupThisAPWorker (\r | |
470 | IN EFI_AP_PROCEDURE Procedure,\r | |
471 | IN UINTN ProcessorNumber,\r | |
472 | IN EFI_EVENT WaitEvent OPTIONAL,\r | |
473 | IN UINTN TimeoutInMicroseconds,\r | |
474 | IN VOID *ProcedureArgument OPTIONAL,\r | |
475 | OUT BOOLEAN *Finished OPTIONAL\r | |
476 | );\r | |
477 | \r | |
41be0da5 JF |
478 | /**\r |
479 | Worker function to switch the requested AP to be the BSP from that point onward.\r | |
480 | \r | |
481 | @param[in] ProcessorNumber The handle number of AP that is to become the new BSP.\r | |
482 | @param[in] EnableOldBSP If TRUE, then the old BSP will be listed as an\r | |
483 | enabled AP. Otherwise, it will be disabled.\r | |
484 | \r | |
485 | @retval EFI_SUCCESS BSP successfully switched.\r | |
7367cc6c | 486 | @retval others Failed to switch BSP.\r |
41be0da5 JF |
487 | \r |
488 | **/\r | |
489 | EFI_STATUS\r | |
490 | SwitchBSPWorker (\r | |
491 | IN UINTN ProcessorNumber,\r | |
492 | IN BOOLEAN EnableOldBSP\r | |
493 | );\r | |
494 | \r | |
e37109bc JF |
495 | /**\r |
496 | Worker function to let the caller enable or disable an AP from this point onward.\r | |
497 | This service may only be called from the BSP.\r | |
498 | \r | |
499 | @param[in] ProcessorNumber The handle number of AP.\r | |
500 | @param[in] EnableAP Specifies the new state for the processor for\r | |
501 | enabled, FALSE for disabled.\r | |
502 | @param[in] HealthFlag If not NULL, a pointer to a value that specifies\r | |
503 | the new health status of the AP.\r | |
504 | \r | |
505 | @retval EFI_SUCCESS The specified AP was enabled or disabled successfully.\r | |
506 | @retval others Failed to Enable/Disable AP.\r | |
507 | \r | |
508 | **/\r | |
509 | EFI_STATUS\r | |
510 | EnableDisableApWorker (\r | |
511 | IN UINTN ProcessorNumber,\r | |
512 | IN BOOLEAN EnableAP,\r | |
513 | IN UINT32 *HealthFlag OPTIONAL\r | |
514 | );\r | |
515 | \r | |
93ca4c0f JF |
516 | /**\r |
517 | Get pointer to CPU MP Data structure from GUIDed HOB.\r | |
518 | \r | |
519 | @return The pointer to CPU MP Data structure.\r | |
520 | **/\r | |
521 | CPU_MP_DATA *\r | |
522 | GetCpuMpDataFromGuidedHob (\r | |
523 | VOID\r | |
524 | );\r | |
08085f08 JF |
525 | \r |
526 | /** Checks status of specified AP.\r | |
527 | \r | |
528 | This function checks whether the specified AP has finished the task assigned\r | |
529 | by StartupThisAP(), and whether timeout expires.\r | |
530 | \r | |
531 | @param[in] ProcessorNumber The handle number of processor.\r | |
532 | \r | |
533 | @retval EFI_SUCCESS Specified AP has finished task assigned by StartupThisAPs().\r | |
534 | @retval EFI_TIMEOUT The timeout expires.\r | |
535 | @retval EFI_NOT_READY Specified AP has not finished task and timeout has not expired.\r | |
536 | **/\r | |
537 | EFI_STATUS\r | |
538 | CheckThisAP (\r | |
539 | IN UINTN ProcessorNumber\r | |
540 | );\r | |
541 | \r | |
542 | /**\r | |
543 | Checks status of all APs.\r | |
544 | \r | |
545 | This function checks whether all APs have finished task assigned by StartupAllAPs(),\r | |
546 | and whether timeout expires.\r | |
547 | \r | |
548 | @retval EFI_SUCCESS All APs have finished task assigned by StartupAllAPs().\r | |
549 | @retval EFI_TIMEOUT The timeout expires.\r | |
550 | @retval EFI_NOT_READY APs have not finished task and timeout has not expired.\r | |
551 | **/\r | |
552 | EFI_STATUS\r | |
553 | CheckAllAPs (\r | |
554 | VOID\r | |
555 | );\r | |
556 | \r | |
557 | /**\r | |
558 | Checks APs status and updates APs status if needed.\r | |
559 | \r | |
560 | **/\r | |
561 | VOID\r | |
562 | CheckAndUpdateApsStatus (\r | |
563 | VOID\r | |
564 | );\r | |
565 | \r | |
94f63c76 JF |
566 | /**\r |
567 | Detect whether specified processor can find matching microcode patch and load it.\r | |
568 | \r | |
2a089134 ED |
569 | @param[in] CpuMpData The pointer to CPU MP Data structure.\r |
570 | @param[in] IsBspCallIn Indicate whether the caller is BSP or not.\r | |
94f63c76 JF |
571 | **/\r |
572 | VOID\r | |
573 | MicrocodeDetect (\r | |
2a089134 ED |
574 | IN CPU_MP_DATA *CpuMpData,\r |
575 | IN BOOLEAN IsBspCallIn\r | |
94f63c76 JF |
576 | );\r |
577 | \r | |
4d3314f6 JF |
578 | /**\r |
579 | Detect whether Mwait-monitor feature is supported.\r | |
580 | \r | |
581 | @retval TRUE Mwait-monitor feature is supported.\r | |
582 | @retval FALSE Mwait-monitor feature is not supported.\r | |
583 | **/\r | |
584 | BOOLEAN\r | |
585 | IsMwaitSupport (\r | |
586 | VOID\r | |
587 | );\r | |
588 | \r | |
43c9fdcc JF |
589 | /**\r |
590 | Enable Debug Agent to support source debugging on AP function.\r | |
591 | \r | |
592 | **/\r | |
593 | VOID\r | |
594 | EnableDebugAgent (\r | |
595 | VOID\r | |
596 | );\r | |
597 | \r | |
3e8ad6bd JF |
598 | #endif\r |
599 | \r |