]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPkg/ArmLib: remove indirection layer from timer register accessors
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Fri, 20 Jan 2017 11:58:37 +0000 (11:58 +0000)
committerArd Biesheuvel <ard.biesheuvel@linaro.org>
Fri, 20 Jan 2017 15:51:34 +0000 (15:51 +0000)
The generic timer support libraries call the actual system register
accessor function via a single pair of functions ArmArchTimerReadReg()
and ArmArchTimerWriteReg(), which take an enum argument to identify
the register, and return output values by pointer reference.

Since these functions are never called with a non-immediate argument,
we can simply replace each invocation with the underlying system register
accessor instead. This is mostly functionally equivalent, with the
exception of the bounds check for the enum (which is pointless given the
fact that we never pass a variable), the check for the presence of the
architected timer (which only makes sense for ARMv7, but is highly unlikely
to vary between platforms that are similar enough to run the same firmware
image), and a check for enum values that refer to the HYP view of the timer,
which we never referred to anywhere in the code in the first place.

So get rid of the middle man, and update the ArmGenericTimerPhyCounterLib
and ArmGenericTimerVirtCounterLib implementations to call the system
register accessors directly.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
Tested-by: Ryan Harkin <ryan.harkin@linaro.org>
ArmPkg/Drivers/TimerDxe/TimerDxe.c
ArmPkg/Include/Chipset/AArch64.h
ArmPkg/Include/Chipset/ArmArchTimer.h [deleted file]
ArmPkg/Include/Chipset/ArmV7.h
ArmPkg/Include/Library/ArmArchTimer.h [deleted file]
ArmPkg/Include/Library/ArmLib.h
ArmPkg/Library/ArmGenericTimerPhyCounterLib/ArmGenericTimerPhyCounterLib.c
ArmPkg/Library/ArmGenericTimerVirtCounterLib/ArmGenericTimerVirtCounterLib.c
ArmPkg/Library/ArmLib/AArch64/AArch64ArchTimer.c [deleted file]
ArmPkg/Library/ArmLib/Arm/ArmV7ArchTimer.c [deleted file]
ArmPkg/Library/ArmLib/ArmBaseLib.inf

index 1169d426b2559b8ff2fb84e757638c06665b6f9d..2416c90f5545495367a835b5a6753d30e868c878 100644 (file)
@@ -25,7 +25,6 @@
 #include <Library/PcdLib.h>\r
 #include <Library/IoLib.h>\r
 #include <Library/ArmGenericTimerCounterLib.h>\r
-#include <Library/ArmArchTimer.h>\r
 \r
 #include <Protocol/Timer.h>\r
 #include <Protocol/HardwareInterrupt.h>\r
index e94c9290c582e1bb8da35947f676b55206bbf023..9aecb1df81e07a42736e32e65ae6c1736b1f54f0 100644 (file)
@@ -17,7 +17,6 @@
 #define __AARCH64_H__\r
 \r
 #include <Chipset/AArch64Mmu.h>\r
-#include <Chipset/ArmArchTimer.h>\r
 \r
 // ARM Interrupt ID in Exception Table\r
 #define ARM_ARCH_EXCEPTION_IRQ            EXCEPT_AARCH64_IRQ\r
