UefiCpuPkg: Sync the init timer count instead of current timer count

BSP should save and sync to AP the init timer count instead of
current timer count.
Also, BSP can check the init timer count to know if the local apic
timer is enabled. Only sync the setting when it is enabled.

Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
This commit is contained in:
Zhiguang Liu 2024-05-28 11:22:10 +08:00 committed by mergify[bot]
parent 7033f359a9
commit 7fc08c68cd
2 changed files with 29 additions and 24 deletions

View File

@ -167,16 +167,19 @@ SaveLocalApicTimerSetting (
IN CPU_MP_DATA *CpuMpData IN CPU_MP_DATA *CpuMpData
) )
{ {
// CpuMpData->InitTimerCount = GetApicTimerInitCount ();
// Record the current local APIC timer setting of BSP if (CpuMpData->InitTimerCount != 0) {
// //
GetApicTimerState ( // Record the current local APIC timer setting of BSP
&CpuMpData->DivideValue, //
&CpuMpData->PeriodicMode, GetApicTimerState (
&CpuMpData->Vector &CpuMpData->DivideValue,
); &CpuMpData->PeriodicMode,
CpuMpData->CurrentTimerCount = GetApicTimerCurrentCount (); &CpuMpData->Vector
CpuMpData->TimerInterruptState = GetApicTimerInterruptState (); );
CpuMpData->TimerInterruptState = GetApicTimerInterruptState ();
}
} }
/** /**
@ -189,19 +192,21 @@ SyncLocalApicTimerSetting (
IN CPU_MP_DATA *CpuMpData IN CPU_MP_DATA *CpuMpData
) )
{ {
// if (CpuMpData->InitTimerCount != 0) {
// Sync local APIC timer setting from BSP to AP //
// // Sync local APIC timer setting from BSP to AP
InitializeApicTimer ( //
CpuMpData->DivideValue, InitializeApicTimer (
CpuMpData->CurrentTimerCount, CpuMpData->DivideValue,
CpuMpData->PeriodicMode, CpuMpData->InitTimerCount,
CpuMpData->Vector CpuMpData->PeriodicMode,
); CpuMpData->Vector
// );
// Disable AP's local APIC timer interrupt //
// // Disable AP's local APIC timer interrupt
DisableApicTimerInterrupt (); //
DisableApicTimerInterrupt ();
}
} }
/** /**

View File

@ -289,7 +289,7 @@ struct _CPU_MP_DATA {
CPU_AP_DATA *CpuData; CPU_AP_DATA *CpuData;
volatile MP_CPU_EXCHANGE_INFO *MpCpuExchangeInfo; volatile MP_CPU_EXCHANGE_INFO *MpCpuExchangeInfo;
UINT32 CurrentTimerCount; UINT32 InitTimerCount;
UINTN DivideValue; UINTN DivideValue;
UINT8 Vector; UINT8 Vector;
BOOLEAN PeriodicMode; BOOLEAN PeriodicMode;