diff options
author | Ard Biesheuvel <ard.biesheuvel@linaro.org> | 2014-09-09 16:10:18 +0000 |
---|---|---|
committer | oliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524> | 2014-09-09 16:10:18 +0000 |
commit | 4f6d34b434c0f063c68bdd4445da9097358b9afc (patch) | |
tree | dca84d7173f6b2dce31edbd1022f151d68d276fe /ArmPkg/Library | |
parent | 2785509b57d9ff92321c1083aab4a5ffc9519961 (diff) | |
download | edk2-platforms-4f6d34b434c0f063c68bdd4445da9097358b9afc.tar.xz |
ArmPkg: Move TimerDxe and ArmArchTimerLib to new ArmGenericTimerCounterLib
Move TimerDxe and ArmArchTimerLib to ArmGenericTimerCounterLib, and update all
platforms to select the physical counter instance they have been using
implicitly all along.
Contributed-under: TianoCore Contribution Agreement 1.0
Acked-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-By: Olivier Martin <olivier.martin@arm.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16078 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ArmPkg/Library')
-rw-r--r-- | ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.c | 14 | ||||
-rw-r--r-- | ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.inf | 1 | ||||
-rw-r--r-- | ArmPkg/Library/ArmLib/AArch64/AArch64ArchTimer.c | 107 | ||||
-rw-r--r-- | ArmPkg/Library/ArmLib/ArmV7/ArmV7ArchTimer.c | 107 |
4 files changed, 8 insertions, 221 deletions
diff --git a/ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.c b/ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.c index ec4c39dbc9..5d8e006cc9 100644 --- a/ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.c +++ b/ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.c @@ -20,7 +20,7 @@ #include <Library/TimerLib.h>
#include <Library/DebugLib.h>
#include <Library/PcdLib.h>
-#include <Library/ArmArchTimer.h>
+#include <Library/ArmGenericTimerCounterLib.h>
#define TICKS_PER_MICRO_SEC (PcdGet32 (PcdArmArchTimerFreqInHz)/1000000U)
@@ -47,13 +47,13 @@ TimerConstructor ( // Only set the frequency for ARMv7. We expect the secure firmware to have already do it
// If the security extensions are not implemented set Timer Frequency
if ((ArmReadIdPfr1 () & ARM_PFR1_SEC) == 0x0) {
- ArmArchTimerSetTimerFreq (PcdGet32 (PcdArmArchTimerFreqInHz));
+ ArmGenericTimerSetTimerFreq (PcdGet32 (PcdArmArchTimerFreqInHz));
}
#endif
// Architectural Timer Frequency must be set in the Secure privileged(if secure extensions are supported) mode.
// If the reset value (0) is returned just ASSERT.
- TimerFreq = ArmArchTimerGetTimerFreq ();
+ TimerFreq = ArmGenericTimerGetTimerFreq ();
ASSERT (TimerFreq != 0);
} else {
@@ -88,13 +88,13 @@ MicroSecondDelay ( TimerTicks64 = (MicroSeconds * PcdGet32 (PcdArmArchTimerFreqInHz)) / 1000000U;
// Read System Counter value
- SystemCounterVal = ArmArchTimerGetSystemCount ();
+ SystemCounterVal = ArmGenericTimerGetSystemCount ();
TimerTicks64 += SystemCounterVal;
// Wait until delay count is expired.
while (SystemCounterVal < TimerTicks64) {
- SystemCounterVal = ArmArchTimerGetSystemCount ();
+ SystemCounterVal = ArmGenericTimerGetSystemCount ();
}
return MicroSeconds;
@@ -149,7 +149,7 @@ GetPerformanceCounter ( )
{
// Just return the value of system count
- return ArmArchTimerGetSystemCount ();
+ return ArmGenericTimerGetSystemCount ();
}
/**
@@ -192,5 +192,5 @@ GetPerformanceCounterProperties ( *EndValue = 0xFFFFFFFFFFFFFFFFUL;
}
- return (UINT64)ArmArchTimerGetTimerFreq ();
+ return (UINT64)ArmGenericTimerGetTimerFreq ();
}
diff --git a/ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.inf b/ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.inf index ecdf0837f1..03a4b1efa6 100644 --- a/ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.inf +++ b/ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.inf @@ -32,6 +32,7 @@ DebugLib
ArmLib
BaseLib
+ ArmGenericTimerCounterLib
[Pcd]
gArmTokenSpaceGuid.PcdArmArchTimerFreqInHz
diff --git a/ArmPkg/Library/ArmLib/AArch64/AArch64ArchTimer.c b/ArmPkg/Library/ArmLib/AArch64/AArch64ArchTimer.c index 6a461eb2e4..63ce1978c0 100644 --- a/ArmPkg/Library/ArmLib/AArch64/AArch64ArchTimer.c +++ b/ArmPkg/Library/ArmLib/AArch64/AArch64ArchTimer.c @@ -166,110 +166,3 @@ ArmArchTimerWriteReg ( ASSERT (0);
}
}
-
-VOID
-EFIAPI
-ArmArchTimerEnableTimer (
- VOID
- )
-{
- UINTN TimerCtrlReg;
-
- ArmArchTimerReadReg (CntpCtl, (VOID *)&TimerCtrlReg);
- TimerCtrlReg |= ARM_ARCH_TIMER_ENABLE;
- ArmArchTimerWriteReg (CntpCtl, (VOID *)&TimerCtrlReg);
-}
-
-VOID
-EFIAPI
-ArmArchTimerDisableTimer (
- VOID
- )
-{
- UINTN TimerCtrlReg;
-
- ArmArchTimerReadReg (CntpCtl, (VOID *)&TimerCtrlReg);
- TimerCtrlReg &= ~ARM_ARCH_TIMER_ENABLE;
- ArmArchTimerWriteReg (CntpCtl, (VOID *)&TimerCtrlReg);
-}
-
-VOID
-EFIAPI
-ArmArchTimerSetTimerFreq (
- IN UINTN FreqInHz
- )
-{
- ArmArchTimerWriteReg (CntFrq, (VOID *)&FreqInHz);
-}
-
-UINTN
-EFIAPI
-ArmArchTimerGetTimerFreq (
- VOID
- )
-{
- UINTN ArchTimerFreq = 0;
- ArmArchTimerReadReg (CntFrq, (VOID *)&ArchTimerFreq);
- return ArchTimerFreq;
-}
-
-UINTN
-EFIAPI
-ArmArchTimerGetTimerVal (
- VOID
- )
-{
- UINTN ArchTimerVal;
- ArmArchTimerReadReg (CntpTval, (VOID *)&ArchTimerVal);
- return ArchTimerVal;
-}
-
-
-VOID
-EFIAPI
-ArmArchTimerSetTimerVal (
- IN UINTN Val
- )
-{
- ArmArchTimerWriteReg (CntpTval, (VOID *)&Val);
-}
-
-UINT64
-EFIAPI
-ArmArchTimerGetSystemCount (
- VOID
- )
-{
- UINT64 SystemCount;
- ArmArchTimerReadReg (CntPct, (VOID *)&SystemCount);
- return SystemCount;
-}
-
-UINTN
-EFIAPI
-ArmArchTimerGetTimerCtrlReg (
- VOID
- )
-{
- UINTN Val;
- ArmArchTimerReadReg (CntpCtl, (VOID *)&Val);
- return Val;
-}
-
-VOID
-EFIAPI
-ArmArchTimerSetTimerCtrlReg (
- UINTN Val
- )
-{
- ArmArchTimerWriteReg (CntpCtl, (VOID *)&Val);
-}
-
-VOID
-EFIAPI
-ArmArchTimerSetCompareVal (
- IN UINT64 Val
- )
-{
- ArmArchTimerWriteReg (CntpCval, (VOID *)&Val);
-}
diff --git a/ArmPkg/Library/ArmLib/ArmV7/ArmV7ArchTimer.c b/ArmPkg/Library/ArmLib/ArmV7/ArmV7ArchTimer.c index bebdafce7d..49be71bbe0 100644 --- a/ArmPkg/Library/ArmLib/ArmV7/ArmV7ArchTimer.c +++ b/ArmPkg/Library/ArmLib/ArmV7/ArmV7ArchTimer.c @@ -166,110 +166,3 @@ ArmArchTimerWriteReg ( ASSERT (0);
}
}
-
-VOID
-EFIAPI
-ArmArchTimerEnableTimer (
- VOID
- )
-{
- UINTN TimerCtrlReg;
-
- ArmArchTimerReadReg (CntpCtl, (VOID *)&TimerCtrlReg);
- TimerCtrlReg |= ARM_ARCH_TIMER_ENABLE;
- ArmArchTimerWriteReg (CntpCtl, (VOID *)&TimerCtrlReg);
-}
-
-VOID
-EFIAPI
-ArmArchTimerDisableTimer (
- VOID
- )
-{
- UINTN TimerCtrlReg;
-
- ArmArchTimerReadReg (CntpCtl, (VOID *)&TimerCtrlReg);
- TimerCtrlReg &= ~ARM_ARCH_TIMER_ENABLE;
- ArmArchTimerWriteReg (CntpCtl, (VOID *)&TimerCtrlReg);
-}
-
-VOID
-EFIAPI
-ArmArchTimerSetTimerFreq (
- IN UINTN FreqInHz
- )
-{
- ArmArchTimerWriteReg (CntFrq, (VOID *)&FreqInHz);
-}
-
-UINTN
-EFIAPI
-ArmArchTimerGetTimerFreq (
- VOID
- )
-{
- UINTN ArchTimerFreq;
- ArmArchTimerReadReg (CntFrq, (VOID *)&ArchTimerFreq);
- return ArchTimerFreq;
-}
-
-UINTN
-EFIAPI
-ArmArchTimerGetTimerVal (
- VOID
- )
-{
- UINTN ArchTimerVal;
- ArmArchTimerReadReg (CntpTval, (VOID *)&ArchTimerVal);
- return ArchTimerVal;
-}
-
-
-VOID
-EFIAPI
-ArmArchTimerSetTimerVal (
- IN UINTN Val
- )
-{
- ArmArchTimerWriteReg (CntpTval, (VOID *)&Val);
-}
-
-UINT64
-EFIAPI
-ArmArchTimerGetSystemCount (
- VOID
- )
-{
- UINT64 SystemCount;
- ArmArchTimerReadReg (CntPct, (VOID *)&SystemCount);
- return SystemCount;
-}
-
-UINTN
-EFIAPI
-ArmArchTimerGetTimerCtrlReg (
- VOID
- )
-{
- UINTN Val;
- ArmArchTimerReadReg (CntpCtl, (VOID *)&Val);
- return Val;
-}
-
-VOID
-EFIAPI
-ArmArchTimerSetTimerCtrlReg (
- UINTN Val
- )
-{
- ArmArchTimerWriteReg (CntpCtl, (VOID *)&Val);
-}
-
-VOID
-EFIAPI
-ArmArchTimerSetCompareVal (
- IN UINT64 Val
- )
-{
- ArmArchTimerWriteReg (CntpCval, (VOID *)&Val);
-}
|