From: Jeff Fan Date: Wed, 2 Dec 2015 00:43:45 +0000 (+0000) Subject: UefiCpuPkg/CpuMpPei: Save/Restore CRx/DRx register for APs waking up X-Git-Tag: edk2-stable201903~8401 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=f40a7de45070dfa193e47ed0031cc07c275287b3 UefiCpuPkg/CpuMpPei: Save/Restore CRx/DRx register for APs waking up PeiStartupAllAPs()/PeiStartupThisAP() will send INIT-SIPI-SIPI to wakeup APs to execute AP function. However, some registers will be reset after APs received INIT IPI. We need to restore some registers (For example, CRx/DRx) manually after APs wakeup. Cc: Feng Tian Cc: Michael Kinney Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jeff Fan Reviewed-by: Feng Tian git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19089 6f19259b-4bc3-4df7-8a09-765794883524 --- diff --git a/UefiCpuPkg/CpuMpPei/CpuMpPei.c b/UefiCpuPkg/CpuMpPei/CpuMpPei.c index 53af9489b2..ca48613502 100644 --- a/UefiCpuPkg/CpuMpPei/CpuMpPei.c +++ b/UefiCpuPkg/CpuMpPei/CpuMpPei.c @@ -259,6 +259,11 @@ ApCFunction ( // Execute AP function if AP is not disabled // GetProcessorNumber (PeiCpuMpData, &ProcessorNumber); + // + // Restore AP's volatile registers saved + // + RestoreVolatileRegisters (&PeiCpuMpData->CpuData[ProcessorNumber].VolatileRegisters, TRUE); + if ((PeiCpuMpData->CpuData[ProcessorNumber].State != CpuStateDisabled) && (PeiCpuMpData->ApFunction != 0)) { PeiCpuMpData->CpuData[ProcessorNumber].State = CpuStateBusy; @@ -273,6 +278,11 @@ ApCFunction ( // InterlockedIncrement ((UINT32 *)&PeiCpuMpData->FinishedCount); + // + // Save AP volatile registers + // + SaveVolatileRegisters (&PeiCpuMpData->CpuData[ProcessorNumber].VolatileRegisters); + AsmCliHltLoop (); }