summaryrefslogtreecommitdiff
path: root/OvmfPkg/LocalApicTimerDxe
diff options
context:
space:
mode:
authorMin Xu <min.m.xu@intel.com>2021-10-26 13:37:11 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2022-04-02 08:15:12 +0000
commitc37cbc030d96631b3c795a1b4fdae7daece2499c (patch)
treec3359b9fab05ca31ffcc41530b533226403ba9ec /OvmfPkg/LocalApicTimerDxe
parent299c44cd4f53fe7493e7dad283f60e184f90b0b9 (diff)
downloadedk2-c37cbc030d96631b3c795a1b4fdae7daece2499c.zip
edk2-c37cbc030d96631b3c795a1b4fdae7daece2499c.tar.gz
edk2-c37cbc030d96631b3c795a1b4fdae7daece2499c.tar.bz2
OvmfPkg: Switch timer in build time for OvmfPkg
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3711 Discussion in https://bugzilla.tianocore.org/show_bug.cgi?id=1496 shows that 8254TimerDxe was not written for OVMF. It was moved over from PcAtChipsetPkg to OvmfPkg in 2019. Probably because OVMF was the only user left. Most likely the reason OVMF used 8254TimerDxe initially was that it could just use the existing driver in PcAtChipsetPkg. And it simply hasn't been changed ever. CSM support was moved in 2019 too. (CSM support depends on 8254/8259 drivers). So 8254TimerDxe will be used when CSM_ENABLE=TRUE. There are 4 .dsc which include the 8254Timer. - OvmfPkg/AmdSev/AmdSevX64.dsc - OvmfPkg/OvmfPkgIa32.dsc - OvmfPkg/OvmfPkgIa32X64.dsc - OvmfPkg/OvmfPkgX64.dsc For the three OvmfPkg* configs using 8254TimerDxe with CSM_ENABLE=TRUE and LapicTimerDxe otherwise. For the AmdSev config it doesn't make sense to support a CSM. So use the lapic timer unconditionally. Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Jordan Justen <jordan.l.justen@intel.com> Cc: Brijesh Singh <brijesh.singh@amd.com> Cc: Erdem Aktas <erdemaktas@google.com> Cc: James Bottomley <jejb@linux.ibm.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Tom Lendacky <thomas.lendacky@amd.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Suggested-by: Gerd Hoffmann <kraxel@redhat.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com> Signed-off-by: Min Xu <min.m.xu@intel.com>
Diffstat (limited to 'OvmfPkg/LocalApicTimerDxe')
-rw-r--r--OvmfPkg/LocalApicTimerDxe/LocalApicTimerDxe.c2
-rw-r--r--OvmfPkg/LocalApicTimerDxe/LocalApicTimerDxe.inf1
2 files changed, 2 insertions, 1 deletions
diff --git a/OvmfPkg/LocalApicTimerDxe/LocalApicTimerDxe.c b/OvmfPkg/LocalApicTimerDxe/LocalApicTimerDxe.c
index dd9352b..cbc17c9 100644
--- a/OvmfPkg/LocalApicTimerDxe/LocalApicTimerDxe.c
+++ b/OvmfPkg/LocalApicTimerDxe/LocalApicTimerDxe.c
@@ -174,7 +174,7 @@ TimerDriverSetTimerPeriod (
//
DisableApicTimerInterrupt ();
} else {
- TimerFrequency = PcdGet32 (PcdFSBClock) / DivideValue;
+ TimerFrequency = PcdGet32 (PcdFSBClock) / (UINT32)DivideValue;
//
// Convert TimerPeriod into local APIC counts
diff --git a/OvmfPkg/LocalApicTimerDxe/LocalApicTimerDxe.inf b/OvmfPkg/LocalApicTimerDxe/LocalApicTimerDxe.inf
index 63b75b7..3ad28a1 100644
--- a/OvmfPkg/LocalApicTimerDxe/LocalApicTimerDxe.inf
+++ b/OvmfPkg/LocalApicTimerDxe/LocalApicTimerDxe.inf
@@ -1,5 +1,6 @@
## @file
# Local APIC timer driver that provides Timer Arch protocol.
+# PcdFSBClock is defined in MdePkg and it should be set by the consumer.
#
# Copyright (c) 2005 - 2019, Intel Corporation. All rights reserved.<BR>
# Copyright (c) 2019, Citrix Systems, Inc.