TianoCore EDK2 master
Loading...
Searching...
No Matches
PeiMpLib.c
Go to the documentation of this file.
1
9#include "MpLib.h"
11#include <Guid/S3SmmInitDone.h>
12#include <Guid/EndOfS3Resume.h>
13#include <Ppi/ShadowMicrocode.h>
14
15STATIC UINT64 mSevEsPeiWakeupBuffer = BASE_1MB;
16
21VOID
23 VOID
24 )
25{
26}
27
37 VOID
38 )
39{
40 CPU_MP_DATA *CpuMpData;
42 UINTN ApTopOfStack;
43 AP_STACK_DATA *ApStackData;
44
46 if (ApicBaseMsr.Bits.BSP == 1) {
47 CpuMpData = GetCpuMpDataFromGuidedHob ();
48 ASSERT (CpuMpData != NULL);
49 } else {
50 ApTopOfStack = ALIGN_VALUE ((UINTN)&ApTopOfStack, (UINTN)PcdGet32 (PcdCpuApStackSize));
51 ApStackData = (AP_STACK_DATA *)((UINTN)ApTopOfStack- sizeof (AP_STACK_DATA));
52 CpuMpData = (CPU_MP_DATA *)ApStackData->MpData;
53 }
54
55 return CpuMpData;
56}
57
63VOID
65 IN CPU_MP_DATA *CpuMpData
66 )
67{
68 UINT32 MaxCpusPerHob;
69 UINT32 CpusInHob;
70 UINT64 Data64;
71 UINT32 Index;
72 UINT32 HobBase;
73 CPU_INFO_IN_HOB *CpuInfoInHob;
74 MP_HAND_OFF *MpHandOff;
75 MP_HAND_OFF_CONFIG MpHandOffConfig;
76 UINTN MpHandOffSize;
77
78 MaxCpusPerHob = (0xFFF8 - sizeof (EFI_HOB_GUID_TYPE) - sizeof (MP_HAND_OFF)) / sizeof (PROCESSOR_HAND_OFF);
79
80 //
81 // When APs are in a state that can be waken up by a store operation to a memory address,
82 // report the MP_HAND_OFF data for DXE to use.
83 //
84 CpuInfoInHob = (CPU_INFO_IN_HOB *)(UINTN)CpuMpData->CpuInfoInHob;
85
86 for (Index = 0; Index < CpuMpData->CpuCount; Index++) {
87 if (Index % MaxCpusPerHob == 0) {
88 HobBase = Index;
89 CpusInHob = MIN (CpuMpData->CpuCount - HobBase, MaxCpusPerHob);
90
91 MpHandOffSize = sizeof (MP_HAND_OFF) + sizeof (PROCESSOR_HAND_OFF) * CpusInHob;
92 MpHandOff = (MP_HAND_OFF *)BuildGuidHob (&mMpHandOffGuid, MpHandOffSize);
93 ASSERT (MpHandOff != NULL);
94 ZeroMem (MpHandOff, MpHandOffSize);
95
96 MpHandOff->ProcessorIndex = HobBase;
97 MpHandOff->CpuCount = CpusInHob;
98 }
99
100 MpHandOff->Info[Index-HobBase].ApicId = CpuInfoInHob[Index].ApicId;
101 MpHandOff->Info[Index-HobBase].Health = CpuInfoInHob[Index].Health;
102 if (CpuMpData->ApLoopMode != ApInHltLoop) {
103 MpHandOff->Info[Index-HobBase].StartupSignalAddress = (UINT64)(UINTN)CpuMpData->CpuData[Index].StartupApSignal;
104 MpHandOff->Info[Index-HobBase].StartupProcedureAddress = (UINT64)(UINTN)&CpuMpData->CpuData[Index].ApFunction;
105 }
106 }
107
108 ZeroMem (&MpHandOffConfig, sizeof (MpHandOffConfig));
109 if (CpuMpData->ApLoopMode != ApInHltLoop) {
110 MpHandOffConfig.StartupSignalValue = MP_HAND_OFF_SIGNAL;
111 MpHandOffConfig.WaitLoopExecutionMode = sizeof (VOID *);
112 }
113
115 &mMpHandOffConfigGuid,
116 (VOID *)&MpHandOffConfig,
117 sizeof (MpHandOffConfig)
118 );
119
120 //
121 // Build location of CPU MP DATA buffer in HOB
122 //
123 Data64 = (UINT64)(UINTN)CpuMpData;
125 &mCpuInitMpLibHobGuid,
126 (VOID *)&Data64,
127 sizeof (UINT64)
128 );
129}
130
140BOOLEAN
142 IN UINT64 WakeupBufferStart,
143 IN UINT64 WakeupBufferEnd
144 )
145{
147 EFI_HOB_MEMORY_ALLOCATION *MemoryHob;
148 BOOLEAN Overlapped;
149 UINT64 MemoryStart;
150 UINT64 MemoryEnd;
151
152 Overlapped = FALSE;
153 //
154 // Get the HOB list for processing
155 //
156 Hob.Raw = GetHobList ();
157 //
158 // Collect memory ranges
159 //
160 while (!END_OF_HOB_LIST (Hob)) {
161 if (Hob.Header->HobType == EFI_HOB_TYPE_MEMORY_ALLOCATION) {
162 MemoryHob = Hob.MemoryAllocation;
163 MemoryStart = MemoryHob->AllocDescriptor.MemoryBaseAddress;
164 MemoryEnd = MemoryHob->AllocDescriptor.MemoryBaseAddress + MemoryHob->AllocDescriptor.MemoryLength;
165 if (!((WakeupBufferStart >= MemoryEnd) || (WakeupBufferEnd <= MemoryStart))) {
166 Overlapped = TRUE;
167 break;
168 }
169 }
170
171 Hob.Raw = GET_NEXT_HOB (Hob);
172 }
173
174 return Overlapped;
175}
176
185UINTN
187 IN UINTN WakeupBufferSize
188 )
189{
191 UINT64 WakeupBufferStart;
192 UINT64 WakeupBufferEnd;
193
194 WakeupBufferSize = (WakeupBufferSize + SIZE_4KB - 1) & ~(SIZE_4KB - 1);
195
196 //
197 // Get the HOB list for processing
198 //
199 Hob.Raw = GetHobList ();
200
201 //
202 // Collect memory ranges
203 //
204 while (!END_OF_HOB_LIST (Hob)) {
205 if (Hob.Header->HobType == EFI_HOB_TYPE_RESOURCE_DESCRIPTOR) {
206 if ((Hob.ResourceDescriptor->PhysicalStart < BASE_1MB) &&
207 (Hob.ResourceDescriptor->ResourceType == EFI_RESOURCE_SYSTEM_MEMORY) &&
208 ((Hob.ResourceDescriptor->ResourceAttribute &
209 (EFI_RESOURCE_ATTRIBUTE_READ_PROTECTED |
210 EFI_RESOURCE_ATTRIBUTE_WRITE_PROTECTED |
211 EFI_RESOURCE_ATTRIBUTE_EXECUTION_PROTECTED
212 )) == 0)
213 )
214 {
215 //
216 // Need memory under 1MB to be collected here
217 //
218 WakeupBufferEnd = Hob.ResourceDescriptor->PhysicalStart + Hob.ResourceDescriptor->ResourceLength;
219 if (ConfidentialComputingGuestHas (CCAttrAmdSevEs) &&
220 (WakeupBufferEnd > mSevEsPeiWakeupBuffer))
221 {
222 //
223 // SEV-ES Wakeup buffer should be under 1MB and under any previous one
224 //
225 WakeupBufferEnd = mSevEsPeiWakeupBuffer;
226 } else if (WakeupBufferEnd > BASE_1MB) {
227 //
228 // Wakeup buffer should be under 1MB
229 //
230 WakeupBufferEnd = BASE_1MB;
231 }
232
233 while (WakeupBufferEnd > (UINT64)WakeupBufferSize) {
234 //
235 // Wakeup buffer should be aligned on 4KB
236 //
237 WakeupBufferStart = (WakeupBufferEnd - WakeupBufferSize) & ~(SIZE_4KB - 1);
238 if (WakeupBufferStart < Hob.ResourceDescriptor->PhysicalStart) {
239 break;
240 }
241
242 if (CheckOverlapWithAllocatedBuffer (WakeupBufferStart, WakeupBufferEnd)) {
243 //
244 // If this range is overlapped with existing allocated buffer, skip it
245 // and find the next range
246 //
247 WakeupBufferEnd -= WakeupBufferSize;
248 continue;
249 }
250
251 DEBUG ((
252 DEBUG_INFO,
253 "WakeupBufferStart = %x, WakeupBufferSize = %x\n",
254 WakeupBufferStart,
255 WakeupBufferSize
256 ));
257
258 if (ConfidentialComputingGuestHas (CCAttrAmdSevEs)) {
259 //
260 // Next SEV-ES wakeup buffer allocation must be below this
261 // allocation
262 //
263 mSevEsPeiWakeupBuffer = WakeupBufferStart;
264 }
265
266 return (UINTN)WakeupBufferStart;
267 }
268 }
269 }
270
271 //
272 // Find the next HOB
273 //
274 Hob.Raw = GET_NEXT_HOB (Hob);
275 }
276
277 return (UINTN)-1;
278}
279
292UINTN
294 IN UINTN BufferSize
295 )
296{
297 EFI_STATUS Status;
298 EFI_PHYSICAL_ADDRESS Address;
299
300 Status = PeiServicesAllocatePages (EfiBootServicesCode, EFI_SIZE_TO_PAGES (BufferSize), &Address);
301 if (EFI_ERROR (Status)) {
302 Address = 0;
303 }
304
305 return (UINTN)Address;
306}
307
316UINTN
318 VOID
319 )
320{
321 //
322 // PEI phase doesn't need to do such transition. So simply return 0.
323 //
324 return 0;
325}
326
331VOID
333 VOID
334 )
335{
336}
337
345VOID
347 IN CPU_MP_DATA *CpuMpData
348 )
349{
350 EDKII_MICROCODE_PATCH_HOB *MicrocodeHob;
351 UINTN HobDataLength;
352 UINT32 Index;
353
354 HobDataLength = sizeof (EDKII_MICROCODE_PATCH_HOB) +
355 sizeof (UINT64) * CpuMpData->CpuCount;
356
357 MicrocodeHob = AllocatePool (HobDataLength);
358 if (MicrocodeHob == NULL) {
359 ASSERT (FALSE);
360 return;
361 }
362
363 //
364 // Store the information of the memory region that holds the microcode patches.
365 //
366 MicrocodeHob->MicrocodePatchAddress = CpuMpData->MicrocodePatchAddress;
367 MicrocodeHob->MicrocodePatchRegionSize = CpuMpData->MicrocodePatchRegionSize;
368
369 //
370 // Store the detected microcode patch for each processor as well.
371 //
372 MicrocodeHob->ProcessorCount = CpuMpData->CpuCount;
373 for (Index = 0; Index < CpuMpData->CpuCount; Index++) {
374 if (CpuMpData->CpuData[Index].MicrocodeEntryAddr != 0) {
375 MicrocodeHob->ProcessorSpecificPatchOffset[Index] =
376 CpuMpData->CpuData[Index].MicrocodeEntryAddr - CpuMpData->MicrocodePatchAddress;
377 } else {
378 MicrocodeHob->ProcessorSpecificPatchOffset[Index] = MAX_UINT64;
379 }
380 }
381
383 &gEdkiiMicrocodePatchHobGuid,
384 MicrocodeHob,
385 HobDataLength
386 );
387
388 return;
389}
390
402EFIAPI
404 IN EFI_PEI_SERVICES **PeiServices,
405 IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDesc,
406 IN VOID *InvokePpi
407 )
408{
409 CPU_MP_DATA *CpuMpData;
410
411 CpuMpData = GetCpuMpData ();
412 mNumberToFinish = CpuMpData->CpuCount - 1;
413 WakeUpAP (CpuMpData, TRUE, 0, RelocateApLoop, NULL, TRUE);
414 while (mNumberToFinish > 0) {
415 CpuPause ();
416 }
417
418 DEBUG ((DEBUG_INFO, "%a() done!\n", __func__));
419
420 return EFI_SUCCESS;
421}
422
423//
424// Global function
425//
426EFI_PEI_NOTIFY_DESCRIPTOR mEndOfS3ResumeNotifyDesc = {
427 EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST,
428 &gEdkiiEndOfS3ResumeGuid,
430};
431
437VOID
439 IN CPU_MP_DATA *CpuMpData
440 )
441{
442 EFI_STATUS Status;
443
444 BuildMicrocodeCacheHob (CpuMpData);
445 SaveCpuMpData (CpuMpData);
446 PrepareApLoopCode (CpuMpData);
447
451
452 Status = PeiServicesNotifyPpi (&mEndOfS3ResumeNotifyDesc);
453 ASSERT_EFI_ERROR (Status);
454}
455
532EFIAPI
534 IN EFI_AP_PROCEDURE Procedure,
535 IN BOOLEAN SingleThread,
536 IN EFI_EVENT WaitEvent OPTIONAL,
537 IN UINTN TimeoutInMicroseconds,
538 IN VOID *ProcedureArgument OPTIONAL,
539 OUT UINTN **FailedCpuList OPTIONAL
540 )
541{
542 if (WaitEvent != NULL) {
543 return EFI_UNSUPPORTED;
544 }
545
546 return StartupAllCPUsWorker (
547 Procedure,
548 SingleThread,
549 TRUE,
550 NULL,
551 TimeoutInMicroseconds,
552 ProcedureArgument,
553 FailedCpuList
554 );
555}
556
629EFIAPI
631 IN EFI_AP_PROCEDURE Procedure,
632 IN UINTN ProcessorNumber,
633 IN EFI_EVENT WaitEvent OPTIONAL,
634 IN UINTN TimeoutInMicroseconds,
635 IN VOID *ProcedureArgument OPTIONAL,
636 OUT BOOLEAN *Finished OPTIONAL
637 )
638{
639 if (WaitEvent != NULL) {
640 return EFI_UNSUPPORTED;
641 }
642
643 return StartupThisAPWorker (
644 Procedure,
645 ProcessorNumber,
646 NULL,
647 TimeoutInMicroseconds,
648 ProcedureArgument,
649 Finished
650 );
651}
652
680EFIAPI
682 IN UINTN ProcessorNumber,
683 IN BOOLEAN EnableOldBSP
684 )
685{
686 return SwitchBSPWorker (ProcessorNumber, EnableOldBSP);
687}
688
720EFIAPI
722 IN UINTN ProcessorNumber,
723 IN BOOLEAN EnableAP,
724 IN UINT32 *HealthFlag OPTIONAL
725 )
726{
727 return EnableDisableApWorker (ProcessorNumber, EnableAP, HealthFlag);
728}
729
743 IN OUT CPU_MP_DATA *CpuMpData
744 )
745{
746 EFI_STATUS Status;
747 EDKII_PEI_SHADOW_MICROCODE_PPI *ShadowMicrocodePpi;
748 UINTN CpuCount;
749 EDKII_PEI_MICROCODE_CPU_ID *MicrocodeCpuId;
750 UINTN Index;
751 UINTN BufferSize;
752 VOID *Buffer;
753
754 Status = PeiServicesLocatePpi (
755 &gEdkiiPeiShadowMicrocodePpiGuid,
756 0,
757 NULL,
758 (VOID **)&ShadowMicrocodePpi
759 );
760 if (EFI_ERROR (Status)) {
761 return EFI_UNSUPPORTED;
762 }
763
764 CpuCount = CpuMpData->CpuCount;
765 MicrocodeCpuId = (EDKII_PEI_MICROCODE_CPU_ID *)AllocateZeroPool (sizeof (EDKII_PEI_MICROCODE_CPU_ID) * CpuCount);
766 if (MicrocodeCpuId == NULL) {
767 return EFI_OUT_OF_RESOURCES;
768 }
769
770 for (Index = 0; Index < CpuMpData->CpuCount; Index++) {
771 MicrocodeCpuId[Index].ProcessorSignature = CpuMpData->CpuData[Index].ProcessorSignature;
772 MicrocodeCpuId[Index].PlatformId = CpuMpData->CpuData[Index].PlatformId;
773 }
774
775 Status = ShadowMicrocodePpi->ShadowMicrocode (
776 ShadowMicrocodePpi,
777 CpuCount,
778 MicrocodeCpuId,
779 &BufferSize,
780 &Buffer
781 );
782 FreePool (MicrocodeCpuId);
783 if (EFI_ERROR (Status)) {
784 return EFI_NOT_FOUND;
785 }
786
787 CpuMpData->MicrocodePatchAddress = (UINTN)Buffer;
788 CpuMpData->MicrocodePatchRegionSize = BufferSize;
789
790 DEBUG ((
791 DEBUG_INFO,
792 "%a: Required microcode patches have been loaded at 0x%lx, with size 0x%lx.\n",
793 __func__,
794 CpuMpData->MicrocodePatchAddress,
795 CpuMpData->MicrocodePatchRegionSize
796 ));
797
798 return EFI_SUCCESS;
799}
800
807VOID
809 IN UINTN Pages,
811 )
812{
813 EFI_STATUS Status;
814
815 Status = PeiServicesAllocatePages (EfiACPIMemoryNVS, Pages, Address);
816 if (EFI_ERROR (Status)) {
817 *Address = 0;
818 }
819}
820
830VOID
832 IN EFI_PHYSICAL_ADDRESS BaseAddress,
833 IN UINTN Length
834 )
835{
836 EFI_STATUS Status;
837 UINTN PageTable;
839 UINTN BufferSize;
840 IA32_MAP_ATTRIBUTE MapAttribute;
841 IA32_MAP_ATTRIBUTE MapMask;
842 PAGING_MODE PagingMode;
843 IA32_CR4 Cr4;
844 BOOLEAN Page5LevelSupport;
845 UINT32 RegEax;
846 BOOLEAN Page1GSupport;
848
849 if (sizeof (UINTN) == sizeof (UINT64)) {
850 //
851 // Check Page5Level Support or not.
852 //
853 Cr4.UintN = AsmReadCr4 ();
854 Page5LevelSupport = (Cr4.Bits.LA57 ? TRUE : FALSE);
855
856 //
857 // Check Page1G Support or not.
858 //
859 Page1GSupport = FALSE;
860 AsmCpuid (CPUID_EXTENDED_FUNCTION, &RegEax, NULL, NULL, NULL);
861 if (RegEax >= CPUID_EXTENDED_CPU_SIG) {
863 if (RegEdx.Bits.Page1GB != 0) {
864 Page1GSupport = TRUE;
865 }
866 }
867
868 //
869 // Decide Paging Mode according Page5LevelSupport & Page1GSupport.
870 //
871 if (Page5LevelSupport) {
872 PagingMode = Page1GSupport ? Paging5Level1GB : Paging5Level;
873 } else {
874 PagingMode = Page1GSupport ? Paging4Level1GB : Paging4Level;
875 }
876 } else {
877 PagingMode = PagingPae;
878 }
879
880 MapAttribute.Uint64 = 0;
881 MapMask.Uint64 = 0;
882 MapMask.Bits.Nx = 1;
883 PageTable = AsmReadCr3 () & PAGING_4K_ADDRESS_MASK_64;
884 BufferSize = 0;
885
886 //
887 // Get required buffer size for changing the pagetable.
888 //
889 Status = PageTableMap (&PageTable, PagingMode, 0, &BufferSize, BaseAddress, Length, &MapAttribute, &MapMask, NULL);
890 if (Status == EFI_BUFFER_TOO_SMALL) {
891 //
892 // Allocate required Buffer.
893 //
894 Status = PeiServicesAllocatePages (
896 EFI_SIZE_TO_PAGES (BufferSize),
897 &Buffer
898 );
899 ASSERT_EFI_ERROR (Status);
900 Status = PageTableMap (&PageTable, PagingMode, (VOID *)(UINTN)Buffer, &BufferSize, BaseAddress, Length, &MapAttribute, &MapMask, NULL);
901 }
902
903 ASSERT_EFI_ERROR (Status);
904 AsmWriteCr3 (PageTable);
905}
UINT64 UINTN
VOID *EFIAPI BuildGuidDataHob(IN CONST EFI_GUID *Guid, IN VOID *Data, IN UINTN DataLength)
Definition: HobLib.c:375
VOID *EFIAPI BuildGuidHob(IN CONST EFI_GUID *Guid, IN UINTN DataLength)
Definition: HobLib.c:336
VOID *EFIAPI GetHobList(VOID)
Definition: HobLib.c:76
VOID EFIAPI CpuPause(VOID)
VOID *EFIAPI ZeroMem(OUT VOID *Buffer, IN UINTN Length)
RETURN_STATUS EFIAPI PageTableMap(IN OUT UINTN *PageTable OPTIONAL, IN PAGING_MODE PagingMode, IN VOID *Buffer, IN OUT UINTN *BufferSize, IN UINT64 LinearAddress, IN UINT64 Length, IN IA32_MAP_ATTRIBUTE *Attribute, IN IA32_MAP_ATTRIBUTE *Mask, OUT BOOLEAN *IsModified OPTIONAL)
STATIC BOOLEAN EFIAPI ConfidentialComputingGuestHas(IN CONFIDENTIAL_COMPUTING_GUEST_ATTR Attr)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
EFI_STATUS EFIAPI PeiServicesLocatePpi(IN CONST EFI_GUID *Guid, IN UINTN Instance, IN OUT EFI_PEI_PPI_DESCRIPTOR **PpiDescriptor, IN OUT VOID **Ppi)
EFI_STATUS EFIAPI PeiServicesNotifyPpi(IN CONST EFI_PEI_NOTIFY_DESCRIPTOR *NotifyList)
EFI_STATUS EFIAPI PeiServicesAllocatePages(IN EFI_MEMORY_TYPE MemoryType, IN UINTN Pages, OUT EFI_PHYSICAL_ADDRESS *Memory)
UINTN EFIAPI AsmReadCr3(VOID)
UINT64 EFIAPI AsmReadMsr64(IN UINT32 Index)
Definition: GccInlinePriv.c:60
UINTN EFIAPI AsmWriteCr3(UINTN Cr3)
UINTN EFIAPI AsmReadCr4(VOID)
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:1176
CPU_MP_DATA * GetCpuMpDataFromGuidedHob(VOID)
Definition: MpLib.c:1609
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:672
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:1019
EFI_STATUS EnableDisableApWorker(IN UINTN ProcessorNumber, IN BOOLEAN EnableAP, IN UINT32 *HealthFlag OPTIONAL)
Definition: MpLib.c:2745
EFI_STATUS EFIAPI MpInitLibEnableDisableAP(IN UINTN ProcessorNumber, IN BOOLEAN EnableAP, IN UINT32 *HealthFlag OPTIONAL)
Definition: PeiMpLib.c:374
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: PeiMpLib.c:186
VOID CheckAndUpdateApsStatus(VOID)
Definition: PeiMpLib.c:90
EFI_STATUS EFIAPI MpInitLibSwitchBSP(IN UINTN ProcessorNumber, IN BOOLEAN EnableOldBSP)
Definition: PeiMpLib.c:334
CPU_MP_DATA * GetCpuMpData(VOID)
Definition: PeiMpLib.c:28
VOID InitMpGlobalData(IN CPU_MP_DATA *CpuMpData)
Definition: PeiMpLib.c:102
VOID EnableDebugAgent(VOID)
Definition: PeiMpLib.c:16
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: PeiMpLib.c:283
VOID SaveCpuMpData(IN CPU_MP_DATA *CpuMpData)
Definition: PeiMpLib.c:45
#define NULL
Definition: Base.h:319
#define STATIC
Definition: Base.h:264
#define MIN(a, b)
Definition: Base.h:1007
#define ALIGN_VALUE(Value, Alignment)
Definition: Base.h:948
#define TRUE
Definition: Base.h:301
#define FALSE
Definition: Base.h:307
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
#define ASSERT_EFI_ERROR(StatusParameter)
Definition: DebugLib.h:462
#define DEBUG(Expression)
Definition: DebugLib.h:434
#define MSR_IA32_APIC_BASE
#define CPUID_EXTENDED_CPU_SIG
Definition: Cpuid.h:3768
UINT32 EFIAPI AsmCpuid(IN UINT32 Index, OUT UINT32 *RegisterEax OPTIONAL, OUT UINT32 *RegisterEbx OPTIONAL, OUT UINT32 *RegisterEcx OPTIONAL, OUT UINT32 *RegisterEdx OPTIONAL)
Definition: CpuId.c:36
VOID EFIAPI RelocateApLoop(IN OUT VOID *Buffer)
Definition: MpLib.c:3364
VOID PrepareApLoopCode(IN CPU_MP_DATA *CpuMpData)
Definition: MpLib.c:3424
EFI_STATUS SwitchBSPWorker(IN UINTN ProcessorNumber, IN BOOLEAN EnableOldBSP)
Definition: MpLib.c:2581
#define PcdGet32(TokenName)
Definition: PcdLib.h:362
EFI_STATUS EFIAPI NotifyOnEndOfS3Resume(IN EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDesc, IN VOID *InvokePpi)
Definition: PeiMpLib.c:403
VOID RemoveNxprotection(IN EFI_PHYSICAL_ADDRESS BaseAddress, IN UINTN Length)
Definition: PeiMpLib.c:831
UINTN GetWakeupBuffer(IN UINTN WakeupBufferSize)
Definition: PeiMpLib.c:186
VOID BuildMicrocodeCacheHob(IN CPU_MP_DATA *CpuMpData)
Definition: PeiMpLib.c:346
BOOLEAN CheckOverlapWithAllocatedBuffer(IN UINT64 WakeupBufferStart, IN UINT64 WakeupBufferEnd)
Definition: PeiMpLib.c:141
VOID AllocateApLoopCodeBuffer(IN UINTN Pages, IN OUT EFI_PHYSICAL_ADDRESS *Address)
Definition: PeiMpLib.c:808
UINTN AllocateCodeBuffer(IN UINTN BufferSize)
Definition: PeiMpLib.c:293
EFI_STATUS PlatformShadowMicrocode(IN OUT CPU_MP_DATA *CpuMpData)
Definition: PeiMpLib.c:742
UINTN GetSevEsAPMemory(VOID)
Definition: PeiMpLib.c:317
VOID(EFIAPI * EFI_AP_PROCEDURE)(IN OUT VOID *Buffer)
Definition: PiMultiPhase.h:198
VOID *EFIAPI AllocatePool(IN UINTN AllocationSize)
UINT64 EFI_PHYSICAL_ADDRESS
Definition: UefiBaseType.h:50
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
VOID * EFI_EVENT
Definition: UefiBaseType.h:37
#define EFI_SIZE_TO_PAGES(Size)
Definition: UefiBaseType.h:200
#define EFI_SUCCESS
Definition: UefiBaseType.h:112
@ EfiBootServicesData
@ EfiBootServicesCode
@ EfiACPIMemoryNVS
EFI_PHYSICAL_ADDRESS MemoryBaseAddress
Definition: PiHob.h:119
EFI_HOB_MEMORY_ALLOCATION_HEADER AllocDescriptor
Definition: PiHob.h:153
EFI_PHYSICAL_ADDRESS PhysicalStart
Definition: PiHob.h:328
EFI_RESOURCE_TYPE ResourceType
Definition: PiHob.h:320
EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute
Definition: PiHob.h:324
struct CPUID_EXTENDED_CPU_SIG_EDX::@750 Bits
struct MSR_IA32_APIC_BASE_REGISTER::@627 Bits