Skip to content

Commit

Permalink
ArmPkg: delete PcdArmArchTimerFreqInHz
Browse files Browse the repository at this point in the history
PcdArmArchTimerFreqInHz lets platforms override the architectural timer
frequency, but this really isn't supported in hardware by anything lower
than EL3. And we no longer support running edk2 at EL3.

So drop this Pcd and update ArmArchTimerLib to unconditionally use
ArmGenericTimerGetTimerFreq () instead.

Signed-off-by: Leif Lindholm <quic_llindhol@quicinc.com>
  • Loading branch information
leiflindholm authored and mergify[bot] committed Jun 26, 2024
1 parent 7ee8945 commit 0333faf
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 24 deletions.
5 changes: 0 additions & 5 deletions ArmPkg/ArmPkg.dec
Original file line number Diff line number Diff line change
Expand Up @@ -314,11 +314,6 @@
gArmTokenSpaceGuid.PcdEmbeddedControllerFirmwareRelease|0xFFFF|UINT16|0x30000059

[PcdsFixedAtBuild.common, PcdsDynamic.common]
#
# ARM Architectural Timer
#
gArmTokenSpaceGuid.PcdArmArchTimerFreqInHz|0|UINT32|0x00000034

# ARM Architectural Timer Interrupt(GIC PPI) numbers
gArmTokenSpaceGuid.PcdArmArchTimerSecIntrNum|29|UINT32|0x00000035
gArmTokenSpaceGuid.PcdArmArchTimerIntrNum|30|UINT32|0x00000036
Expand Down
20 changes: 2 additions & 18 deletions ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include <Library/PcdLib.h>
#include <Library/ArmGenericTimerCounterLib.h>

#define TICKS_PER_MICRO_SEC (PcdGet32 (PcdArmArchTimerFreqInHz)/1000000U)
#define TICKS_PER_MICRO_SEC (ArmGenericTimerGetTimerFreq ()/1000000U)

// Select appropriate multiply function for platform architecture.
#ifdef MDE_CPU_ARM
Expand All @@ -34,19 +34,6 @@ TimerConstructor (
// Check if the ARM Generic Timer Extension is implemented.
//
if (ArmIsArchTimerImplemented ()) {
//
// Check if Architectural Timer frequency is pre-determined by the platform
// (ie. nonzero).
//
if (PcdGet32 (PcdArmArchTimerFreqInHz) != 0) {
//
// Check if ticks/uS is not 0. The Architectural timer runs at constant
// frequency, irrespective of CPU frequency. According to Generic Timer
// Ref manual, lower bound of the frequency is in the range of 1-10MHz.
//
ASSERT (TICKS_PER_MICRO_SEC);
}

//
// Architectural Timer Frequency must be set in Secure privileged
// mode (if secure extension is supported).
Expand Down Expand Up @@ -76,10 +63,7 @@ GetPlatformTimerFreq (
{
UINTN TimerFreq;

TimerFreq = PcdGet32 (PcdArmArchTimerFreqInHz);
if (TimerFreq == 0) {
TimerFreq = ArmGenericTimerGetTimerFreq ();
}
TimerFreq = ArmGenericTimerGetTimerFreq ();

return TimerFreq;
}
Expand Down
1 change: 0 additions & 1 deletion ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.inf
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,3 @@
ArmGenericTimerCounterLib

[Pcd]
gArmTokenSpaceGuid.PcdArmArchTimerFreqInHz

0 comments on commit 0333faf

Please sign in to comment.