summaryrefslogtreecommitdiffstats
path: root/UefiCpuPkg/Library
diff options
context:
space:
mode:
authorZhiguang Liu <zhiguang.liu@intel.com>2024-05-28 11:22:10 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2024-07-24 02:47:34 +0000
commit7fc08c68cd64ccf30e4d46d1a60fcdd61b31f1ec (patch)
tree4ba0257010b201ea7f28207dd9eb778d2b4aac15 /UefiCpuPkg/Library
parent7033f359a99121fd2c3fefe03d9f0c64e8bfaa10 (diff)
downloadedk2-7fc08c68cd64ccf30e4d46d1a60fcdd61b31f1ec.tar.gz
edk2-7fc08c68cd64ccf30e4d46d1a60fcdd61b31f1ec.tar.bz2
edk2-7fc08c68cd64ccf30e4d46d1a60fcdd61b31f1ec.zip
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>
Diffstat (limited to 'UefiCpuPkg/Library')
-rw-r--r--UefiCpuPkg/Library/MpInitLib/MpLib.c51
-rw-r--r--UefiCpuPkg/Library/MpInitLib/MpLib.h2
2 files changed, 29 insertions, 24 deletions
diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpInitLib/MpLib.c
index 69c53c6228..5cbcef70e8 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
@@ -167,16 +167,19 @@ SaveLocalApicTimerSetting (
IN CPU_MP_DATA *CpuMpData
)
{
- //
- // Record the current local APIC timer setting of BSP
- //
- GetApicTimerState (
- &CpuMpData->DivideValue,
- &CpuMpData->PeriodicMode,
- &CpuMpData->Vector
- );
- CpuMpData->CurrentTimerCount = GetApicTimerCurrentCount ();
- CpuMpData->TimerInterruptState = GetApicTimerInterruptState ();
+ CpuMpData->InitTimerCount = GetApicTimerInitCount ();
+ if (CpuMpData->InitTimerCount != 0) {
+ //
+ // Record the current local APIC timer setting of BSP
+ //
+ GetApicTimerState (
+ &CpuMpData->DivideValue,
+ &CpuMpData->PeriodicMode,
+ &CpuMpData->Vector
+ );
+
+ CpuMpData->TimerInterruptState = GetApicTimerInterruptState ();
+ }
}
/**
@@ -189,19 +192,21 @@ SyncLocalApicTimerSetting (
IN CPU_MP_DATA *CpuMpData
)
{
- //
- // Sync local APIC timer setting from BSP to AP
- //
- InitializeApicTimer (
- CpuMpData->DivideValue,
- CpuMpData->CurrentTimerCount,
- CpuMpData->PeriodicMode,
- CpuMpData->Vector
- );
- //
- // Disable AP's local APIC timer interrupt
- //
- DisableApicTimerInterrupt ();
+ if (CpuMpData->InitTimerCount != 0) {
+ //
+ // Sync local APIC timer setting from BSP to AP
+ //
+ InitializeApicTimer (
+ CpuMpData->DivideValue,
+ CpuMpData->InitTimerCount,
+ CpuMpData->PeriodicMode,
+ CpuMpData->Vector
+ );
+ //
+ // Disable AP's local APIC timer interrupt
+ //
+ DisableApicTimerInterrupt ();
+ }
}
/**
diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.h b/UefiCpuPkg/Library/MpInitLib/MpLib.h
index 88b31fecca..8742fa175b 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.h
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.h
@@ -289,7 +289,7 @@ struct _CPU_MP_DATA {
CPU_AP_DATA *CpuData;
volatile MP_CPU_EXCHANGE_INFO *MpCpuExchangeInfo;
- UINT32 CurrentTimerCount;
+ UINT32 InitTimerCount;
UINTN DivideValue;
UINT8 Vector;
BOOLEAN PeriodicMode;