TianoCore EDK2 master
DxeMpLib.c
Go to the documentation of this file.
1
9#include "MpLib.h"
10
11#include <Library/UefiLib.h>
15#include <Library/VmgExitLib.h>
17#include <Register/Amd/Ghcb.h>
18
19#include <Protocol/Timer.h>
20
21#define AP_SAFE_STACK_SIZE 128
22
23CPU_MP_DATA *mCpuMpData = NULL;
24EFI_EVENT mCheckAllApsEvent = NULL;
25EFI_EVENT mMpInitExitBootServicesEvent = NULL;
26EFI_EVENT mLegacyBootEvent = NULL;
27volatile BOOLEAN mStopCheckAllApsStatus = TRUE;
28VOID *mReservedApLoopFunc = NULL;
29UINTN mReservedTopOfApStack;
30volatile UINT32 mNumberToFinish = 0;
31
32//
33// Begin wakeup buffer allocation below 0x88000
34//
35STATIC EFI_PHYSICAL_ADDRESS mSevEsDxeWakeupBuffer = 0x88000;
36
41VOID
43 VOID
44 )
45{
46 //
47 // Initialize Debug Agent to support source level debug in DXE phase
48 //
49 InitializeDebugAgent (DEBUG_AGENT_INIT_DXE_AP, NULL, NULL);
50}
51
59 VOID
60 )
61{
62 ASSERT (mCpuMpData != NULL);
63 return mCpuMpData;
64}
65
71VOID
73 IN CPU_MP_DATA *CpuMpData
74 )
75{
76 mCpuMpData = CpuMpData;
77}
78
89 IN UINTN WakeupBufferSize
90 )
91{
92 EFI_STATUS Status;
93 EFI_PHYSICAL_ADDRESS StartAddress;
94 EFI_MEMORY_TYPE MemoryType;
95
96 if (ConfidentialComputingGuestHas (CCAttrAmdSevEs) &&
97 !ConfidentialComputingGuestHas (CCAttrAmdSevSnp))
98 {
99 //
100 // An SEV-ES-only guest requires the memory to be reserved. SEV-SNP, which
101 // is also considered SEV-ES, uses a different AP startup method, though,
102 // which does not have the same requirement.
103 //
104 MemoryType = EfiReservedMemoryType;
105 } else {
106 MemoryType = EfiBootServicesData;
107 }
108
109 //
110 // Try to allocate buffer below 1M for waking vector.
111 // LegacyBios driver only reports warning when page allocation in range
112 // [0x60000, 0x88000) fails.
113 // This library is consumed by CpuDxe driver to produce CPU Arch protocol.
114 // LagacyBios driver depends on CPU Arch protocol which guarantees below
115 // allocation runs earlier than LegacyBios driver.
116 //
117 if (ConfidentialComputingGuestHas (CCAttrAmdSevEs)) {
118 //
119 // SEV-ES Wakeup buffer should be under 0x88000 and under any previous one
120 //
121 StartAddress = mSevEsDxeWakeupBuffer;
122 } else {
123 StartAddress = 0x88000;
124 }
125
126 Status = gBS->AllocatePages (
128 MemoryType,
129 EFI_SIZE_TO_PAGES (WakeupBufferSize),
130 &StartAddress
131 );
132 ASSERT_EFI_ERROR (Status);
133 if (EFI_ERROR (Status)) {
134 StartAddress = (EFI_PHYSICAL_ADDRESS)-1;
135 } else if (ConfidentialComputingGuestHas (CCAttrAmdSevEs)) {
136 //
137 // Next SEV-ES wakeup buffer allocation must be below this allocation
138 //
139 mSevEsDxeWakeupBuffer = StartAddress;
140 }
141
142 DEBUG ((
143 DEBUG_INFO,
144 "WakeupBufferStart = %x, WakeupBufferSize = %x\n",
145 (UINTN)StartAddress,
146 WakeupBufferSize
147 ));
148
149 return (UINTN)StartAddress;
150}
151
164UINTN
166 IN UINTN BufferSize
167 )
168{
169 EFI_STATUS Status;
170 EFI_PHYSICAL_ADDRESS StartAddress;
171
172 StartAddress = BASE_4GB - 1;
173 Status = gBS->AllocatePages (
176 EFI_SIZE_TO_PAGES (BufferSize),
177 &StartAddress
178 );
179 if (EFI_ERROR (Status)) {
180 StartAddress = 0;
181 }
182
183 return (UINTN)StartAddress;
184}
185
194UINTN
196 VOID
197 )
198{
199 EFI_STATUS Status;
200 EFI_PHYSICAL_ADDRESS StartAddress;
202 GHCB *Ghcb;
203 BOOLEAN InterruptState;
204
205 //
206 // Allocate 1 page for AP jump table page
207 //
208 StartAddress = BASE_4GB - 1;
209 Status = gBS->AllocatePages (
212 1,
213 &StartAddress
214 );
215 ASSERT_EFI_ERROR (Status);
216
217 DEBUG ((DEBUG_INFO, "Dxe: SevEsAPMemory = %lx\n", (UINTN)StartAddress));
218
219 //
220 // Save the SevEsAPMemory as the AP jump table.
221 //
222 Msr.GhcbPhysicalAddress = AsmReadMsr64 (MSR_SEV_ES_GHCB);
223 Ghcb = Msr.Ghcb;
224
225 VmgInit (Ghcb, &InterruptState);
226 VmgExit (Ghcb, SVM_EXIT_AP_JUMP_TABLE, 0, (UINT64)(UINTN)StartAddress);
227 VmgDone (Ghcb, InterruptState);
228
229 return (UINTN)StartAddress;
230}
231
236VOID
238 VOID
239 )
240{
241 UINTN ProcessorNumber;
242 EFI_STATUS Status;
243 CPU_MP_DATA *CpuMpData;
244
245 CpuMpData = GetCpuMpData ();
246
247 //
248 // First, check whether pending StartupAllAPs() exists.
249 //
250 if (CpuMpData->WaitEvent != NULL) {
251 Status = CheckAllAPs ();
252 //
253 // If all APs finish for StartupAllAPs(), signal the WaitEvent for it.
254 //
255 if (Status != EFI_NOT_READY) {
256 Status = gBS->SignalEvent (CpuMpData->WaitEvent);
257 CpuMpData->WaitEvent = NULL;
258 }
259 }
260
261 //
262 // Second, check whether pending StartupThisAPs() callings exist.
263 //
264 for (ProcessorNumber = 0; ProcessorNumber < CpuMpData->CpuCount; ProcessorNumber++) {
265 if (CpuMpData->CpuData[ProcessorNumber].WaitEvent == NULL) {
266 continue;
267 }
268
269 Status = CheckThisAP (ProcessorNumber);
270
271 if (Status != EFI_NOT_READY) {
272 gBS->SignalEvent (CpuMpData->CpuData[ProcessorNumber].WaitEvent);
273 CpuMpData->CpuData[ProcessorNumber].WaitEvent = NULL;
274 }
275 }
276}
277
289VOID
290EFIAPI
292 IN EFI_EVENT Event,
293 IN VOID *Context
294 )
295{
296 //
297 // If CheckApsStatus() is not stopped, otherwise return immediately.
298 //
299 if (!mStopCheckAllApsStatus) {
301 }
302}
303
310UINT16
312 VOID
313 )
314{
315 IA32_DESCRIPTOR GdtrDesc;
316 IA32_SEGMENT_DESCRIPTOR *GdtEntry;
317 UINTN GdtEntryCount;
318 UINT16 Index;
319
320 Index = (UINT16)-1;
321 AsmReadGdtr (&GdtrDesc);
322 GdtEntryCount = (GdtrDesc.Limit + 1) / sizeof (IA32_SEGMENT_DESCRIPTOR);
323 GdtEntry = (IA32_SEGMENT_DESCRIPTOR *)GdtrDesc.Base;
324 for (Index = 0; Index < GdtEntryCount; Index++) {
325 if (GdtEntry->Bits.L == 0) {
326 if ((GdtEntry->Bits.Type > 8) && (GdtEntry->Bits.DB == 0)) {
327 break;
328 }
329 }
330
331 GdtEntry++;
332 }
333
334 ASSERT (Index != GdtEntryCount);
335 return Index * 8;
336}
337
343UINT16
345 VOID
346 )
347{
348 IA32_DESCRIPTOR GdtrDesc;
349 IA32_SEGMENT_DESCRIPTOR *GdtEntry;
350 UINTN GdtEntryCount;
351 UINT16 Index;
352
353 AsmReadGdtr (&GdtrDesc);
354 GdtEntryCount = (GdtrDesc.Limit + 1) / sizeof (IA32_SEGMENT_DESCRIPTOR);
355 GdtEntry = (IA32_SEGMENT_DESCRIPTOR *)GdtrDesc.Base;
356 for (Index = 0; Index < GdtEntryCount; Index++) {
357 if (GdtEntry->Bits.L == 0) {
358 if ((GdtEntry->Bits.Type > 8) && (GdtEntry->Bits.DB == 1)) {
359 break;
360 }
361 }
362
363 GdtEntry++;
364 }
365
366 ASSERT (Index != GdtEntryCount);
367 return Index * 8;
368}
369
375VOID
376EFIAPI
378 IN OUT VOID *Buffer
379 )
380{
381 CPU_MP_DATA *CpuMpData;
382 BOOLEAN MwaitSupport;
383 ASM_RELOCATE_AP_LOOP AsmRelocateApLoopFunc;
384 UINTN ProcessorNumber;
385 UINTN StackStart;
386
387 MpInitLibWhoAmI (&ProcessorNumber);
388 CpuMpData = GetCpuMpData ();
389 MwaitSupport = IsMwaitSupport ();
390 if (CpuMpData->UseSevEsAPMethod) {
391 StackStart = CpuMpData->SevEsAPResetStackStart;
392 } else {
393 StackStart = mReservedTopOfApStack;
394 }
395
396 AsmRelocateApLoopFunc = (ASM_RELOCATE_AP_LOOP)(UINTN)mReservedApLoopFunc;
397 AsmRelocateApLoopFunc (
398 MwaitSupport,
399 CpuMpData->ApTargetCState,
400 CpuMpData->PmCodeSegment,
401 StackStart - ProcessorNumber * AP_SAFE_STACK_SIZE,
402 (UINTN)&mNumberToFinish,
403 CpuMpData->Pm16CodeSegment,
404 CpuMpData->SevEsAPBuffer,
405 CpuMpData->WakeupBuffer
406 );
407 //
408 // It should never reach here
409 //
410 ASSERT (FALSE);
411}
412
421VOID
422EFIAPI
424 IN EFI_EVENT Event,
425 IN VOID *Context
426 )
427{
428 CPU_MP_DATA *CpuMpData;
429
430 CpuMpData = GetCpuMpData ();
431 CpuMpData->PmCodeSegment = GetProtectedModeCS ();
432 CpuMpData->Pm16CodeSegment = GetProtectedMode16CS ();
433 CpuMpData->ApLoopMode = PcdGet8 (PcdCpuApLoopMode);
434 mNumberToFinish = CpuMpData->CpuCount - 1;
435 WakeUpAP (CpuMpData, TRUE, 0, RelocateApLoop, NULL, TRUE);
436 while (mNumberToFinish > 0) {
437 CpuPause ();
438 }
439
440 if (CpuMpData->UseSevEsAPMethod && (CpuMpData->WakeupBuffer != (UINTN)-1)) {
441 //
442 // There are APs present. Re-use reserved memory area below 1MB from
443 // WakeupBuffer as the area to be used for transitioning to 16-bit mode
444 // in support of booting of the AP by an OS.
445 //
446 CopyMem (
447 (VOID *)CpuMpData->WakeupBuffer,
448 (VOID *)(CpuMpData->AddressMap.RendezvousFunnelAddress +
449 CpuMpData->AddressMap.SwitchToRealPM16ModeOffset),
450 CpuMpData->AddressMap.SwitchToRealPM16ModeSize
451 );
452 }
453
454 DEBUG ((DEBUG_INFO, "%a() done!\n", __FUNCTION__));
455}
456
462VOID
464 IN CPU_MP_DATA *CpuMpData
465 )
466{
467 EFI_STATUS Status;
468 EFI_PHYSICAL_ADDRESS Address;
469 UINTN ApSafeBufferSize;
470 UINTN Index;
472 UINTN StackBase;
473 CPU_INFO_IN_HOB *CpuInfoInHob;
474
475 SaveCpuMpData (CpuMpData);
476
477 if (CpuMpData->CpuCount == 1) {
478 //
479 // If only BSP exists, return
480 //
481 return;
482 }
483
484 if (PcdGetBool (PcdCpuStackGuard)) {
485 //
486 // One extra page at the bottom of the stack is needed for Guard page.
487 //
488 if (CpuMpData->CpuApStackSize <= EFI_PAGE_SIZE) {
489 DEBUG ((DEBUG_ERROR, "PcdCpuApStackSize is not big enough for Stack Guard!\n"));
490 ASSERT (FALSE);
491 }
492
493 //
494 // DXE will reuse stack allocated for APs at PEI phase if it's available.
495 // Let's check it here.
496 //
497 // Note: BSP's stack guard is set at DxeIpl phase. But for the sake of
498 // BSP/AP exchange, stack guard for ApTopOfStack of cpu 0 will still be
499 // set here.
500 //
501 CpuInfoInHob = (CPU_INFO_IN_HOB *)(UINTN)CpuMpData->CpuInfoInHob;
502 for (Index = 0; Index < CpuMpData->CpuCount; ++Index) {
503 if ((CpuInfoInHob != NULL) && (CpuInfoInHob[Index].ApTopOfStack != 0)) {
504 StackBase = (UINTN)CpuInfoInHob[Index].ApTopOfStack - CpuMpData->CpuApStackSize;
505 } else {
506 StackBase = CpuMpData->Buffer + Index * CpuMpData->CpuApStackSize;
507 }
508
509 Status = gDS->GetMemorySpaceDescriptor (StackBase, &MemDesc);
510 ASSERT_EFI_ERROR (Status);
511
512 Status = gDS->SetMemorySpaceAttributes (
513 StackBase,
515 MemDesc.Attributes | EFI_MEMORY_RP
516 );
517 ASSERT_EFI_ERROR (Status);
518
519 DEBUG ((
520 DEBUG_INFO,
521 "Stack Guard set at %lx [cpu%lu]!\n",
522 (UINT64)StackBase,
523 (UINT64)Index
524 ));
525 }
526 }
527
528 //
529 // Avoid APs access invalid buffer data which allocated by BootServices,
530 // so we will allocate reserved data for AP loop code. We also need to
531 // allocate this buffer below 4GB due to APs may be transferred to 32bit
532 // protected mode on long mode DXE.
533 // Allocating it in advance since memory services are not available in
534 // Exit Boot Services callback function.
535 //
536 ApSafeBufferSize = EFI_PAGES_TO_SIZE (
538 CpuMpData->AddressMap.RelocateApLoopFuncSize
539 )
540 );
541 Address = BASE_4GB - 1;
542 Status = gBS->AllocatePages (
545 EFI_SIZE_TO_PAGES (ApSafeBufferSize),
546 &Address
547 );
548 ASSERT_EFI_ERROR (Status);
549
550 mReservedApLoopFunc = (VOID *)(UINTN)Address;
551 ASSERT (mReservedApLoopFunc != NULL);
552
553 //
554 // Make sure that the buffer memory is executable if NX protection is enabled
555 // for EfiReservedMemoryType.
556 //
557 // TODO: Check EFI_MEMORY_XP bit set or not once it's available in DXE GCD
558 // service.
559 //
560 Status = gDS->GetMemorySpaceDescriptor (Address, &MemDesc);
561 if (!EFI_ERROR (Status)) {
562 gDS->SetMemorySpaceAttributes (
563 Address,
564 ApSafeBufferSize,
565 MemDesc.Attributes & (~EFI_MEMORY_XP)
566 );
567 }
568
569 ApSafeBufferSize = EFI_PAGES_TO_SIZE (
571 CpuMpData->CpuCount * AP_SAFE_STACK_SIZE
572 )
573 );
574 Address = BASE_4GB - 1;
575 Status = gBS->AllocatePages (
578 EFI_SIZE_TO_PAGES (ApSafeBufferSize),
579 &Address
580 );
581 ASSERT_EFI_ERROR (Status);
582
583 mReservedTopOfApStack = (UINTN)Address + ApSafeBufferSize;
584 ASSERT ((mReservedTopOfApStack & (UINTN)(CPU_STACK_ALIGNMENT - 1)) == 0);
585 CopyMem (
586 mReservedApLoopFunc,
587 CpuMpData->AddressMap.RelocateApLoopFuncAddress,
588 CpuMpData->AddressMap.RelocateApLoopFuncSize
589 );
590
591 Status = gBS->CreateEvent (
592 EVT_TIMER | EVT_NOTIFY_SIGNAL,
593 TPL_NOTIFY,
595 NULL,
596 &mCheckAllApsEvent
597 );
598 ASSERT_EFI_ERROR (Status);
599
600 //
601 // Set timer to check all APs status.
602 //
603 Status = gBS->SetTimer (
604 mCheckAllApsEvent,
607 PcdGet32 (PcdCpuApStatusCheckIntervalInMicroSeconds)
608 )
609 );
610 ASSERT_EFI_ERROR (Status);
611
612 Status = gBS->CreateEvent (
613 EVT_SIGNAL_EXIT_BOOT_SERVICES,
614 TPL_CALLBACK,
616 NULL,
617 &mMpInitExitBootServicesEvent
618 );
619 ASSERT_EFI_ERROR (Status);
620
621 Status = gBS->CreateEventEx (
622 EVT_NOTIFY_SIGNAL,
623 TPL_CALLBACK,
625 NULL,
626 &gEfiEventLegacyBootGuid,
627 &mLegacyBootEvent
628 );
629 ASSERT_EFI_ERROR (Status);
630}
631
708EFIAPI
710 IN EFI_AP_PROCEDURE Procedure,
711 IN BOOLEAN SingleThread,
712 IN EFI_EVENT WaitEvent OPTIONAL,
713 IN UINTN TimeoutInMicroseconds,
714 IN VOID *ProcedureArgument OPTIONAL,
715 OUT UINTN **FailedCpuList OPTIONAL
716 )
717{
718 EFI_STATUS Status;
719
720 //
721 // Temporarily stop checkAllApsStatus for avoid resource dead-lock.
722 //
723 mStopCheckAllApsStatus = TRUE;
724
725 Status = StartupAllCPUsWorker (
726 Procedure,
727 SingleThread,
728 TRUE,
729 WaitEvent,
730 TimeoutInMicroseconds,
731 ProcedureArgument,
732 FailedCpuList
733 );
734
735 //
736 // Start checkAllApsStatus
737 //
738 mStopCheckAllApsStatus = FALSE;
739
740 return Status;
741}
742
815EFIAPI
817 IN EFI_AP_PROCEDURE Procedure,
818 IN UINTN ProcessorNumber,
819 IN EFI_EVENT WaitEvent OPTIONAL,
820 IN UINTN TimeoutInMicroseconds,
821 IN VOID *ProcedureArgument OPTIONAL,
822 OUT BOOLEAN *Finished OPTIONAL
823 )
824{
825 EFI_STATUS Status;
826
827 //
828 // temporarily stop checkAllApsStatus for avoid resource dead-lock.
829 //
830 mStopCheckAllApsStatus = TRUE;
831
832 Status = StartupThisAPWorker (
833 Procedure,
834 ProcessorNumber,
835 WaitEvent,
836 TimeoutInMicroseconds,
837 ProcedureArgument,
838 Finished
839 );
840
841 mStopCheckAllApsStatus = FALSE;
842
843 return Status;
844}
845
873EFIAPI
875 IN UINTN ProcessorNumber,
876 IN BOOLEAN EnableOldBSP
877 )
878{
879 EFI_STATUS Status;
881 UINT64 TimerPeriod;
882
883 TimerPeriod = 0;
884 //
885 // Locate Timer Arch Protocol
886 //
887 Status = gBS->LocateProtocol (&gEfiTimerArchProtocolGuid, NULL, (VOID **)&Timer);
888 if (EFI_ERROR (Status)) {
889 Timer = NULL;
890 }
891
892 if (Timer != NULL) {
893 //
894 // Save current rate of DXE Timer
895 //
896 Timer->GetTimerPeriod (Timer, &TimerPeriod);
897 //
898 // Disable DXE Timer and drain pending interrupts
899 //
900 Timer->SetTimerPeriod (Timer, 0);
901 }
902
903 Status = SwitchBSPWorker (ProcessorNumber, EnableOldBSP);
904
905 if (Timer != NULL) {
906 //
907 // Enable and restore rate of DXE Timer
908 //
909 Timer->SetTimerPeriod (Timer, TimerPeriod);
910 }
911
912 return Status;
913}
914
946EFIAPI
948 IN UINTN ProcessorNumber,
949 IN BOOLEAN EnableAP,
950 IN UINT32 *HealthFlag OPTIONAL
951 )
952{
953 EFI_STATUS Status;
954 BOOLEAN TempStopCheckState;
955
956 TempStopCheckState = FALSE;
957 //
958 // temporarily stop checkAllAPsStatus for initialize parameters.
959 //
960 if (!mStopCheckAllApsStatus) {
961 mStopCheckAllApsStatus = TRUE;
962 TempStopCheckState = TRUE;
963 }
964
965 Status = EnableDisableApWorker (ProcessorNumber, EnableAP, HealthFlag);
966
967 if (TempStopCheckState) {
968 mStopCheckAllApsStatus = FALSE;
969 }
970
971 return Status;
972}
973
987 IN OUT CPU_MP_DATA *CpuMpData
988 )
989{
990 //
991 // There is no DXE version of platform shadow microcode protocol so far.
992 // A platform which only uses DxeMpInitLib instance could only supports
993 // the PCD based microcode shadowing.
994 //
995 return EFI_UNSUPPORTED;
996}
UINT64 UINTN
#define CPU_STACK_ALIGNMENT
#define NULL
Definition: Base.h:312
#define STATIC
Definition: Base.h:264
#define TRUE
Definition: Base.h:301
#define FALSE
Definition: Base.h:307
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
VOID EFIAPI CpuPause(VOID)
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
VOID EFIAPI InitializeDebugAgent(IN UINT32 InitFlag, IN VOID *Context OPTIONAL, IN DEBUG_AGENT_CONTINUE Function OPTIONAL)
#define ASSERT_EFI_ERROR(StatusParameter)
Definition: DebugLib.h:440
#define DEBUG(Expression)
Definition: DebugLib.h:417
#define ASSERT(Expression)
Definition: DebugLib.h:391
STATIC BOOLEAN EFIAPI ConfidentialComputingGuestHas(IN CONFIDENTIAL_COMPUTING_GUEST_ATTR Attr)
EFI_STATUS EFIAPI MpInitLibEnableDisableAP(IN UINTN ProcessorNumber, IN BOOLEAN EnableAP, IN UINT32 *HealthFlag OPTIONAL)
Definition: DxeMpLib.c:947
VOID EFIAPI RelocateApLoop(IN OUT VOID *Buffer)
Definition: DxeMpLib.c:377
UINT16 GetProtectedModeCS(VOID)
Definition: DxeMpLib.c:344
EFI_STATUS EFIAPI MpInitLibStartupAllAPs(IN EFI_AP_PROCEDURE Procedure, IN BOOLEAN SingleThread, IN EFI_EVENT WaitEvent OPTIONAL, IN UINTN TimeoutInMicroseconds, IN VOID *ProcedureArgument OPTIONAL, OUT UINTN **FailedCpuList OPTIONAL)
Definition: DxeMpLib.c:709
VOID EFIAPI MpInitChangeApLoopCallback(IN EFI_EVENT Event, IN VOID *Context)
Definition: DxeMpLib.c:423
VOID CheckAndUpdateApsStatus(VOID)
Definition: DxeMpLib.c:237
UINTN GetWakeupBuffer(IN UINTN WakeupBufferSize)
Definition: DxeMpLib.c:88
UINT16 GetProtectedMode16CS(VOID)
Definition: DxeMpLib.c:311
EFI_STATUS EFIAPI MpInitLibSwitchBSP(IN UINTN ProcessorNumber, IN BOOLEAN EnableOldBSP)
Definition: DxeMpLib.c:874
VOID EFIAPI CheckApsStatus(IN EFI_EVENT Event, IN VOID *Context)
Definition: DxeMpLib.c:291
UINTN AllocateCodeBuffer(IN UINTN BufferSize)
Definition: DxeMpLib.c:165
CPU_MP_DATA * GetCpuMpData(VOID)
Definition: DxeMpLib.c:58
EFI_STATUS PlatformShadowMicrocode(IN OUT CPU_MP_DATA *CpuMpData)
Definition: DxeMpLib.c:986
UINTN GetSevEsAPMemory(VOID)
Definition: DxeMpLib.c:195
VOID InitMpGlobalData(IN CPU_MP_DATA *CpuMpData)
Definition: DxeMpLib.c:463
VOID EnableDebugAgent(VOID)
Definition: DxeMpLib.c:42
EFI_STATUS EFIAPI MpInitLibStartupThisAP(IN EFI_AP_PROCEDURE Procedure, IN UINTN ProcessorNumber, IN EFI_EVENT WaitEvent OPTIONAL, IN UINTN TimeoutInMicroseconds, IN VOID *ProcedureArgument OPTIONAL, OUT BOOLEAN *Finished OPTIONAL)
Definition: DxeMpLib.c:816
VOID SaveCpuMpData(IN CPU_MP_DATA *CpuMpData)
Definition: DxeMpLib.c:72
EFI_DXE_SERVICES * gDS
#define MSR_SEV_ES_GHCB
Definition: Fam17Msr.h:24
UINT64 EFIAPI AsmReadMsr64(IN UINT32 Index)
Definition: GccInlinePriv.c:60
EFI_STATUS EFIAPI MpInitLibWhoAmI(OUT UINTN *ProcessorNumber)
Definition: MpLib.c:2354
EFI_STATUS StartupThisAPWorker(IN EFI_AP_PROCEDURE Procedure, IN UINTN ProcessorNumber, IN EFI_EVENT WaitEvent OPTIONAL, IN UINTN TimeoutInMicroseconds, IN VOID *ProcedureArgument OPTIONAL, OUT BOOLEAN *Finished OPTIONAL)
Definition: MpLib.c:2626
EFI_STATUS EnableDisableApWorker(IN UINTN ProcessorNumber, IN BOOLEAN EnableAP, IN UINT32 *HealthFlag OPTIONAL)
Definition: MpLib.c:2295
VOID WakeUpAP(IN CPU_MP_DATA *CpuMpData, IN BOOLEAN Broadcast, IN UINTN ProcessorNumber, IN EFI_AP_PROCEDURE Procedure OPTIONAL, IN VOID *ProcedureArgument OPTIONAL, IN BOOLEAN WakeUpDisabledAps)
Definition: MpLib.c:1120
BOOLEAN IsMwaitSupport(VOID)
Definition: MpLib.c:260
EFI_STATUS StartupAllCPUsWorker(IN EFI_AP_PROCEDURE Procedure, IN BOOLEAN SingleThread, IN BOOLEAN ExcludeBsp, IN EFI_EVENT WaitEvent OPTIONAL, IN UINTN TimeoutInMicroseconds, IN VOID *ProcedureArgument OPTIONAL, OUT UINTN **FailedCpuList OPTIONAL)
Definition: MpLib.c:2468
EFI_STATUS CheckThisAP(IN UINTN ProcessorNumber)
Definition: MpLib.c:1584
EFI_STATUS SwitchBSPWorker(IN UINTN ProcessorNumber, IN BOOLEAN EnableOldBSP)
Definition: MpLib.c:2152
EFI_STATUS CheckAllAPs(VOID)
Definition: MpLib.c:1641
VOID(EFIAPI * ASM_RELOCATE_AP_LOOP)(IN BOOLEAN MwaitSupport, IN UINTN ApTargetCState, IN UINTN PmCodeSegment, IN UINTN TopOfApStack, IN UINTN NumberToFinish, IN UINTN Pm16CodeSegment, IN UINTN SevEsAPJumpTable, IN UINTN WakeupBuffer)
Definition: MpLib.h:358
#define PcdGet8(TokenName)
Definition: PcdLib.h:336
#define PcdGet32(TokenName)
Definition: PcdLib.h:362
#define PcdGetBool(TokenName)
Definition: PcdLib.h:401
VOID(EFIAPI * EFI_AP_PROCEDURE)(IN OUT VOID *Buffer)
Definition: PiMultiPhase.h:191
UINT64 EFI_PHYSICAL_ADDRESS
Definition: UefiBaseType.h:49
#define EFI_PAGES_TO_SIZE(Pages)
Definition: UefiBaseType.h:210
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:28
VOID * EFI_EVENT
Definition: UefiBaseType.h:36
#define EFI_SIZE_TO_PAGES(Size)
Definition: UefiBaseType.h:197
EFI_BOOT_SERVICES * gBS
#define EFI_TIMER_PERIOD_MICROSECONDS(Microseconds)
Definition: UefiLib.h:74
EFI_MEMORY_TYPE
@ EfiBootServicesData
@ EfiReservedMemoryType
@ EfiBootServicesCode
@ TimerPeriodic
Definition: UefiSpec.h:513
@ AllocateMaxAddress
Definition: UefiSpec.h:37
UINT64 EFIAPI VmgExit(IN OUT GHCB *Ghcb, IN UINT64 ExitCode, IN UINT64 ExitInfo1, IN UINT64 ExitInfo2)
Definition: VmgExitLib.c:105
VOID EFIAPI VmgInit(IN OUT GHCB *Ghcb, IN OUT BOOLEAN *InterruptState)
Definition: VmgExitLib.c:145
VOID EFIAPI VmgDone(IN OUT GHCB *Ghcb, IN BOOLEAN InterruptState)
Definition: VmgExitLib.c:175
VOID EFIAPI AsmReadGdtr(OUT IA32_DESCRIPTOR *Gdtr)
Definition: X86ReadGdtr.c:24