diff --git a/ArmPkg/Include/Chipset/ArmArchTimer.h b/ArmPkg/Include/Chipset/ArmArchTimer.h
deleted file mode 100644 (file)
index 1caad3d..0000000
+++ /dev/null
@@ -1,139 +0,0 @@
-/** @file\r
-*\r
-*  Copyright (c) 2011-2013, ARM Limited. All rights reserved.\r
-*\r
-*  This program and the accompanying materials\r
-*  are licensed and made available under the terms and conditions of the BSD License\r
-*  which accompanies this distribution.  The full text of the license may be found at\r
-*  http://opensource.org/licenses/bsd-license.php\r
-*\r
-*  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-*  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-*\r
-**/\r
-\r
-#ifndef __ARM_ARCH_TIMER_H_\r
-#define __ARM_ARCH_TIMER_H_\r
-\r
-UINTN\r
-EFIAPI\r
-ArmReadCntFrq (\r
-  VOID\r
-  );\r
-\r
-VOID\r
-EFIAPI\r
-ArmWriteCntFrq (\r
-  UINTN   FreqInHz\r
-  );\r
-\r
-UINT64\r
-EFIAPI\r
-ArmReadCntPct (\r
-  VOID\r
-  );\r
-\r
-UINTN\r
-EFIAPI\r
-ArmReadCntkCtl (\r
-  VOID\r
-  );\r
-\r
-VOID\r
-EFIAPI\r
-ArmWriteCntkCtl (\r
-  UINTN   Val\r
-  );\r
-\r
-UINTN\r
-EFIAPI\r
-ArmReadCntpTval (\r
-  VOID\r
-  );\r
-\r
-VOID\r
-EFIAPI\r
-ArmWriteCntpTval (\r
-  UINTN   Val\r
-  );\r
-\r
-UINTN\r
-EFIAPI\r
-ArmReadCntpCtl (\r
-  VOID\r
-  );\r
-\r
-VOID\r
-EFIAPI\r
-ArmWriteCntpCtl (\r
-  UINTN   Val\r
-  );\r
-\r
-UINTN\r
-EFIAPI\r
-ArmReadCntvTval (\r
-  VOID\r
-  );\r
-\r
-VOID\r
-EFIAPI\r
-ArmWriteCntvTval (\r
-  UINTN   Val\r
-  );\r
-\r
-UINTN\r
-EFIAPI\r
-ArmReadCntvCtl (\r
-  VOID\r
-  );\r
-\r
-VOID\r
-EFIAPI\r
-ArmWriteCntvCtl (\r
-  UINTN   Val\r
-  );\r
-\r
-UINT64\r
-EFIAPI\r
-ArmReadCntvCt (\r
-  VOID\r
-  );\r
-\r
-UINT64\r
-EFIAPI\r
-ArmReadCntpCval (\r
-  VOID\r
-  );\r
-\r
-VOID\r
-EFIAPI\r
-ArmWriteCntpCval (\r
-  UINT64   Val\r
-  );\r
-\r
-UINT64\r
-EFIAPI\r
-ArmReadCntvCval (\r
-  VOID\r
-  );\r
-\r
-VOID\r
-EFIAPI\r
-ArmWriteCntvCval (\r
-  UINT64   Val\r
-  );\r
-\r
-UINT64\r
-EFIAPI\r
-ArmReadCntvOff (\r
-  VOID\r
-  );\r
-\r
-VOID\r
-EFIAPI\r
-ArmWriteCntvOff (\r
-  UINT64   Val\r
-  );\r
-\r
-#endif // __ARM_ARCH_TIMER_H_\r
-\r
index 4fb06636e0b020420fd9901c4dea01edc7cb0da4..ee4ac4374bd36ed2a9ce5d009a5a00c44a89d19f 100644 (file)
@@ -17,7 +17,6 @@
 #define __ARM_V7_H__\r
 \r
 #include <Chipset/ArmV7Mmu.h>\r
-#include <Chipset/ArmArchTimer.h>\r
 \r
 // ARM Interrupt ID in Exception Table\r
 #define ARM_ARCH_EXCEPTION_IRQ            EXCEPT_ARM_IRQ\r
diff --git a/ArmPkg/Include/Library/ArmArchTimer.h b/ArmPkg/Include/Library/ArmArchTimer.h
deleted file mode 100644 (file)
index 876c1f6..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/** @file\r
-\r
-  Copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.<BR>\r
-\r
-  This program and the accompanying materials\r
-  are licensed and made available under the terms and conditions of the BSD License\r
-  which accompanies this distribution.  The full text of the license may be found at\r
-  http://opensource.org/licenses/bsd-license.php\r
-\r
-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-**/\r
-\r
-#ifndef __ARM_ARCH_TIMER_H__\r
-#define __ARM_ARCH_TIMER_H__\r
-\r
-#define ARM_ARCH_TIMER_ENABLE           (1 << 0)\r
-#define ARM_ARCH_TIMER_IMASK            (1 << 1)\r
-#define ARM_ARCH_TIMER_ISTATUS          (1 << 2)\r
-\r
-typedef enum {\r
-  CntFrq = 0,\r
-  CntPct,\r
-  CntkCtl,\r
-  CntpTval,\r
-  CntpCtl,\r
-  CntvTval,\r
-  CntvCtl,\r
-  CntvCt,\r
-  CntpCval,\r
-  CntvCval,\r
-  CntvOff,\r
-  CnthCtl,\r
-  CnthpTval,\r
-  CnthpCtl,\r
-  CnthpCval,\r
-  RegMaximum\r
-} ARM_ARCH_TIMER_REGS;\r
-\r
-VOID\r
-EFIAPI\r
-ArmArchTimerReadReg (\r
-  IN   ARM_ARCH_TIMER_REGS   Reg,\r
-  OUT  VOID                  *DstBuf\r
-  );\r
-\r
-VOID\r
-EFIAPI\r
-ArmArchTimerWriteReg (\r
-  IN   ARM_ARCH_TIMER_REGS   Reg,\r
-  IN   VOID                  *SrcBuf\r
-  );\r
-\r
-#endif // __ARM_ARCH_TIMER_H__\r
index 40d97e09b5665101fdbe1d2bc60d9df5015d2c53..19501efa991f5da6f2fbfb85271c5c74388bb99e 100644 (file)
@@ -587,4 +587,132 @@ ArmUnsetCpuActlrBit (
   IN  UINTN    Bits\r
   );\r
 \r
