]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPkg/TimerDxe: Read timer frequency from CPU
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Wed, 10 Sep 2014 18:48:47 +0000 (18:48 +0000)
committeroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 10 Sep 2014 18:48:47 +0000 (18:48 +0000)
The PCD gArmTokenSpaceGuid.PcdArmArchTimerFreqInHz is used in the
SEC phase (if applicable) to write the platform's counter frequency
to the CNTFRQ system register, as this needs to be done by the highest
exception level implemented.

Under virtualization, we should be able to rely on the host to have
initialized this register to a sane value, as we run at EL1 and only
use the virtual timer, so the PcdArmArchTimerFreqInHz PCD has little
meaning here.

So in either case, by the time we enter the DXE phase, we can use the
CNTFRQ system register to read the frequency instead of looking at the
PCD.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Olivier Martin <olivier.martin@arm.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16090 6f19259b-4bc3-4df7-8a09-765794883524

ArmPkg/Drivers/TimerDxe/TimerDxe.c
ArmPkg/Drivers/TimerDxe/TimerDxe.inf

index 3e5d8e72be845d48edbfc503172a0e6060a2510d..2efe0fe4933aa37c3c6a85705dbcb7867fa2d6f6 100644 (file)
@@ -151,7 +151,7 @@ TimerDriverSetTimerPeriod (
     // mTimerTicks = TimerPeriod in 1ms unit x Frequency.10^-3\r
     //             = TimerPeriod.10^-4 x Frequency.10^-3\r
     //             = (TimerPeriod x Frequency) x 10^-7\r
-    TimerTicks = MultU64x32 (TimerPeriod, FixedPcdGet32 (PcdArmArchTimerFreqInHz));\r
+    TimerTicks = MultU64x32 (TimerPeriod, ArmGenericTimerGetTimerFreq ());\r
     TimerTicks = DivU64x32 (TimerTicks, 10000000U);\r
 \r
     // Raise TPL to update the mTimerTicks and mTimerPeriod to ensure these values\r
index 9e9768fbb56749b7a159adf018dacb4bdb6f5ded..3f345156c39709049aca1bcbe360dedf92b897f2 100644 (file)
@@ -55,7 +55,6 @@
   gArmTokenSpaceGuid.PcdArmArchTimerIntrNum\r
   gArmTokenSpaceGuid.PcdArmArchTimerVirtIntrNum\r
   gArmTokenSpaceGuid.PcdArmArchTimerHypIntrNum\r
-  gArmTokenSpaceGuid.PcdArmArchTimerFreqInHz\r
 \r
 [Depex]\r
   gHardwareInterruptProtocolGuid\r