summaryrefslogtreecommitdiff
path: root/ArmPkg/Drivers
diff options
context:
space:
mode:
authorArd Biesheuvel <ard.biesheuvel@linaro.org>2014-09-09 16:10:18 +0000
committeroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>2014-09-09 16:10:18 +0000
commit4f6d34b434c0f063c68bdd4445da9097358b9afc (patch)
treedca84d7173f6b2dce31edbd1022f151d68d276fe /ArmPkg/Drivers
parent2785509b57d9ff92321c1083aab4a5ffc9519961 (diff)
downloadedk2-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/Drivers')
-rw-r--r--ArmPkg/Drivers/ArmCpuLib/ArmCortexA15Lib/ArmCortexA15Lib.c5
-rw-r--r--ArmPkg/Drivers/ArmCpuLib/ArmCortexA15Lib/ArmCortexA15Lib.inf4
-rw-r--r--ArmPkg/Drivers/ArmCpuLib/ArmCortexA5xLib/ArmCortexA5xLib.c5
-rw-r--r--ArmPkg/Drivers/ArmCpuLib/ArmCortexA5xLib/ArmCortexA5xLib.inf2
-rw-r--r--ArmPkg/Drivers/ArmCpuLib/ArmCortexAEMv8Lib/ArmCortexAEMv8Lib.c4
-rw-r--r--ArmPkg/Drivers/ArmCpuLib/ArmCortexAEMv8Lib/ArmCortexAEMv8Lib.inf3
-rw-r--r--ArmPkg/Drivers/TimerDxe/TimerDxe.c27
-rw-r--r--ArmPkg/Drivers/TimerDxe/TimerDxe.inf1
8 files changed, 25 insertions, 26 deletions
diff --git a/ArmPkg/Drivers/ArmCpuLib/ArmCortexA15Lib/ArmCortexA15Lib.c b/ArmPkg/Drivers/ArmCpuLib/ArmCortexA15Lib/ArmCortexA15Lib.c
index 585695a7dd..a1678febc4 100644
--- a/ArmPkg/Drivers/ArmCpuLib/ArmCortexA15Lib/ArmCortexA15Lib.c
+++ b/ArmPkg/Drivers/ArmCpuLib/ArmCortexA15Lib/ArmCortexA15Lib.c
@@ -15,9 +15,8 @@
#include <Base.h>
#include <Library/ArmLib.h>
#include <Library/ArmCpuLib.h>
-#include <Library/ArmArchTimer.h>
+#include <Library/ArmGenericTimerCounterLib.h>
#include <Library/DebugLib.h>
-#include <Library/IoLib.h>
#include <Library/PcdLib.h>
#include <Chipset/ArmCortexA15.h>
@@ -39,7 +38,7 @@ ArmCpuSetup (
// Note: System Counter frequency can only be set in Secure privileged mode,
// if security extensions are implemented.
- ArmArchTimerSetTimerFreq (PcdGet32 (PcdArmArchTimerFreqInHz));
+ ArmGenericTimerSetTimerFreq (PcdGet32 (PcdArmArchTimerFreqInHz));
if (ArmIsMpCore()) {
// Turn on SMP coherency
diff --git a/ArmPkg/Drivers/ArmCpuLib/ArmCortexA15Lib/ArmCortexA15Lib.inf b/ArmPkg/Drivers/ArmCpuLib/ArmCortexA15Lib/ArmCortexA15Lib.inf
index ed4bdc377d..bd9a733b46 100644
--- a/ArmPkg/Drivers/ArmCpuLib/ArmCortexA15Lib/ArmCortexA15Lib.inf
+++ b/ArmPkg/Drivers/ArmCpuLib/ArmCortexA15Lib/ArmCortexA15Lib.inf
@@ -1,5 +1,5 @@
#/* @file
-# Copyright (c) 2011-2012, ARM Limited. All rights reserved.
+# Copyright (c) 2011-2014, ARM Limited. All rights reserved.
#
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
@@ -25,7 +25,7 @@
[LibraryClasses]
ArmLib
- IoLib
+ ArmGenericTimerCounterLib
PcdLib
[Sources.common]
diff --git a/ArmPkg/Drivers/ArmCpuLib/ArmCortexA5xLib/ArmCortexA5xLib.c b/ArmPkg/Drivers/ArmCpuLib/ArmCortexA5xLib/ArmCortexA5xLib.c
index 97f1ced413..135bd6b86d 100644
--- a/ArmPkg/Drivers/ArmCpuLib/ArmCortexA5xLib/ArmCortexA5xLib.c
+++ b/ArmPkg/Drivers/ArmCpuLib/ArmCortexA5xLib/ArmCortexA5xLib.c
@@ -15,9 +15,8 @@
#include <Base.h>
#include <Library/ArmLib.h>
#include <Library/ArmCpuLib.h>
-#include <Library/ArmArchTimer.h>
+#include <Library/ArmGenericTimerCounterLib.h>
#include <Library/DebugLib.h>
-#include <Library/IoLib.h>
#include <Library/PcdLib.h>
#include <Chipset/ArmCortexA5x.h>
@@ -33,7 +32,7 @@ ArmCpuSetup (
// Note: System Counter frequency can only be set in Secure privileged mode,
// if security extensions are implemented.
- ArmArchTimerSetTimerFreq (PcdGet32 (PcdArmArchTimerFreqInHz));
+ ArmGenericTimerSetTimerFreq (PcdGet32 (PcdArmArchTimerFreqInHz));
if (ArmIsMpCore ()) {
// Turn on SMP coherency
diff --git a/ArmPkg/Drivers/ArmCpuLib/ArmCortexA5xLib/ArmCortexA5xLib.inf b/ArmPkg/Drivers/ArmCpuLib/ArmCortexA5xLib/ArmCortexA5xLib.inf
index acfa98d41d..e270220326 100644
--- a/ArmPkg/Drivers/ArmCpuLib/ArmCortexA5xLib/ArmCortexA5xLib.inf
+++ b/ArmPkg/Drivers/ArmCpuLib/ArmCortexA5xLib/ArmCortexA5xLib.inf
@@ -25,7 +25,7 @@
[LibraryClasses]
ArmLib
- IoLib
+ ArmGenericTimerCounterLib
PcdLib
[Sources.common]
diff --git a/ArmPkg/Drivers/ArmCpuLib/ArmCortexAEMv8Lib/ArmCortexAEMv8Lib.c b/ArmPkg/Drivers/ArmCpuLib/ArmCortexAEMv8Lib/ArmCortexAEMv8Lib.c
index 3e7fa124ce..9b1815f8f2 100644
--- a/ArmPkg/Drivers/ArmCpuLib/ArmCortexAEMv8Lib/ArmCortexAEMv8Lib.c
+++ b/ArmPkg/Drivers/ArmCpuLib/ArmCortexAEMv8Lib/ArmCortexAEMv8Lib.c
@@ -14,7 +14,7 @@
#include <Base.h>
#include <Library/ArmCpuLib.h>
-#include <Library/ArmArchTimer.h>
+#include <Library/ArmGenericTimerCounterLib.h>
#include <Library/PcdLib.h>
#include <Chipset/ArmAemV8.h>
@@ -26,7 +26,7 @@ ArmCpuSetup (
{
// Note: System Counter frequency can only be set in Secure privileged mode,
// if security extensions are implemented.
- ArmArchTimerSetTimerFreq (PcdGet32 (PcdArmArchTimerFreqInHz));
+ ArmGenericTimerSetTimerFreq (PcdGet32 (PcdArmArchTimerFreqInHz));
}
diff --git a/ArmPkg/Drivers/ArmCpuLib/ArmCortexAEMv8Lib/ArmCortexAEMv8Lib.inf b/ArmPkg/Drivers/ArmCpuLib/ArmCortexAEMv8Lib/ArmCortexAEMv8Lib.inf
index 0109cc53a3..1c8122082d 100644
--- a/ArmPkg/Drivers/ArmCpuLib/ArmCortexAEMv8Lib/ArmCortexAEMv8Lib.inf
+++ b/ArmPkg/Drivers/ArmCpuLib/ArmCortexAEMv8Lib/ArmCortexAEMv8Lib.inf
@@ -24,8 +24,7 @@
ArmPkg/ArmPkg.dec
[LibraryClasses]
- ArmLib
- IoLib
+ ArmGenericTimerCounterLib
PcdLib
[Sources.common]
diff --git a/ArmPkg/Drivers/TimerDxe/TimerDxe.c b/ArmPkg/Drivers/TimerDxe/TimerDxe.c
index 239a353269..3e5d8e72be 100644
--- a/ArmPkg/Drivers/TimerDxe/TimerDxe.c
+++ b/ArmPkg/Drivers/TimerDxe/TimerDxe.c
@@ -24,6 +24,7 @@
#include <Library/UefiLib.h>
#include <Library/PcdLib.h>
#include <Library/IoLib.h>
+#include <Library/ArmGenericTimerCounterLib.h>
#include <Library/ArmArchTimer.h>
#include <Protocol/Timer.h>
@@ -101,7 +102,7 @@ ExitBootServicesEvent (
IN VOID *Context
)
{
- ArmArchTimerDisableTimer ();
+ ArmGenericTimerDisableTimer ();
}
/**
@@ -144,7 +145,7 @@ TimerDriverSetTimerPeriod (
EFI_TPL OriginalTPL;
// Always disable the timer
- ArmArchTimerDisableTimer ();
+ ArmGenericTimerDisableTimer ();
if (TimerPeriod != 0) {
// mTimerTicks = TimerPeriod in 1ms unit x Frequency.10^-3
@@ -163,13 +164,13 @@ TimerDriverSetTimerPeriod (
gBS->RestoreTPL (OriginalTPL);
- // Get value of the current physical timer
- CounterValue = ArmReadCntPct ();
+ // Get value of the current timer
+ CounterValue = ArmGenericTimerGetSystemCount ();
// Set the interrupt in Current Time + mTimerTick
- ArmWriteCntpCval (CounterValue + mTimerTicks);
+ ArmGenericTimerSetCompareVal (CounterValue + mTimerTicks);
// Enable the timer
- ArmArchTimerEnableTimer ();
+ ArmGenericTimerEnableTimer ();
} else {
// Save the new timer period
mTimerPeriod = TimerPeriod;
@@ -307,7 +308,7 @@ TimerInterruptHandler (
OriginalTPL = gBS->RaiseTPL (TPL_HIGH_LEVEL);
// Check if the timer interrupt is active
- if ((ArmArchTimerGetTimerCtrlReg () ) & ARM_ARCH_TIMER_ISTATUS) {
+ if ((ArmGenericTimerGetTimerCtrlReg () ) & ARM_ARCH_TIMER_ISTATUS) {
// Signal end of interrupt early to help avoid losing subsequent ticks from long duration handlers
gInterrupt->EndOfInterrupt (gInterrupt, Source);
@@ -321,9 +322,9 @@ TimerInterruptHandler (
//
// Get current counter value
- CurrentValue = ArmReadCntPct ();
+ CurrentValue = ArmGenericTimerGetSystemCount ();
// Get the counter value to compare with
- CompareValue = ArmReadCntpCval ();
+ CompareValue = ArmGenericTimerGetCompareVal ();
// This loop is needed in case we missed interrupts (eg: case when the interrupt handling
// has taken longer than mTickPeriod).
@@ -335,7 +336,7 @@ TimerInterruptHandler (
} while (CompareValue < CurrentValue);
// Set next compare value
- ArmWriteCntpCval (CompareValue);
+ ArmGenericTimerSetCompareVal (CompareValue);
}
// Enable timer interrupts
@@ -379,10 +380,10 @@ TimerInitialize (
ASSERT_EFI_ERROR (Status);
// Disable the timer
- TimerCtrlReg = ArmArchTimerGetTimerCtrlReg ();
+ TimerCtrlReg = ArmGenericTimerGetTimerCtrlReg ();
TimerCtrlReg |= ARM_ARCH_TIMER_IMASK;
TimerCtrlReg &= ~ARM_ARCH_TIMER_ENABLE;
- ArmArchTimerSetTimerCtrlReg (TimerCtrlReg);
+ ArmGenericTimerSetTimerCtrlReg (TimerCtrlReg);
Status = TimerDriverSetTimerPeriod (&gTimer, 0);
ASSERT_EFI_ERROR (Status);
@@ -416,7 +417,7 @@ TimerInitialize (
// Everything is ready, unmask and enable timer interrupts
TimerCtrlReg = ARM_ARCH_TIMER_ENABLE;
- ArmArchTimerSetTimerCtrlReg (TimerCtrlReg);
+ ArmGenericTimerSetTimerCtrlReg (TimerCtrlReg);
// Register for an ExitBootServicesEvent
Status = gBS->CreateEvent (EVT_SIGNAL_EXIT_BOOT_SERVICES, TPL_NOTIFY, ExitBootServicesEvent, NULL, &EfiExitBootServicesEvent);
diff --git a/ArmPkg/Drivers/TimerDxe/TimerDxe.inf b/ArmPkg/Drivers/TimerDxe/TimerDxe.inf
index 161d286d9c..9e9768fbb5 100644
--- a/ArmPkg/Drivers/TimerDxe/TimerDxe.inf
+++ b/ArmPkg/Drivers/TimerDxe/TimerDxe.inf
@@ -41,6 +41,7 @@
DebugLib
UefiDriverEntryPoint
IoLib
+ ArmGenericTimerCounterLib
[Guids]