+//\r
+// Accessors for the architected generic timer registers\r
+//\r
+\r
+#define ARM_ARCH_TIMER_ENABLE           (1 << 0)\r
+#define ARM_ARCH_TIMER_IMASK            (1 << 1)\r
+#define ARM_ARCH_TIMER_ISTATUS          (1 << 2)\r
+\r
+UINTN\r
+EFIAPI\r
+ArmReadCntFrq (\r
+  VOID\r
+  );\r
+\r
+VOID\r
+EFIAPI\r
+ArmWriteCntFrq (\r
+  UINTN   FreqInHz\r
+  );\r
+\r
+UINT64\r
+EFIAPI\r
+ArmReadCntPct (\r
+  VOID\r
+  );\r
+\r
+UINTN\r
+EFIAPI\r
+ArmReadCntkCtl (\r
+  VOID\r
+  );\r
+\r
+VOID\r
+EFIAPI\r
+ArmWriteCntkCtl (\r
+  UINTN   Val\r
+  );\r
+\r
+UINTN\r
+EFIAPI\r
+ArmReadCntpTval (\r
+  VOID\r
+  );\r
+\r
+VOID\r
+EFIAPI\r
+ArmWriteCntpTval (\r
+  UINTN   Val\r
+  );\r
+\r
+UINTN\r
+EFIAPI\r
+ArmReadCntpCtl (\r
+  VOID\r
+  );\r
+\r
+VOID\r
+EFIAPI\r
+ArmWriteCntpCtl (\r
+  UINTN   Val\r
+  );\r
+\r
+UINTN\r
+EFIAPI\r
+ArmReadCntvTval (\r
+  VOID\r
+  );\r
+\r
+VOID\r
+EFIAPI\r
+ArmWriteCntvTval (\r
+  UINTN   Val\r
+  );\r
+\r
+UINTN\r
+EFIAPI\r
+ArmReadCntvCtl (\r
+  VOID\r
+  );\r
+\r
+VOID\r
+EFIAPI\r
+ArmWriteCntvCtl (\r
+  UINTN   Val\r
+  );\r
+\r
+UINT64\r
+EFIAPI\r
+ArmReadCntvCt (\r
+  VOID\r
+  );\r
+\r
+UINT64\r
+EFIAPI\r
+ArmReadCntpCval (\r
+  VOID\r
+  );\r
+\r
+VOID\r
+EFIAPI\r
+ArmWriteCntpCval (\r
+  UINT64   Val\r
+  );\r
+\r
+UINT64\r
+EFIAPI\r
+ArmReadCntvCval (\r
+  VOID\r
+  );\r
+\r
+VOID\r
+EFIAPI\r
+ArmWriteCntvCval (\r
+  UINT64   Val\r
+  );\r
+\r
+UINT64\r
+EFIAPI\r
+ArmReadCntvOff (\r
+  VOID\r
+  );\r
+\r
+VOID\r
+EFIAPI\r
+ArmWriteCntvOff (\r
+  UINT64   Val\r
+  );\r
+\r
 #endif // __ARM_LIB__\r
index 826827fb09165d1d18ecfd59a41c231c0cc6fb5c..d04e04fb334dd3299acde576a372ca3bb54a3225 100644 (file)
@@ -14,7 +14,7 @@
 **/\r
 \r
 #include <Library/ArmGenericTimerCounterLib.h>\r
-#include <Library/ArmArchTimer.h>\r
+#include <Library/ArmLib.h>\r
 \r
 VOID\r
 EFIAPI\r
