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