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