@@ -24,9 +24,9 @@ ArmGenericTimerEnableTimer (
 {\r
   UINTN TimerCtrlReg;\r
 \r
-  ArmArchTimerReadReg (CntpCtl, (VOID *)&TimerCtrlReg);\r
+  TimerCtrlReg = ArmReadCntpCtl ();\r
   TimerCtrlReg |= ARM_ARCH_TIMER_ENABLE;\r
-  ArmArchTimerWriteReg (CntpCtl, (VOID *)&TimerCtrlReg);\r
+  ArmWriteCntpCtl (TimerCtrlReg);\r
 }\r
 \r
 VOID\r
@@ -37,9 +37,9 @@ ArmGenericTimerDisableTimer (
 {\r
   UINTN TimerCtrlReg;\r
 \r
-  ArmArchTimerReadReg (CntpCtl, (VOID *)&TimerCtrlReg);\r
+  TimerCtrlReg = ArmReadCntpCtl ();\r
   TimerCtrlReg &= ~ARM_ARCH_TIMER_ENABLE;\r
-  ArmArchTimerWriteReg (CntpCtl, (VOID *)&TimerCtrlReg);\r
+  ArmWriteCntpCtl (TimerCtrlReg);\r
 }\r
 \r
 VOID\r
@@ -48,7 +48,7 @@ ArmGenericTimerSetTimerFreq (
   IN   UINTN  FreqInHz\r
   )\r
 {\r
-  ArmArchTimerWriteReg (CntFrq, (VOID *)&FreqInHz);\r
+  ArmWriteCntFrq (FreqInHz);\r
 }\r
 \r
 UINTN\r
@@ -57,9 +57,7 @@ ArmGenericTimerGetTimerFreq (
   VOID\r
   )\r
 {\r
-  UINTN ArchTimerFreq = 0;\r
-  ArmArchTimerReadReg (CntFrq, (VOID *)&ArchTimerFreq);\r
-  return ArchTimerFreq;\r
+  return ArmReadCntFrq ();\r
 }\r
 \r
 UINTN\r
@@ -68,10 +66,7 @@ ArmGenericTimerGetTimerVal (
   VOID\r
   )\r
 {\r
-  UINTN ArchTimerValue;\r
-  ArmArchTimerReadReg (CntpTval, (VOID *)&ArchTimerValue);\r
-\r
-  return ArchTimerValue;\r
+  return ArmReadCntpTval ();\r
 }\r
 \r
 \r
@@ -81,7 +76,7 @@ ArmGenericTimerSetTimerVal (
   IN   UINTN   Value\r
   )\r
 {\r
-  ArmArchTimerWriteReg (CntpTval, (VOID *)&Value);\r
+  ArmWriteCntpTval (Value);\r
 }\r
 \r
 UINT64\r
@@ -90,10 +85,7 @@ ArmGenericTimerGetSystemCount (
   VOID\r
   )\r
 {\r
-  UINT64 SystemCount;\r
-  ArmArchTimerReadReg (CntPct, (VOID *)&SystemCount);\r
-\r
-  return SystemCount;\r
+  return ArmReadCntPct ();\r
 }\r
 \r
 UINTN\r
@@ -102,10 +94,7 @@ ArmGenericTimerGetTimerCtrlReg (
   VOID\r
   )\r
 {\r
-  UINTN  Value;\r
-  ArmArchTimerReadReg (CntpCtl, (VOID *)&Value);\r
-\r
-  return Value;\r
+  return ArmReadCntpCtl ();\r
 }\r
 \r
 VOID\r
@@ -114,7 +103,7 @@ ArmGenericTimerSetTimerCtrlReg (
   UINTN Value\r
   )\r
 {\r
-  ArmArchTimerWriteReg (CntpCtl, (VOID *)&Value);\r
+  ArmWriteCntpCtl (Value);\r
 }\r
 \r
 UINT64\r
@@ -123,10 +112,7 @@ ArmGenericTimerGetCompareVal (
   VOID\r
   )\r
 {\r
-  UINT64  Value;\r
-  ArmArchTimerReadReg (CntpCval, (VOID *)&Value);\r
-\r
-  return Value;\r
+  return ArmReadCntpCval ();\r
 }\r
 \r
 VOID\r
@@ -135,5 +121,5 @@ ArmGenericTimerSetCompareVal (
   IN   UINT64   Value\r
   )\r
 {\r
-  ArmArchTimerWriteReg (CntpCval, (VOID *)&Value);\r
+  ArmWriteCntpCval (Value);\r
 }\r
index f99c8525b9009aa9631ba371b7d9156bce7b58e1..69a4ceb62db616dfeaec9e54fe57679811778e11 100644 (file)
@@ -14,7 +14,7 @@
 **/\r
 \r
 #include <Library/ArmGenericTimerCounterLib.h>\r
-#include <Library/ArmArchTimer.h>\r
+#include <Library/ArmLib.h>\r
 \r
 VOID\r
 EFIAPI\r
@@ -24,7 +24,7 @@ ArmGenericTimerEnableTimer (
 {\r
   UINTN TimerCtrlReg;\r
 \r
-  ArmArchTimerReadReg (CntvCtl, (VOID *)&TimerCtrlReg);\r
+  TimerCtrlReg = ArmReadCntvCtl ();\r
   TimerCtrlReg |= ARM_ARCH_TIMER_ENABLE;\r
 \r
   //\r
@@ -36,7 +36,7 @@ ArmGenericTimerEnableTimer (
   // leaving this in once KVM gets fixed.\r
   //\r
   TimerCtrlReg &= ~ARM_ARCH_TIMER_IMASK;\r
-  ArmArchTimerWriteReg (CntvCtl, (VOID *)&TimerCtrlReg);\r
+  ArmWriteCntvCtl (TimerCtrlReg);\r
 }\r
 \r
 VOID\r
@@ -47,9 +47,9 @@ ArmGenericTimerDisableTimer (
 {\r
   UINTN TimerCtrlReg;\r
 \r
-  ArmArchTimerReadReg (CntvCtl, (VOID *)&TimerCtrlReg);\r
+  TimerCtrlReg = ArmReadCntvCtl ();\r
   TimerCtrlReg &= ~ARM_ARCH_TIMER_ENABLE;\r
-  ArmArchTimerWriteReg (CntvCtl, (VOID *)&TimerCtrlReg);\r
+  ArmWriteCntvCtl (TimerCtrlReg);\r
 }\r
 \r
 VOID\r
@@ -58,7 +58,7 @@ ArmGenericTimerSetTimerFreq (
   IN   UINTN  FreqInHz\r
   )\r
 {\r
-  ArmArchTimerWriteReg (CntFrq, (VOID *)&FreqInHz);\r
+  ArmWriteCntFrq (FreqInHz);\r
 }\r
 \r
 UINTN\r
@@ -67,9 +67,7 @@ ArmGenericTimerGetTimerFreq (
   VOID\r
   )\r
 {\r
-  UINTN ArchTimerFreq = 0;\r
-  ArmArchTimerReadReg (CntFrq, (VOID *)&ArchTimerFreq);\r
-  return ArchTimerFreq;\r
+  return ArmReadCntFrq ();\r
 }\r
 \r
 UINTN\r
@@ -78,10 +76,7 @@ ArmGenericTimerGetTimerVal (
   VOID\r
   )\r
 {\r
-  UINTN ArchTimerValue;\r
-  ArmArchTimerReadReg (CntvTval, (VOID *)&ArchTimerValue);\r
-\r
-  return ArchTimerValue;\r
+  return ArmReadCntvTval ();\r
 }\r
 \r
 \r
@@ -91,7 +86,7 @@ ArmGenericTimerSetTimerVal (
   IN   UINTN   Value\r
   )\r
 {\r
-  ArmArchTimerWriteReg (CntvTval, (VOID *)&Value);\r
+  ArmWriteCntvTval (Value);\r
 }\r
 \r
 UINT64\r
@@ -100,10 +95,7 @@ ArmGenericTimerGetSystemCount (
   VOID\r
   )\r
 {\r
-  UINT64 SystemCount;\r
-  ArmArchTimerReadReg (CntvCt, (VOID *)&SystemCount);\r
-\r
-  return SystemCount;\r
+  return ArmReadCntvCt ();\r
 }\r
 \r
 UINTN\r
@@ -112,10 +104,7 @@ ArmGenericTimerGetTimerCtrlReg (
   VOID\r
   )\r
 {\r
-  UINTN  Value;\r
-  ArmArchTimerReadReg (CntvCtl, (VOID *)&Value);\r
-\r
-  return Value;\r
+  return ArmReadCntvCtl ();\r
 }\r
 \r
 VOID\r
@@ -124,7 +113,7 @@ ArmGenericTimerSetTimerCtrlReg (
   UINTN Value\r
   )\r
 {\r
-  ArmArchTimerWriteReg (CntvCtl, (VOID *)&Value);\r
+  ArmWriteCntvCtl (Value);\r
 }\r
 \r
 UINT64\r
@@ -133,10 +122,7 @@ ArmGenericTimerGetCompareVal (
   VOID\r
   )\r
 {\r
-  UINT64  Value;\r
-  ArmArchTimerReadReg (CntvCval, (VOID *)&Value);\r
-\r
-  return Value;\r
+  return ArmReadCntvCval ();\r
 }\r
 \r
 VOID\r
@@ -145,5 +131,5 @@ ArmGenericTimerSetCompareVal (
   IN   UINT64   Value\r
   )\r
 {\r
-  ArmArchTimerWriteReg (CntvCval, (VOID *)&Value);\r
+  ArmWriteCntvCval (Value);\r
 }\r
diff --git a/ArmPkg/Library/ArmLib/AArch64/AArch64ArchTimer.c b/ArmPkg/Library/ArmLib/AArch64/AArch64ArchTimer.c
deleted file mode 100644 (file)
index 31286ee..0000000
+++ /dev/null
@@ -1,167 +0,0 @@
-/** @file\r
-*\r
-*  Copyright (c) 2011-2013, ARM Limited. All rights reserved.\r
-*\r
-*  This program and the accompanying materials\r
-*  are licensed and made available under the terms and conditions of the BSD License\r
-*  which accompanies this distribution.  The full text of the license may be found at\r
-*  http://opensource.org/licenses/bsd-license.php\r
-*\r
-*  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-*  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-*\r
-**/\r
-\r
-#include <Uefi.h>\r
-#include <Chipset/AArch64.h>\r
-#include <Library/BaseMemoryLib.h>\r
-#include <Library/ArmLib.h>\r
-#include <Library/BaseLib.h>\r
-#include <Library/DebugLib.h>\r
-#include "AArch64Lib.h"\r
-#include "ArmLibPrivate.h"\r
-#include <Library/ArmArchTimer.h>\r
-\r
-VOID\r
-EFIAPI\r
-ArmArchTimerReadReg (\r
-    IN   ARM_ARCH_TIMER_REGS   Reg,\r
-    OUT  VOID                  *DstBuf\r
-    )\r
-{\r
-  // Check if the Generic/Architecture timer is implemented\r
-  if (ArmIsArchTimerImplemented ()) {\r
-\r
-    switch (Reg) {\r
-\r
-    case CntFrq:\r
-      *((UINTN *)DstBuf) = ArmReadCntFrq ();\r
-      break;\r
-\r
-    case CntPct:\r
-      *((UINT64 *)DstBuf) = ArmReadCntPct ();\r
-      break;\r
-\r
-    case CntkCtl:\r
-      *((UINTN *)DstBuf) = ArmReadCntkCtl();\r
-      break;\r
-\r
-    case CntpTval:\r
-      *((UINTN *)DstBuf) = ArmReadCntpTval ();\r
-      break;\r
-\r
-    case CntpCtl:\r
-      *((UINTN *)DstBuf) = ArmReadCntpCtl ();\r
-      break;\r
-\r
-    case CntvTval:\r
-      *((UINTN *)DstBuf) = ArmReadCntvTval ();\r
-      break;\r
-\r
-    case CntvCtl:\r
-      *((UINTN *)DstBuf) = ArmReadCntvCtl ();\r
-      break;\r
-\r
-    case CntvCt:\r
-      *((UINT64 *)DstBuf) = ArmReadCntvCt ();\r
-      break;\r
-\r
-    case CntpCval:\r
-      *((UINT64 *)DstBuf) = ArmReadCntpCval ();\r
-      break;\r
-\r
-    case CntvCval:\r
-      *((UINT64 *)DstBuf) = ArmReadCntvCval ();\r
-      break;\r
-\r
-    case CntvOff:\r
-      *((UINT64 *)DstBuf) = ArmReadCntvOff ();\r
-      break;\r
-\r
-    case CnthCtl:\r
-    case CnthpTval:\r
-    case CnthpCtl:\r
-    case CnthpCval:\r
-    DEBUG ((EFI_D_ERROR, "The register is related to Hypervisor Mode. Can't perform requested operation\n "));\r
-      break;\r
-\r
-    default:\r
-      DEBUG ((EFI_D_ERROR, "Unknown ARM Generic Timer register %x. \n ", Reg));\r
-    }\r
-  } else {\r
-    DEBUG ((EFI_D_ERROR, "Attempt to read ARM Generic Timer registers. But ARM Generic Timer extension is not implemented \n "));\r
-    ASSERT (0);\r
-  }\r
-}\r
-\r
-VOID\r
-EFIAPI\r
-ArmArchTimerWriteReg (\r
-    IN   ARM_ARCH_TIMER_REGS   Reg,\r
-    IN   VOID                  *SrcBuf\r
-    )\r
-{\r
-  // Check if the Generic/Architecture timer is implemented\r
-  if (ArmIsArchTimerImplemented ()) {\r
-\r
-    switch (Reg) {\r
-\r
-    case CntFrq:\r
-      ArmWriteCntFrq (*((UINTN *)SrcBuf));\r
-      break;\r
-\r
-    case CntPct:\r
-      DEBUG ((EFI_D_ERROR, "Can't write to Read Only Register: CNTPCT \n"));\r
-      break;\r
-\r
-    case CntkCtl:\r
-      ArmWriteCntkCtl (*((UINTN *)SrcBuf));\r
-      break;\r
-\r
-    case CntpTval:\r
-      ArmWriteCntpTval (*((UINTN *)SrcBuf));\r
-      break;\r
-\r
-    case CntpCtl:\r
-      ArmWriteCntpCtl (*((UINTN *)SrcBuf));\r
-      break;\r
-\r
-    case CntvTval:\r
-      ArmWriteCntvTval (*((UINTN *)SrcBuf));\r
-      break;\r
-\r
-    case CntvCtl:\r
-      ArmWriteCntvCtl (*((UINTN *)SrcBuf));\r
-      break;\r
-\r
-    case CntvCt:\r
-      DEBUG ((EFI_D_ERROR, "Can't write to Read Only Register: CNTVCT \n"));\r
-      break;\r
-\r
-    case CntpCval:\r
-      ArmWriteCntpCval (*((UINT64 *)SrcBuf) );\r
-      break;\r
-\r
-    case CntvCval:\r
-      ArmWriteCntvCval (*((UINT64 *)SrcBuf) );\r
-      break;\r
-\r
-    case CntvOff:\r
-      ArmWriteCntvOff (*((UINT64 *)SrcBuf));\r
-      break;\r
-\r
-    case CnthCtl:\r
-    case CnthpTval:\r
-    case CnthpCtl:\r
-    case CnthpCval:\r
-      DEBUG ((EFI_D_ERROR, "The register is related to Hypervisor Mode. Can't perform requested operation\n "));\r
-      break;\r
-\r
-    default:\r
-      DEBUG ((EFI_D_ERROR, "Unknown ARM Generic Timer register %x. \n ", Reg));\r
-    }\r
-  } else {\r
-    DEBUG ((EFI_D_ERROR, "Attempt to write to ARM Generic Timer registers. But ARM Generic Timer extension is not implemented \n "));\r
-    ASSERT (0);\r
-  }\r
-}\r
diff --git a/ArmPkg/Library/ArmLib/Arm/ArmV7ArchTimer.c b/ArmPkg/Library/ArmLib/Arm/ArmV7ArchTimer.c
deleted file mode 100644 (file)
index c0b3a9e..0000000
+++ /dev/null
@@ -1,167 +0,0 @@
-/** @file\r
-*\r
-*  Copyright (c) 2011 - 2014, ARM Limited. All rights reserved.\r
-*\r
-*  This program and the accompanying materials\r
-*  are licensed and made available under the terms and conditions of the BSD License\r
-*  which accompanies this distribution.  The full text of the license may be found at\r
-*  http://opensource.org/licenses/bsd-license.php\r
-*\r
-*  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-*  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-*\r
-**/\r
-\r
-#include <Uefi.h>\r
-#include <Chipset/ArmV7.h>\r
-#include <Library/BaseMemoryLib.h>\r
-#include <Library/ArmLib.h>\r
-#include <Library/BaseLib.h>\r
-#include <Library/DebugLib.h>\r
-#include "ArmV7Lib.h"\r
-#include "ArmLibPrivate.h"\r
-#include <Library/ArmArchTimer.h>\r
-\r
-VOID\r
-EFIAPI\r
-ArmArchTimerReadReg (\r
-    IN   ARM_ARCH_TIMER_REGS   Reg,\r
-    OUT  VOID                  *DstBuf\r
-    )\r
-{\r
-  // Check if the Generic/Architecture timer is implemented\r
-  if (ArmIsArchTimerImplemented ()) {\r
-    switch (Reg) {\r
-    case CntFrq:\r
-      *((UINTN *)DstBuf) = ArmReadCntFrq ();\r
-      return;\r
-\r
-    case CntPct:\r
-      *((UINT64 *)DstBuf) = ArmReadCntPct ();\r
-      return;\r
-\r
-    case CntkCtl:\r
-      *((UINTN *)DstBuf) = ArmReadCntkCtl();\r
-      return;\r
-\r
-    case CntpTval:\r
-      *((UINTN *)DstBuf) = ArmReadCntpTval ();\r
-      return;\r
-\r
-    case CntpCtl:\r
-      *((UINTN *)DstBuf) = ArmReadCntpCtl ();\r
-      return;\r
-\r
-    case CntvTval:\r
-      *((UINTN *)DstBuf) = ArmReadCntvTval ();\r
-      return;\r
-\r
-    case CntvCtl:\r
-      *((UINTN *)DstBuf) = ArmReadCntvCtl ();\r
-      return;\r
-\r
-    case CntvCt:\r
-      *((UINT64 *)DstBuf) = ArmReadCntvCt ();\r
-      return;\r
-\r
-    case CntpCval:\r
-      *((UINT64 *)DstBuf) = ArmReadCntpCval ();\r
-      return;\r
-\r
-    case CntvCval:\r
-      *((UINT64 *)DstBuf) = ArmReadCntvCval ();\r
-      return;\r
-\r
-    case CntvOff:\r
-      *((UINT64 *)DstBuf) = ArmReadCntvOff ();\r
-      return;\r
-\r
-    case CnthCtl:\r
-    case CnthpTval:\r
-    case CnthpCtl:\r
-    case CnthpCval:\r
-      DEBUG ((EFI_D_ERROR, "The register is related to Hypervisor Mode. Can't perform requested operation\n "));\r
-      break;\r
-\r
-    default:\r
-      DEBUG ((EFI_D_ERROR, "Unknown ARM Generic Timer register %x. \n ", Reg));\r
-    }\r
-  } else {\r
-    DEBUG ((EFI_D_ERROR, "Attempt to read ARM Generic Timer registers. But ARM Generic Timer extension is not implemented \n "));\r
-    ASSERT (0);\r
-  }\r
-\r
-  *((UINT64 *)DstBuf) = 0;\r
-}\r
-\r
-VOID\r
-EFIAPI\r
-ArmArchTimerWriteReg (\r
-    IN   ARM_ARCH_TIMER_REGS   Reg,\r
-    IN   VOID                  *SrcBuf\r
-    )\r
-{\r
-  // Check if the Generic/Architecture timer is implemented\r
-  if (ArmIsArchTimerImplemented ()) {\r
-\r
-    switch (Reg) {\r
-\r
-    case CntFrq:\r
-      ArmWriteCntFrq (*((UINTN *)SrcBuf));\r
-      break;\r
-\r
-    case CntPct:\r
-      DEBUG ((EFI_D_ERROR, "Can't write to Read Only Register: CNTPCT \n"));\r
-      break;\r
-\r
-    case CntkCtl:\r
-      ArmWriteCntkCtl (*((UINTN *)SrcBuf));\r
-      break;\r
-\r
-    case CntpTval:\r
-      ArmWriteCntpTval (*((UINTN *)SrcBuf));\r
-      break;\r
-\r
-    case CntpCtl:\r
-      ArmWriteCntpCtl (*((UINTN *)SrcBuf));\r
-      break;\r
-\r
-    case CntvTval:\r
-      ArmWriteCntvTval (*((UINTN *)SrcBuf));\r
-      break;\r
-\r
-    case CntvCtl:\r
-      ArmWriteCntvCtl (*((UINTN *)SrcBuf));\r
-      break;\r
-\r
-    case CntvCt:\r
-      DEBUG ((EFI_D_ERROR, "Can't write to Read Only Register: CNTVCT \n"));\r
-      break;\r
-\r
-    case CntpCval:\r
-      ArmWriteCntpCval (*((UINT64 *)SrcBuf) );\r
-      break;\r
-\r
-    case CntvCval:\r
-      ArmWriteCntvCval (*((UINT64 *)SrcBuf) );\r
-      break;\r
-\r
-    case CntvOff:\r
-      ArmWriteCntvOff (*((UINT64 *)SrcBuf));\r
-      break;\r
-\r
-    case CnthCtl:\r
-    case CnthpTval:\r
-    case CnthpCtl:\r
-    case CnthpCval:\r
-      DEBUG ((EFI_D_ERROR, "The register is related to Hypervisor Mode. Can't perform requested operation\n "));\r
-      break;\r
-\r
-    default:\r
-      DEBUG ((EFI_D_ERROR, "Unknown ARM Generic Timer register %x. \n ", Reg));\r
-    }\r
-  } else {\r
-    DEBUG ((EFI_D_ERROR, "Attempt to write to ARM Generic Timer registers. But ARM Generic Timer extension is not implemented \n "));\r
-    ASSERT (0);\r
-  }\r
-}\r
index 05a585343cdac875854b043f1a62e0a0c56b3cb7..79e17be6d411a280f59991970528d5b1b639cc27 100644 (file)
@@ -27,7 +27,6 @@
 \r
 [Sources.ARM]\r
   Arm/ArmV7Lib.c\r
-  Arm/ArmV7ArchTimer.c\r
 \r
   Arm/ArmLibSupport.S           | GCC\r
   Arm/ArmLibSupportV7.S         | GCC\r
@@ -41,7 +40,6 @@
 \r
 [Sources.AARCH64]\r
   AArch64/AArch64Lib.c\r
-  AArch64/AArch64ArchTimer.c\r
 \r
   AArch64/ArmLibSupport.S\r
   AArch64/ArmLibSupportV8.S\r