46#define WAKEUP_AP_SIGNAL SIGNATURE_32 ('S', 'T', 'A', 'P')
54#define MP_HAND_OFF_SIGNAL SIGNATURE_32 ('M', 'P', 'H', 'O')
56#define CPU_INIT_MP_LIB_HOB_GUID \
58 0x58eb6a19, 0x3699, 0x4c68, { 0xa8, 0x36, 0xda, 0xcd, 0x8e, 0xdc, 0xad, 0x4a } \
64#define CPU_SWITCH_STATE_IDLE 0
65#define CPU_SWITCH_STATE_STORED 1
66#define CPU_SWITCH_STATE_LOADED 2
71#define DEFAULT_MAX_MICROCODE_PATCH_NUM 8
73#define PAGING_4K_ADDRESS_MASK_64 0x000FFFFFFFFFF000ull
148 volatile UINT32 *StartupApSignal;
149 volatile UINTN ApFunction;
150 volatile UINTN ApFunctionArgument;
152 volatile CPU_STATE State;
160 UINT32 ProcessorSignature;
162 UINT64 MicrocodeEntryAddr;
163 UINT32 MicrocodeRevision;
175 UINT32 InitialApicId;
188 UINT8 *RendezvousFunnelAddress;
189 UINTN ModeEntryOffset;
190 UINTN RendezvousFunnelSize;
191 UINT8 *RelocateApLoopFuncAddressGeneric;
192 UINTN RelocateApLoopFuncSizeGeneric;
193 UINT8 *RelocateApLoopFuncAddressAmdSev;
194 UINTN RelocateApLoopFuncSizeAmdSev;
195 UINTN ModeTransitionOffset;
196 UINTN SwitchToRealNoNxOffset;
197 UINTN SwitchToRealPM16ModeOffset;
198 UINTN SwitchToRealPM16ModeSize;
216 IA32_DESCRIPTOR GdtrProfile;
217 IA32_DESCRIPTOR IdtrProfile;
223 UINTN EnableExecuteDisable;
227 UINTN NumApsExecuting;
229 UINTN InitializeFloatingPointUnitsAddress;
230 UINT32 ModeTransitionMemory;
231 UINT16 ModeTransitionSegment;
232 UINT32 ModeHighMemory;
233 UINT16 ModeHighSegment;
237 BOOLEAN Enable5LevelPaging;
238 BOOLEAN SevEsIsEnabled;
239 BOOLEAN SevSnpIsEnabled;
241 BOOLEAN ExtTopoAvail;
270 UINTN InitialBspApicMode;
271 UINTN CpuApStackSize;
274 UINTN WakeupBufferHigh;
276 UINTN BackupBufferSize;
278 volatile UINT32 FinishedCount;
280 BOOLEAN SingleThread;
288 UINTN **FailedCpuList;
289 BOOLEAN EnableExecuteDisableForSwitchContext;
291 AP_INIT_STATE InitFlag;
292 BOOLEAN SwitchBspFlag;
298 UINT8 ApTargetCState;
299 UINT16 PmCodeSegment;
300 UINT16 Pm16CodeSegment;
304 UINT32 InitTimerCount;
307 BOOLEAN PeriodicMode;
308 BOOLEAN TimerInterruptState;
309 UINT64 MicrocodePatchAddress;
310 UINT64 MicrocodePatchRegionSize;
319 BOOLEAN WakeUpByInitSipiSipi;
321 BOOLEAN SevEsIsEnabled;
322 BOOLEAN SevSnpIsEnabled;
323 BOOLEAN UseSevEsAPMethod;
325 UINTN SevEsAPResetStackStart;
339#define AP_SAFE_STACK_SIZE 128
340#define AP_RESET_STACK_SIZE AP_SAFE_STACK_SIZE
375extern EFI_GUID mCpuInitMpLibHobGuid;
376extern volatile UINT32 mNumberToFinish;
395 IN BOOLEAN MwaitSupport,
418 IN BOOLEAN MwaitSupport,
573 IN BOOLEAN Broadcast,
576 IN VOID *ProcedureArgument OPTIONAL,
577 IN BOOLEAN WakeUpDisabledAps
625 IN BOOLEAN SingleThread,
626 IN BOOLEAN ExcludeBsp,
628 IN UINTN TimeoutInMicroseconds,
629 IN VOID *ProcedureArgument OPTIONAL,
661 IN UINTN TimeoutInMicroseconds,
662 IN VOID *ProcedureArgument OPTIONAL,
663 OUT BOOLEAN *Finished OPTIONAL
680 IN BOOLEAN EnableOldBSP
701 IN UINT32 *HealthFlag OPTIONAL
889 CONFIDENTIAL_COMPUTING_GUEST_ATTR Attr
#define CPU_STACK_ALIGNMENT
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)
CPU_MP_DATA * GetCpuMpDataFromGuidedHob(VOID)
EFI_STATUS EnableDisableApWorker(IN UINTN ProcessorNumber, IN BOOLEAN EnableAP, IN UINT32 *HealthFlag OPTIONAL)
VOID CheckAndUpdateApsStatus(VOID)
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)
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)
EFI_STATUS CheckThisAP(IN UINTN ProcessorNumber)
CPU_MP_DATA * GetCpuMpData(VOID)
EFI_STATUS CheckAllAPs(VOID)
VOID InitMpGlobalData(IN CPU_MP_DATA *CpuMpData)
VOID EnableDebugAgent(VOID)
VOID SaveCpuMpData(IN CPU_MP_DATA *CpuMpData)
VOID EFIAPI RelocateApLoop(IN OUT VOID *Buffer)
VOID AllocateSevEsAPMemory(IN OUT CPU_MP_DATA *CpuMpData)
VOID AmdSevUpdateCpuMpData(IN CPU_MP_DATA *CpuMpData)
VOID EFIAPI AsmExchangeRole(IN CPU_EXCHANGE_ROLE_INFO *MyInfo, IN CPU_EXCHANGE_ROLE_INFO *OthersInfo)
VOID SetSevEsJumpTable(IN UINTN SipiVector)
VOID SwitchApContext(IN CONST MP_HAND_OFF_CONFIG *MpHandOffConfig, IN CONST MP_HAND_OFF *FirstMpHandOff)
VOID(EFIAPI * ASM_RELOCATE_AP_LOOP_AMDSEV)(IN BOOLEAN MwaitSupport, IN UINTN ApTargetCState, IN UINTN PmCodeSegment, IN UINTN TopOfApStack, IN UINTN NumberToFinish, IN UINTN Pm16CodeSegment, IN UINTN SevEsAPJumpTable, IN UINTN WakeupBuffer)
VOID ShadowMicrocodeUpdatePatch(IN OUT CPU_MP_DATA *CpuMpData)
VOID RemoveNxprotection(IN EFI_PHYSICAL_ADDRESS BaseAddress, IN UINTN Length)
MP_HAND_OFF * GetNextMpHandOffHob(IN CONST MP_HAND_OFF *MpHandOff)
UINTN GetWakeupBuffer(IN UINTN WakeupBufferSize)
VOID PrepareApLoopCode(IN CPU_MP_DATA *CpuMpData)
BOOLEAN EFIAPI ConfidentialComputingGuestHas(CONFIDENTIAL_COMPUTING_GUEST_ATTR Attr)
VOID EFIAPI AsmGetAddressMap(OUT MP_ASSEMBLY_ADDRESS_MAP *AddressMap)
VOID AllocateApLoopCodeBuffer(IN UINTN Pages, IN OUT EFI_PHYSICAL_ADDRESS *Address)
VOID SevSnpCreateAP(IN CPU_MP_DATA *CpuMpData, IN INTN ProcessorNumber)
BOOLEAN IsMwaitSupport(VOID)
VOID MicrocodeDetect(IN CPU_MP_DATA *CpuMpData, IN UINTN ProcessorNumber)
EFI_STATUS GetProcessorNumber(IN CPU_MP_DATA *CpuMpData, OUT UINTN *ProcessorNumber)
BOOLEAN GetMicrocodePatchInfoFromHob(UINT64 *Address, UINT64 *RegionSize)
BOOLEAN CanUseSevSnpCreateAP(IN CPU_MP_DATA *CpuMpData)
VOID(EFIAPI * ASM_RELOCATE_AP_LOOP_GENERIC)(IN BOOLEAN MwaitSupport, IN UINTN ApTargetCState, IN UINTN TopOfApStack, IN UINTN NumberToFinish, IN UINTN Cr3)
EFI_STATUS SwitchBSPWorker(IN UINTN ProcessorNumber, IN BOOLEAN EnableOldBSP)
VOID SevEsPlaceApHlt(CPU_MP_DATA *CpuMpData)
UINTN AllocateCodeBuffer(IN UINTN BufferSize)
VOID FillExchangeInfoDataSevEs(IN volatile MP_CPU_EXCHANGE_INFO *ExchangeInfo)
UINTN CreatePageTable(IN UINTN Address, IN UINTN Length)
EFI_STATUS PlatformShadowMicrocode(IN OUT CPU_MP_DATA *CpuMpData)
UINTN GetSevEsAPMemory(VOID)
VOID SevSnpCreateSaveArea(IN CPU_MP_DATA *CpuMpData, IN CPU_AP_DATA *CpuData, UINT32 ApicId)
VOID(EFIAPI * EFI_AP_PROCEDURE)(IN OUT VOID *Buffer)
UINT64 EFI_PHYSICAL_ADDRESS