]> git.proxmox.com Git - mirror_edk2.git/blob - UefiCpuPkg/Library/MpInitLib/MpLib.h
16b4d76d019bc7d6a58037bb53a075ffb8c1d1a0
[mirror_edk2.git] / UefiCpuPkg / Library / MpInitLib / MpLib.h
1 /** @file
2 Common header file for MP Initialize Library.
3
4 Copyright (c) 2016 - 2021, Intel Corporation. All rights reserved.<BR>
5 Copyright (c) 2020, AMD Inc. All rights reserved.<BR>
6
7 SPDX-License-Identifier: BSD-2-Clause-Patent
8
9 **/
10
11 #ifndef _MP_LIB_H_
12 #define _MP_LIB_H_
13
14 #include <PiPei.h>
15
16 #include <Register/Intel/Cpuid.h>
17 #include <Register/Amd/Cpuid.h>
18 #include <Register/Intel/Msr.h>
19 #include <Register/Intel/LocalApic.h>
20 #include <Register/Intel/Microcode.h>
21
22 #include <Library/MpInitLib.h>
23 #include <Library/BaseLib.h>
24 #include <Library/BaseMemoryLib.h>
25 #include <Library/MemoryAllocationLib.h>
26 #include <Library/DebugLib.h>
27 #include <Library/LocalApicLib.h>
28 #include <Library/CpuLib.h>
29 #include <Library/UefiCpuLib.h>
30 #include <Library/TimerLib.h>
31 #include <Library/SynchronizationLib.h>
32 #include <Library/MtrrLib.h>
33 #include <Library/HobLib.h>
34 #include <Library/PcdLib.h>
35 #include <Library/MicrocodeLib.h>
36
37 #include <Register/Amd/Fam17Msr.h>
38 #include <Register/Amd/Ghcb.h>
39
40 #include <Guid/MicrocodePatchHob.h>
41
42 #define WAKEUP_AP_SIGNAL SIGNATURE_32 ('S', 'T', 'A', 'P')
43
44 #define CPU_INIT_MP_LIB_HOB_GUID \
45 { \
46 0x58eb6a19, 0x3699, 0x4c68, { 0xa8, 0x36, 0xda, 0xcd, 0x8e, 0xdc, 0xad, 0x4a } \
47 }
48
49 //
50 // The MP data for switch BSP
51 //
52 #define CPU_SWITCH_STATE_IDLE 0
53 #define CPU_SWITCH_STATE_STORED 1
54 #define CPU_SWITCH_STATE_LOADED 2
55
56 //
57 // Default maximum number of entries to store the microcode patches information
58 //
59 #define DEFAULT_MAX_MICROCODE_PATCH_NUM 8
60
61 //
62 // Data structure for microcode patch information
63 //
64 typedef struct {
65 UINTN Address;
66 UINTN Size;
67 } MICROCODE_PATCH_INFO;
68
69 //
70 // CPU exchange information for switch BSP
71 //
72 typedef struct {
73 UINT8 State; // offset 0
74 UINTN StackPointer; // offset 4 / 8
75 IA32_DESCRIPTOR Gdtr; // offset 8 / 16
76 IA32_DESCRIPTOR Idtr; // offset 14 / 26
77 } CPU_EXCHANGE_ROLE_INFO;
78
79 //
80 // AP loop state when APs are in idle state
81 // It's value is the same with PcdCpuApLoopMode
82 //
83 typedef enum {
84 ApInHltLoop = 1,
85 ApInMwaitLoop = 2,
86 ApInRunLoop = 3
87 } AP_LOOP_MODE;
88
89 //
90 // AP initialization state during APs wakeup
91 //
92 typedef enum {
93 ApInitConfig = 1,
94 ApInitReconfig = 2,
95 ApInitDone = 3
96 } AP_INIT_STATE;
97
98 //
99 // AP state
100 //
101 // The state transitions for an AP when it process a procedure are:
102 // Idle ----> Ready ----> Busy ----> Idle
103 // [BSP] [AP] [AP]
104 //
105 typedef enum {
106 CpuStateIdle,
107 CpuStateReady,
108 CpuStateBusy,
109 CpuStateFinished,
110 CpuStateDisabled
111 } CPU_STATE;
112
113 //
114 // CPU volatile registers around INIT-SIPI-SIPI
115 //
116 typedef struct {
117 UINTN Cr0;
118 UINTN Cr3;
119 UINTN Cr4;
120 UINTN Dr0;
121 UINTN Dr1;
122 UINTN Dr2;
123 UINTN Dr3;
124 UINTN Dr6;
125 UINTN Dr7;
126 IA32_DESCRIPTOR Gdtr;
127 IA32_DESCRIPTOR Idtr;
128 UINT16 Tr;
129 } CPU_VOLATILE_REGISTERS;
130
131 //
132 // AP related data
133 //
134 typedef struct {
135 SPIN_LOCK ApLock;
136 volatile UINT32 *StartupApSignal;
137 volatile UINTN ApFunction;
138 volatile UINTN ApFunctionArgument;
139 BOOLEAN CpuHealthy;
140 volatile CPU_STATE State;
141 CPU_VOLATILE_REGISTERS VolatileRegisters;
142 BOOLEAN Waiting;
143 BOOLEAN *Finished;
144 UINT64 ExpectedTime;
145 UINT64 CurrentTime;
146 UINT64 TotalTime;
147 EFI_EVENT WaitEvent;
148 UINT32 ProcessorSignature;
149 UINT8 PlatformId;
150 UINT64 MicrocodeEntryAddr;
151 UINT32 MicrocodeRevision;
152 } CPU_AP_DATA;
153
154 //
155 // Basic CPU information saved in Guided HOB.
156 // Because the contents will be shard between PEI and DXE,
157 // we need to make sure the each fields offset same in different
158 // architecture.
159 //
160 #pragma pack (1)
161 typedef struct {
162 UINT32 InitialApicId;
163 UINT32 ApicId;
164 UINT32 Health;
165 UINT64 ApTopOfStack;
166 } CPU_INFO_IN_HOB;
167 #pragma pack ()
168
169 //
170 // AP reset code information including code address and size,
171 // this structure will be shared be C code and assembly code.
172 // It is natural aligned by design.
173 //
174 typedef struct {
175 UINT8 *RendezvousFunnelAddress;
176 UINTN ModeEntryOffset;
177 UINTN RendezvousFunnelSize;
178 UINT8 *RelocateApLoopFuncAddress;
179 UINTN RelocateApLoopFuncSize;
180 UINTN ModeTransitionOffset;
181 UINTN SwitchToRealSize;
182 UINTN SwitchToRealOffset;
183 UINTN SwitchToRealNoNxOffset;
184 UINTN SwitchToRealPM16ModeOffset;
185 UINTN SwitchToRealPM16ModeSize;
186 } MP_ASSEMBLY_ADDRESS_MAP;
187
188 typedef struct _CPU_MP_DATA CPU_MP_DATA;
189
190 #pragma pack(1)
191
192 //
193 // MP CPU exchange information for AP reset code
194 // This structure is required to be packed because fixed field offsets
195 // into this structure are used in assembly code in this module
196 //
197 typedef struct {
198 UINTN StackStart;
199 UINTN StackSize;
200 UINTN CFunction;
201 IA32_DESCRIPTOR GdtrProfile;
202 IA32_DESCRIPTOR IdtrProfile;
203 UINTN BufferStart;
204 UINTN ModeOffset;
205 UINTN ApIndex;
206 UINTN CodeSegment;
207 UINTN DataSegment;
208 UINTN EnableExecuteDisable;
209 UINTN Cr3;
210 UINTN InitFlag;
211 CPU_INFO_IN_HOB *CpuInfo;
212 UINTN NumApsExecuting;
213 CPU_MP_DATA *CpuMpData;
214 UINTN InitializeFloatingPointUnitsAddress;
215 UINT32 ModeTransitionMemory;
216 UINT16 ModeTransitionSegment;
217 UINT32 ModeHighMemory;
218 UINT16 ModeHighSegment;
219 //
220 // Enable5LevelPaging indicates whether 5-level paging is enabled in long mode.
221 //
222 BOOLEAN Enable5LevelPaging;
223 BOOLEAN SevEsIsEnabled;
224 UINTN GhcbBase;
225 } MP_CPU_EXCHANGE_INFO;
226
227 #pragma pack()
228
229 //
230 // CPU MP Data save in memory
231 //
232 struct _CPU_MP_DATA {
233 UINT64 CpuInfoInHob;
234 UINT32 CpuCount;
235 UINT32 BspNumber;
236 //
237 // The above fields data will be passed from PEI to DXE
238 // Please make sure the fields offset same in the different
239 // architecture.
240 //
241 SPIN_LOCK MpLock;
242 UINTN Buffer;
243 UINTN CpuApStackSize;
244 MP_ASSEMBLY_ADDRESS_MAP AddressMap;
245 UINTN WakeupBuffer;
246 UINTN WakeupBufferHigh;
247 UINTN BackupBuffer;
248 UINTN BackupBufferSize;
249
250 volatile UINT32 FinishedCount;
251 UINT32 RunningCount;
252 BOOLEAN SingleThread;
253 EFI_AP_PROCEDURE Procedure;
254 VOID *ProcArguments;
255 BOOLEAN *Finished;
256 UINT64 ExpectedTime;
257 UINT64 CurrentTime;
258 UINT64 TotalTime;
259 EFI_EVENT WaitEvent;
260 UINTN **FailedCpuList;
261
262 AP_INIT_STATE InitFlag;
263 BOOLEAN SwitchBspFlag;
264 UINTN NewBspNumber;
265 CPU_EXCHANGE_ROLE_INFO BSPInfo;
266 CPU_EXCHANGE_ROLE_INFO APInfo;
267 MTRR_SETTINGS MtrrTable;
268 UINT8 ApLoopMode;
269 UINT8 ApTargetCState;
270 UINT16 PmCodeSegment;
271 UINT16 Pm16CodeSegment;
272 CPU_AP_DATA *CpuData;
273 volatile MP_CPU_EXCHANGE_INFO *MpCpuExchangeInfo;
274
275 UINT32 CurrentTimerCount;
276 UINTN DivideValue;
277 UINT8 Vector;
278 BOOLEAN PeriodicMode;
279 BOOLEAN TimerInterruptState;
280 UINT64 MicrocodePatchAddress;
281 UINT64 MicrocodePatchRegionSize;
282
283 //
284 // Whether need to use Init-Sipi-Sipi to wake up the APs.
285 // Two cases need to set this value to TRUE. One is in HLT
286 // loop mode, the other is resume from S3 which loop mode
287 // will be hardcode change to HLT mode by PiSmmCpuDxeSmm
288 // driver.
289 //
290 BOOLEAN WakeUpByInitSipiSipi;
291
292 BOOLEAN SevEsIsEnabled;
293 UINTN SevEsAPBuffer;
294 UINTN SevEsAPResetStackStart;
295 CPU_MP_DATA *NewCpuMpData;
296
297 UINT64 GhcbBase;
298 };
299
300 #define AP_SAFE_STACK_SIZE 128
301 #define AP_RESET_STACK_SIZE AP_SAFE_STACK_SIZE
302
303 #pragma pack(1)
304
305 typedef struct {
306 UINT8 InsnBuffer[8];
307 UINT16 Rip;
308 UINT16 Segment;
309 } SEV_ES_AP_JMP_FAR;
310
311 #pragma pack()
312
313 /**
314 Assembly code to move an AP from long mode to real mode.
315
316 Move an AP from long mode to real mode in preparation to invoking
317 the reset vector. This is used for SEV-ES guests where a hypervisor
318 is not allowed to set the CS and RIP to point to the reset vector.
319
320 @param[in] BufferStart The reset vector target.
321 @param[in] Code16 16-bit protected mode code segment value.
322 @param[in] Code32 32-bit protected mode code segment value.
323 @param[in] StackStart The start of a stack to be used for transitioning
324 from long mode to real mode.
325 **/
326 typedef
327 VOID
328 (EFIAPI AP_RESET)(
329 IN UINTN BufferStart,
330 IN UINT16 Code16,
331 IN UINT16 Code32,
332 IN UINTN StackStart
333 );
334
335 extern EFI_GUID mCpuInitMpLibHobGuid;
336
337 /**
338 Assembly code to place AP into safe loop mode.
339
340 Place AP into targeted C-State if MONITOR is supported, otherwise
341 place AP into hlt state.
342 Place AP in protected mode if the current is long mode. Due to AP maybe
343 wakeup by some hardware event. It could avoid accessing page table that
344 may not available during booting to OS.
345
346 @param[in] MwaitSupport TRUE indicates MONITOR is supported.
347 FALSE indicates MONITOR is not supported.
348 @param[in] ApTargetCState Target C-State value.
349 @param[in] PmCodeSegment Protected mode code segment value.
350 **/
351 typedef
352 VOID
353 (EFIAPI *ASM_RELOCATE_AP_LOOP)(
354 IN BOOLEAN MwaitSupport,
355 IN UINTN ApTargetCState,
356 IN UINTN PmCodeSegment,
357 IN UINTN TopOfApStack,
358 IN UINTN NumberToFinish,
359 IN UINTN Pm16CodeSegment,
360 IN UINTN SevEsAPJumpTable,
361 IN UINTN WakeupBuffer
362 );
363
364 /**
365 Assembly code to get starting address and size of the rendezvous entry for APs.
366 Information for fixing a jump instruction in the code is also returned.
367
368 @param[out] AddressMap Output buffer for address map information.
369 **/
370 VOID
371 EFIAPI
372 AsmGetAddressMap (
373 OUT MP_ASSEMBLY_ADDRESS_MAP *AddressMap
374 );
375
376 /**
377 This function is called by both the BSP and the AP which is to become the BSP to
378 Exchange execution context including stack between them. After return from this
379 function, the BSP becomes AP and the AP becomes the BSP.
380
381 @param[in] MyInfo Pointer to buffer holding the exchanging information for the executing processor.
382 @param[in] OthersInfo Pointer to buffer holding the exchanging information for the peer.
383
384 **/
385 VOID
386 EFIAPI
387 AsmExchangeRole (
388 IN CPU_EXCHANGE_ROLE_INFO *MyInfo,
389 IN CPU_EXCHANGE_ROLE_INFO *OthersInfo
390 );
391
392 /**
393 Get the pointer to CPU MP Data structure.
394
395 @return The pointer to CPU MP Data structure.
396 **/
397 CPU_MP_DATA *
398 GetCpuMpData (
399 VOID
400 );
401
402 /**
403 Save the pointer to CPU MP Data structure.
404
405 @param[in] CpuMpData The pointer to CPU MP Data structure will be saved.
406 **/
407 VOID
408 SaveCpuMpData (
409 IN CPU_MP_DATA *CpuMpData
410 );
411
412 /**
413 Get available system memory below 1MB by specified size.
414
415 @param[in] WakeupBufferSize Wakeup buffer size required
416
417 @retval other Return wakeup buffer address below 1MB.
418 @retval -1 Cannot find free memory below 1MB.
419 **/
420 UINTN
421 GetWakeupBuffer (
422 IN UINTN WakeupBufferSize
423 );
424
425 /**
426 Get available EfiBootServicesCode memory below 4GB by specified size.
427
428 This buffer is required to safely transfer AP from real address mode to
429 protected mode or long mode, due to the fact that the buffer returned by
430 GetWakeupBuffer() may be marked as non-executable.
431
432 @param[in] BufferSize Wakeup transition buffer size.
433
434 @retval other Return wakeup transition buffer address below 4GB.
435 @retval 0 Cannot find free memory below 4GB.
436 **/
437 UINTN
438 GetModeTransitionBuffer (
439 IN UINTN BufferSize
440 );
441
442 /**
443 Return the address of the SEV-ES AP jump table.
444
445 This buffer is required in order for an SEV-ES guest to transition from
446 UEFI into an OS.
447
448 @return Return SEV-ES AP jump table buffer
449 **/
450 UINTN
451 GetSevEsAPMemory (
452 VOID
453 );
454
455 /**
456 This function will be called by BSP to wakeup AP.
457
458 @param[in] CpuMpData Pointer to CPU MP Data
459 @param[in] Broadcast TRUE: Send broadcast IPI to all APs
460 FALSE: Send IPI to AP by ApicId
461 @param[in] ProcessorNumber The handle number of specified processor
462 @param[in] Procedure The function to be invoked by AP
463 @param[in] ProcedureArgument The argument to be passed into AP function
464 @param[in] WakeUpDisabledAps Whether need to wake up disabled APs in broadcast mode.
465 **/
466 VOID
467 WakeUpAP (
468 IN CPU_MP_DATA *CpuMpData,
469 IN BOOLEAN Broadcast,
470 IN UINTN ProcessorNumber,
471 IN EFI_AP_PROCEDURE Procedure OPTIONAL,
472 IN VOID *ProcedureArgument OPTIONAL,
473 IN BOOLEAN WakeUpDisabledAps OPTIONAL
474 );
475
476 /**
477 Initialize global data for MP support.
478
479 @param[in] CpuMpData The pointer to CPU MP Data structure.
480 **/
481 VOID
482 InitMpGlobalData (
483 IN CPU_MP_DATA *CpuMpData
484 );
485
486 /**
487 Worker function to execute a caller provided function on all enabled APs.
488
489 @param[in] Procedure A pointer to the function to be run on
490 enabled APs of the system.
491 @param[in] SingleThread If TRUE, then all the enabled APs execute
492 the function specified by Procedure one by
493 one, in ascending order of processor handle
494 number. If FALSE, then all the enabled APs
495 execute the function specified by Procedure
496 simultaneously.
497 @param[in] ExcludeBsp Whether let BSP also trig this task.
498 @param[in] WaitEvent The event created by the caller with CreateEvent()
499 service.
500 @param[in] TimeoutInMicroseconds Indicates the time limit in microseconds for
501 APs to return from Procedure, either for
502 blocking or non-blocking mode.
503 @param[in] ProcedureArgument The parameter passed into Procedure for
504 all APs.
505 @param[out] FailedCpuList If all APs finish successfully, then its
506 content is set to NULL. If not all APs
507 finish before timeout expires, then its
508 content is set to address of the buffer
509 holding handle numbers of the failed APs.
510
511 @retval EFI_SUCCESS In blocking mode, all APs have finished before
512 the timeout expired.
513 @retval EFI_SUCCESS In non-blocking mode, function has been dispatched
514 to all enabled APs.
515 @retval others Failed to Startup all APs.
516
517 **/
518 EFI_STATUS
519 StartupAllCPUsWorker (
520 IN EFI_AP_PROCEDURE Procedure,
521 IN BOOLEAN SingleThread,
522 IN BOOLEAN ExcludeBsp,
523 IN EFI_EVENT WaitEvent OPTIONAL,
524 IN UINTN TimeoutInMicroseconds,
525 IN VOID *ProcedureArgument OPTIONAL,
526 OUT UINTN **FailedCpuList OPTIONAL
527 );
528
529 /**
530 Worker function to let the caller get one enabled AP to execute a caller-provided
531 function.
532
533 @param[in] Procedure A pointer to the function to be run on
534 enabled APs of the system.
535 @param[in] ProcessorNumber The handle number of the AP.
536 @param[in] WaitEvent The event created by the caller with CreateEvent()
537 service.
538 @param[in] TimeoutInMicroseconds Indicates the time limit in microseconds for
539 APs to return from Procedure, either for
540 blocking or non-blocking mode.
541 @param[in] ProcedureArgument The parameter passed into Procedure for
542 all APs.
543 @param[out] Finished If AP returns from Procedure before the
544 timeout expires, its content is set to TRUE.
545 Otherwise, the value is set to FALSE.
546
547 @retval EFI_SUCCESS In blocking mode, specified AP finished before
548 the timeout expires.
549 @retval others Failed to Startup AP.
550
551 **/
552 EFI_STATUS
553 StartupThisAPWorker (
554 IN EFI_AP_PROCEDURE Procedure,
555 IN UINTN ProcessorNumber,
556 IN EFI_EVENT WaitEvent OPTIONAL,
557 IN UINTN TimeoutInMicroseconds,
558 IN VOID *ProcedureArgument OPTIONAL,
559 OUT BOOLEAN *Finished OPTIONAL
560 );
561
562 /**
563 Worker function to switch the requested AP to be the BSP from that point onward.
564
565 @param[in] ProcessorNumber The handle number of AP that is to become the new BSP.
566 @param[in] EnableOldBSP If TRUE, then the old BSP will be listed as an
567 enabled AP. Otherwise, it will be disabled.
568
569 @retval EFI_SUCCESS BSP successfully switched.
570 @retval others Failed to switch BSP.
571
572 **/
573 EFI_STATUS
574 SwitchBSPWorker (
575 IN UINTN ProcessorNumber,
576 IN BOOLEAN EnableOldBSP
577 );
578
579 /**
580 Worker function to let the caller enable or disable an AP from this point onward.
581 This service may only be called from the BSP.
582
583 @param[in] ProcessorNumber The handle number of AP.
584 @param[in] EnableAP Specifies the new state for the processor for
585 enabled, FALSE for disabled.
586 @param[in] HealthFlag If not NULL, a pointer to a value that specifies
587 the new health status of the AP.
588
589 @retval EFI_SUCCESS The specified AP was enabled or disabled successfully.
590 @retval others Failed to Enable/Disable AP.
591
592 **/
593 EFI_STATUS
594 EnableDisableApWorker (
595 IN UINTN ProcessorNumber,
596 IN BOOLEAN EnableAP,
597 IN UINT32 *HealthFlag OPTIONAL
598 );
599
600 /**
601 Get pointer to CPU MP Data structure from GUIDed HOB.
602
603 @return The pointer to CPU MP Data structure.
604 **/
605 CPU_MP_DATA *
606 GetCpuMpDataFromGuidedHob (
607 VOID
608 );
609
610 /** Checks status of specified AP.
611
612 This function checks whether the specified AP has finished the task assigned
613 by StartupThisAP(), and whether timeout expires.
614
615 @param[in] ProcessorNumber The handle number of processor.
616
617 @retval EFI_SUCCESS Specified AP has finished task assigned by StartupThisAPs().
618 @retval EFI_TIMEOUT The timeout expires.
619 @retval EFI_NOT_READY Specified AP has not finished task and timeout has not expired.
620 **/
621 EFI_STATUS
622 CheckThisAP (
623 IN UINTN ProcessorNumber
624 );
625
626 /**
627 Checks status of all APs.
628
629 This function checks whether all APs have finished task assigned by StartupAllAPs(),
630 and whether timeout expires.
631
632 @retval EFI_SUCCESS All APs have finished task assigned by StartupAllAPs().
633 @retval EFI_TIMEOUT The timeout expires.
634 @retval EFI_NOT_READY APs have not finished task and timeout has not expired.
635 **/
636 EFI_STATUS
637 CheckAllAPs (
638 VOID
639 );
640
641 /**
642 Checks APs status and updates APs status if needed.
643
644 **/
645 VOID
646 CheckAndUpdateApsStatus (
647 VOID
648 );
649
650 /**
651 Detect whether specified processor can find matching microcode patch and load it.
652
653 @param[in] CpuMpData The pointer to CPU MP Data structure.
654 @param[in] ProcessorNumber The handle number of the processor. The range is
655 from 0 to the total number of logical processors
656 minus 1.
657 **/
658 VOID
659 MicrocodeDetect (
660 IN CPU_MP_DATA *CpuMpData,
661 IN UINTN ProcessorNumber
662 );
663
664 /**
665 Shadow the required microcode patches data into memory.
666
667 @param[in, out] CpuMpData The pointer to CPU MP Data structure.
668 **/
669 VOID
670 ShadowMicrocodeUpdatePatch (
671 IN OUT CPU_MP_DATA *CpuMpData
672 );
673
674 /**
675 Get the cached microcode patch base address and size from the microcode patch
676 information cache HOB.
677
678 @param[out] Address Base address of the microcode patches data.
679 It will be updated if the microcode patch
680 information cache HOB is found.
681 @param[out] RegionSize Size of the microcode patches data.
682 It will be updated if the microcode patch
683 information cache HOB is found.
684
685 @retval TRUE The microcode patch information cache HOB is found.
686 @retval FALSE The microcode patch information cache HOB is not found.
687
688 **/
689 BOOLEAN
690 GetMicrocodePatchInfoFromHob (
691 UINT64 *Address,
692 UINT64 *RegionSize
693 );
694
695 /**
696 Detect whether Mwait-monitor feature is supported.
697
698 @retval TRUE Mwait-monitor feature is supported.
699 @retval FALSE Mwait-monitor feature is not supported.
700 **/
701 BOOLEAN
702 IsMwaitSupport (
703 VOID
704 );
705
706 /**
707 Enable Debug Agent to support source debugging on AP function.
708
709 **/
710 VOID
711 EnableDebugAgent (
712 VOID
713 );
714
715 /**
716 Find the current Processor number by APIC ID.
717
718 @param[in] CpuMpData Pointer to PEI CPU MP Data
719 @param[out] ProcessorNumber Return the pocessor number found
720
721 @retval EFI_SUCCESS ProcessorNumber is found and returned.
722 @retval EFI_NOT_FOUND ProcessorNumber is not found.
723 **/
724 EFI_STATUS
725 GetProcessorNumber (
726 IN CPU_MP_DATA *CpuMpData,
727 OUT UINTN *ProcessorNumber
728 );
729
730 /**
731 This funtion will try to invoke platform specific microcode shadow logic to
732 relocate microcode update patches into memory.
733
734 @param[in, out] CpuMpData The pointer to CPU MP Data structure.
735
736 @retval EFI_SUCCESS Shadow microcode success.
737 @retval EFI_OUT_OF_RESOURCES No enough resource to complete the operation.
738 @retval EFI_UNSUPPORTED Can't find platform specific microcode shadow
739 PPI/Protocol.
740 **/
741 EFI_STATUS
742 PlatformShadowMicrocode (
743 IN OUT CPU_MP_DATA *CpuMpData
744 );
745
746 /**
747 Allocate the SEV-ES AP jump table buffer.
748
749 @param[in, out] CpuMpData The pointer to CPU MP Data structure.
750 **/
751 VOID
752 AllocateSevEsAPMemory (
753 IN OUT CPU_MP_DATA *CpuMpData
754 );
755
756 /**
757 Program the SEV-ES AP jump table buffer.
758
759 @param[in] SipiVector The SIPI vector used for the AP Reset
760 **/
761 VOID
762 SetSevEsJumpTable (
763 IN UINTN SipiVector
764 );
765
766 /**
767 The function puts the AP in halt loop.
768
769 @param[in] CpuMpData The pointer to CPU MP Data structure.
770 **/
771 VOID
772 SevEsPlaceApHlt (
773 CPU_MP_DATA *CpuMpData
774 );
775
776 #endif