WAKEUP_AP_SIGNAL,\r
0\r
);\r
- if (CpuMpData->ApLoopMode == ApInHltLoop) {\r
- //\r
- // Restore AP's volatile registers saved\r
- //\r
- RestoreVolatileRegisters (&CpuMpData->CpuData[ProcessorNumber].VolatileRegisters, TRUE);\r
- } else {\r
+\r
+ if (CpuMpData->InitFlag == ApInitReconfig) {\r
//\r
- // The CPU driver might not flush TLB for APs on spot after updating\r
- // page attributes. AP in mwait loop mode needs to take care of it when\r
- // woken up.\r
+ // ApInitReconfig happens when:\r
+ // 1. AP is re-enabled after it's disabled, in either PEI or DXE phase.\r
+ // 2. AP is initialized in DXE phase.\r
+ // In either case, use the volatile registers value derived from BSP.\r
+ // NOTE: IDTR.BASE stored in CpuMpData->CpuData[0].VolatileRegisters points to a\r
+ // different IDT shared by all APs.\r
//\r
- CpuFlushTlb ();\r
+ RestoreVolatileRegisters (&CpuMpData->CpuData[0].VolatileRegisters, FALSE);\r
+ } else {\r
+ if (CpuMpData->ApLoopMode == ApInHltLoop) {\r
+ //\r
+ // Restore AP's volatile registers saved before AP is halted\r
+ //\r
+ RestoreVolatileRegisters (&CpuMpData->CpuData[ProcessorNumber].VolatileRegisters, TRUE);\r
+ } else {\r
+ //\r
+ // The CPU driver might not flush TLB for APs on spot after updating\r
+ // page attributes. AP in mwait loop mode needs to take care of it when\r
+ // woken up.\r
+ //\r
+ CpuFlushTlb ();\r
+ }\r
}\r
\r
if (GetApState (&CpuMpData->CpuData[ProcessorNumber]) == CpuStateReady) {\r
InitializeSpinLock(&CpuMpData->CpuData[Index].ApLock);\r
CpuMpData->CpuData[Index].CpuHealthy = (CpuInfoInHob[Index].Health == 0)? TRUE:FALSE;\r
CpuMpData->CpuData[Index].ApFunction = 0;\r
- CopyMem (&CpuMpData->CpuData[Index].VolatileRegisters, &VolatileRegisters, sizeof (CPU_VOLATILE_REGISTERS));\r
}\r
}\r
\r