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