From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf0-x22c.google.com (mail-lf0-x22c.google.com [IPv6:2a00:1450:4010:c07::22c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id E56B981EA3 for ; Fri, 20 Jan 2017 06:32:03 -0800 (PST) Received: by mail-lf0-x22c.google.com with SMTP id n124so59399012lfd.2 for ; Fri, 20 Jan 2017 06:32:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=Pdk+Bc7wxHgpAaUkSfWyWGEZW9klZybP/dUw6rKI4gI=; b=Fz9J3UWvT6QwowNcWxSWFzl3phlJ0kkJcZFFx/o/w+6xJmB+ody+RyskuTUIjm0HPS O9Dxm74fSfG1wDYyVc+AG16jkSBG9GIoGYPa4KH9U9pG/3EhCfVK++uYiSZ/Mz693V1p uPXjUp784+QpUj0L/TfBYN7T93ImFzhb0wM30= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=Pdk+Bc7wxHgpAaUkSfWyWGEZW9klZybP/dUw6rKI4gI=; b=JShEyuMr1TTUYp1rXvP81GWLoReuMIvH17nfA4bOhpRwPZMh4JBsMvW/pdzMCQiBEK LfXNVyX+U4QjbuGCK7xNHqAh2P0f8Z3eMJKLEJuPO0sjrId66mOKdZWv9+O7xzNW+XNG vmLen6VpuXjMWtBoYty/uaonoPieMKTkvV4h+I+hCaPkp0yEl1qU0Y3XdYo4p8ZWXCRn Qx/1ma/lEcDgJcKU/F5JLwWhxQ6BBXNw/R1d7n1h0XsIRf5Hi6obDbA/FyA7bDsHyLho s3Dp06/glzzStxNSCNFCod65+NTL+viB56pdPKRxE+coUkPw/iFqpTJwlnlQoIS7Cj/q FdQA== X-Gm-Message-State: AIkVDXKlDTH/ezg862FTVWt0BX4ehP1ia9670Ct3fTDXHcczli6XH3bkOBC2shbaChSHjiqJoSQlXaU7hj8mkDlJ X-Received: by 10.46.84.74 with SMTP id y10mr7235734ljd.40.1484922720958; Fri, 20 Jan 2017 06:32:00 -0800 (PST) MIME-Version: 1.0 Received: by 10.25.207.72 with HTTP; Fri, 20 Jan 2017 06:32:00 -0800 (PST) In-Reply-To: <1484913996-5062-1-git-send-email-ard.biesheuvel@linaro.org> References: <1484913996-5062-1-git-send-email-ard.biesheuvel@linaro.org> From: Ryan Harkin Date: Fri, 20 Jan 2017 14:32:00 +0000 Message-ID: To: Ard Biesheuvel Cc: "edk2-devel@lists.01.org" , Leif Lindholm Subject: Re: [PATCH] ArmPkg/ArmLib: remove indirection layer from timer register accessors X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Jan 2017 14:32:04 -0000 Content-Type: text/plain; charset=UTF-8 Hi Ard, On 20 January 2017 at 12:06, Ard Biesheuvel wrote: > 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 to 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 Are there any other patches needed to get this working? I've just applied it to the head of EDK2 [1] and I get this error when building for TC2, FVP and Juno: Building ... /linaro/platforms/uefi/edk2/ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.inf [AARCH64] /linaro/platforms/uefi/edk2/ArmPkg/Library/ArmGenericTimerPhyCounterLib/ArmGenericTimerPhyCounterLib.c: In function 'ArmGenericTimerSetTimerFreq': /linaro/platforms/uefi/edk2/ArmPkg/Library/ArmGenericTimerPhyCounterLib/ArmGenericTimerPhyCounterLib.c:51:19: error: 'CntFrq' undeclared (first use in this function) ArmWriteCntFrq (CntFrq); ^ /linaro/platforms/uefi/edk2/ArmPkg/Library/ArmGenericTimerPhyCounterLib/ArmGenericTimerPhyCounterLib.c:51:19: note: each undeclared identifier is reported only once for each function it appears in GNUmakefile:304: recipe for target '/linaro/platforms/uefi/edk2/Build/ArmVExpress-FVP-AArch64/DEBUG_GCC5/AARCH64/ArmPkg/Library/ArmGenericTimerPhyCounterLib/ArmGenericTimerPhyCounterLib/OUTPUT/ArmGenericTimerPhyCounterLib.obj' failed make: *** [/linaro/platforms/uefi/edk2/Build/ArmVExpress-FVP-AArch64/DEBUG_GCC5/AARCH64/ArmPkg/Library/ArmGenericTimerPhyCounterLib/ArmGenericTimerPhyCounterLib/OUTPUT/ArmGenericTimerPhyCounterLib.obj] Error 1 Cheers, Ryan. > --- > ArmPkg/Drivers/TimerDxe/TimerDxe.c | 1 - > ArmPkg/Include/Chipset/AArch64.h | 1 - > ArmPkg/Include/Chipset/ArmArchTimer.h | 139 ---------------- > ArmPkg/Include/Chipset/ArmV7.h | 1 - > ArmPkg/Include/Library/ArmArchTimer.h | 55 ------- > ArmPkg/Include/Library/ArmLib.h | 128 +++++++++++++++ > ArmPkg/Library/ArmGenericTimerPhyCounterLib/ArmGenericTimerPhyCounterLib.c | 42 ++--- > ArmPkg/Library/ArmGenericTimerVirtCounterLib/ArmGenericTimerVirtCounterLib.c | 42 ++--- > ArmPkg/Library/ArmLib/AArch64/AArch64ArchTimer.c | 167 -------------------- > ArmPkg/Library/ArmLib/Arm/ArmV7ArchTimer.c | 167 -------------------- > ArmPkg/Library/ArmLib/ArmBaseLib.inf | 2 - > 11 files changed, 156 insertions(+), 589 deletions(-) > > diff --git a/ArmPkg/Drivers/TimerDxe/TimerDxe.c b/ArmPkg/Drivers/TimerDxe/TimerDxe.c > index 1169d426b255..2416c90f5545 100644 > --- a/ArmPkg/Drivers/TimerDxe/TimerDxe.c > +++ b/ArmPkg/Drivers/TimerDxe/TimerDxe.c > @@ -25,7 +25,6 @@ > #include > #include > #include > -#include > > #include > #include > diff --git a/ArmPkg/Include/Chipset/AArch64.h b/ArmPkg/Include/Chipset/AArch64.h > index e94c9290c582..9aecb1df81e0 100644 > --- a/ArmPkg/Include/Chipset/AArch64.h > +++ b/ArmPkg/Include/Chipset/AArch64.h > @@ -17,7 +17,6 @@ > #define __AARCH64_H__ > > #include > -#include > > // ARM Interrupt ID in Exception Table > #define ARM_ARCH_EXCEPTION_IRQ EXCEPT_AARCH64_IRQ > diff --git a/ArmPkg/Include/Chipset/ArmArchTimer.h b/ArmPkg/Include/Chipset/ArmArchTimer.h > deleted file mode 100644 > index 1caad3d3367a..000000000000 > --- a/ArmPkg/Include/Chipset/ArmArchTimer.h > +++ /dev/null > @@ -1,139 +0,0 @@ > -/** @file > -* > -* Copyright (c) 2011-2013, 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 > -* which accompanies this distribution. The full text of the license may be found at > -* http://opensource.org/licenses/bsd-license.php > -* > -* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, > -* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. > -* > -**/ > - > -#ifndef __ARM_ARCH_TIMER_H_ > -#define __ARM_ARCH_TIMER_H_ > - > -UINTN > -EFIAPI > -ArmReadCntFrq ( > - VOID > - ); > - > -VOID > -EFIAPI > -ArmWriteCntFrq ( > - UINTN FreqInHz > - ); > - > -UINT64 > -EFIAPI > -ArmReadCntPct ( > - VOID > - ); > - > -UINTN > -EFIAPI > -ArmReadCntkCtl ( > - VOID > - ); > - > -VOID > -EFIAPI > -ArmWriteCntkCtl ( > - UINTN Val > - ); > - > -UINTN > -EFIAPI > -ArmReadCntpTval ( > - VOID > - ); > - > -VOID > -EFIAPI > -ArmWriteCntpTval ( > - UINTN Val > - ); > - > -UINTN > -EFIAPI > -ArmReadCntpCtl ( > - VOID > - ); > - > -VOID > -EFIAPI > -ArmWriteCntpCtl ( > - UINTN Val > - ); > - > -UINTN > -EFIAPI > -ArmReadCntvTval ( > - VOID > - ); > - > -VOID > -EFIAPI > -ArmWriteCntvTval ( > - UINTN Val > - ); > - > -UINTN > -EFIAPI > -ArmReadCntvCtl ( > - VOID > - ); > - > -VOID > -EFIAPI > -ArmWriteCntvCtl ( > - UINTN Val > - ); > - > -UINT64 > -EFIAPI > -ArmReadCntvCt ( > - VOID > - ); > - > -UINT64 > -EFIAPI > -ArmReadCntpCval ( > - VOID > - ); > - > -VOID > -EFIAPI > -ArmWriteCntpCval ( > - UINT64 Val > - ); > - > -UINT64 > -EFIAPI > -ArmReadCntvCval ( > - VOID > - ); > - > -VOID > -EFIAPI > -ArmWriteCntvCval ( > - UINT64 Val > - ); > - > -UINT64 > -EFIAPI > -ArmReadCntvOff ( > - VOID > - ); > - > -VOID > -EFIAPI > -ArmWriteCntvOff ( > - UINT64 Val > - ); > - > -#endif // __ARM_ARCH_TIMER_H_ > - > diff --git a/ArmPkg/Include/Chipset/ArmV7.h b/ArmPkg/Include/Chipset/ArmV7.h > index 4fb06636e0b0..ee4ac4374bd3 100644 > --- a/ArmPkg/Include/Chipset/ArmV7.h > +++ b/ArmPkg/Include/Chipset/ArmV7.h > @@ -17,7 +17,6 @@ > #define __ARM_V7_H__ > > #include > -#include > > // ARM Interrupt ID in Exception Table > #define ARM_ARCH_EXCEPTION_IRQ EXCEPT_ARM_IRQ > diff --git a/ArmPkg/Include/Library/ArmArchTimer.h b/ArmPkg/Include/Library/ArmArchTimer.h > deleted file mode 100644 > index 876c1f65c525..000000000000 > --- a/ArmPkg/Include/Library/ArmArchTimer.h > +++ /dev/null > @@ -1,55 +0,0 @@ > -/** @file > - > - Copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.
> - > - This program and the accompanying materials > - are licensed and made available under the terms and conditions of the BSD License > - which accompanies this distribution. The full text of the license may be found at > - http://opensource.org/licenses/bsd-license.php > - > - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, > - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. > - > -**/ > - > -#ifndef __ARM_ARCH_TIMER_H__ > -#define __ARM_ARCH_TIMER_H__ > - > -#define ARM_ARCH_TIMER_ENABLE (1 << 0) > -#define ARM_ARCH_TIMER_IMASK (1 << 1) > -#define ARM_ARCH_TIMER_ISTATUS (1 << 2) > - > -typedef enum { > - CntFrq = 0, > - CntPct, > - CntkCtl, > - CntpTval, > - CntpCtl, > - CntvTval, > - CntvCtl, > - CntvCt, > - CntpCval, > - CntvCval, > - CntvOff, > - CnthCtl, > - CnthpTval, > - CnthpCtl, > - CnthpCval, > - RegMaximum > -} ARM_ARCH_TIMER_REGS; > - > -VOID > -EFIAPI > -ArmArchTimerReadReg ( > - IN ARM_ARCH_TIMER_REGS Reg, > - OUT VOID *DstBuf > - ); > - > -VOID > -EFIAPI > -ArmArchTimerWriteReg ( > - IN ARM_ARCH_TIMER_REGS Reg, > - IN VOID *SrcBuf > - ); > - > -#endif // __ARM_ARCH_TIMER_H__ > diff --git a/ArmPkg/Include/Library/ArmLib.h b/ArmPkg/Include/Library/ArmLib.h > index 40d97e09b566..19501efa991f 100644 > --- a/ArmPkg/Include/Library/ArmLib.h > +++ b/ArmPkg/Include/Library/ArmLib.h > @@ -587,4 +587,132 @@ ArmUnsetCpuActlrBit ( > IN UINTN Bits > ); > > +// > +// Accessors for the architected generic timer registers > +// > + > +#define ARM_ARCH_TIMER_ENABLE (1 << 0) > +#define ARM_ARCH_TIMER_IMASK (1 << 1) > +#define ARM_ARCH_TIMER_ISTATUS (1 << 2) > + > +UINTN > +EFIAPI > +ArmReadCntFrq ( > + VOID > + ); > + > +VOID > +EFIAPI > +ArmWriteCntFrq ( > + UINTN FreqInHz > + ); > + > +UINT64 > +EFIAPI > +ArmReadCntPct ( > + VOID > + ); > + > +UINTN > +EFIAPI > +ArmReadCntkCtl ( > + VOID > + ); > + > +VOID > +EFIAPI > +ArmWriteCntkCtl ( > + UINTN Val > + ); > + > +UINTN > +EFIAPI > +ArmReadCntpTval ( > + VOID > + ); > + > +VOID > +EFIAPI > +ArmWriteCntpTval ( > + UINTN Val > + ); > + > +UINTN > +EFIAPI > +ArmReadCntpCtl ( > + VOID > + ); > + > +VOID > +EFIAPI > +ArmWriteCntpCtl ( > + UINTN Val > + ); > + > +UINTN > +EFIAPI > +ArmReadCntvTval ( > + VOID > + ); > + > +VOID > +EFIAPI > +ArmWriteCntvTval ( > + UINTN Val > + ); > + > +UINTN > +EFIAPI > +ArmReadCntvCtl ( > + VOID > + ); > + > +VOID > +EFIAPI > +ArmWriteCntvCtl ( > + UINTN Val > + ); > + > +UINT64 > +EFIAPI > +ArmReadCntvCt ( > + VOID > + ); > + > +UINT64 > +EFIAPI > +ArmReadCntpCval ( > + VOID > + ); > + > +VOID > +EFIAPI > +ArmWriteCntpCval ( > + UINT64 Val > + ); > + > +UINT64 > +EFIAPI > +ArmReadCntvCval ( > + VOID > + ); > + > +VOID > +EFIAPI > +ArmWriteCntvCval ( > + UINT64 Val > + ); > + > +UINT64 > +EFIAPI > +ArmReadCntvOff ( > + VOID > + ); > + > +VOID > +EFIAPI > +ArmWriteCntvOff ( > + UINT64 Val > + ); > + > #endif // __ARM_LIB__ > diff --git a/ArmPkg/Library/ArmGenericTimerPhyCounterLib/ArmGenericTimerPhyCounterLib.c b/ArmPkg/Library/ArmGenericTimerPhyCounterLib/ArmGenericTimerPhyCounterLib.c > index 826827fb0916..268b06e035bf 100644 > --- a/ArmPkg/Library/ArmGenericTimerPhyCounterLib/ArmGenericTimerPhyCounterLib.c > +++ b/ArmPkg/Library/ArmGenericTimerPhyCounterLib/ArmGenericTimerPhyCounterLib.c > @@ -14,7 +14,7 @@ > **/ > > #include > -#include > +#include > > VOID > EFIAPI > @@ -24,9 +24,9 @@ ArmGenericTimerEnableTimer ( > { > UINTN TimerCtrlReg; > > - ArmArchTimerReadReg (CntpCtl, (VOID *)&TimerCtrlReg); > + TimerCtrlReg = ArmReadCntpCtl (); > TimerCtrlReg |= ARM_ARCH_TIMER_ENABLE; > - ArmArchTimerWriteReg (CntpCtl, (VOID *)&TimerCtrlReg); > + ArmWriteCntpCtl (TimerCtrlReg); > } > > VOID > @@ -37,9 +37,9 @@ ArmGenericTimerDisableTimer ( > { > UINTN TimerCtrlReg; > > - ArmArchTimerReadReg (CntpCtl, (VOID *)&TimerCtrlReg); > + TimerCtrlReg = ArmReadCntpCtl (); > TimerCtrlReg &= ~ARM_ARCH_TIMER_ENABLE; > - ArmArchTimerWriteReg (CntpCtl, (VOID *)&TimerCtrlReg); > + ArmWriteCntpCtl (TimerCtrlReg); > } > > VOID > @@ -48,7 +48,7 @@ ArmGenericTimerSetTimerFreq ( > IN UINTN FreqInHz > ) > { > - ArmArchTimerWriteReg (CntFrq, (VOID *)&FreqInHz); > + ArmWriteCntFrq (CntFrq); > } > > UINTN > @@ -57,9 +57,7 @@ ArmGenericTimerGetTimerFreq ( > VOID > ) > { > - UINTN ArchTimerFreq = 0; > - ArmArchTimerReadReg (CntFrq, (VOID *)&ArchTimerFreq); > - return ArchTimerFreq; > + return ArmReadCntFrq (); > } > > UINTN > @@ -68,10 +66,7 @@ ArmGenericTimerGetTimerVal ( > VOID > ) > { > - UINTN ArchTimerValue; > - ArmArchTimerReadReg (CntpTval, (VOID *)&ArchTimerValue); > - > - return ArchTimerValue; > + return ArmReadCntpTval (); > } > > > @@ -81,7 +76,7 @@ ArmGenericTimerSetTimerVal ( > IN UINTN Value > ) > { > - ArmArchTimerWriteReg (CntpTval, (VOID *)&Value); > + ArmWriteCntpTval (Value); > } > > UINT64 > @@ -90,10 +85,7 @@ ArmGenericTimerGetSystemCount ( > VOID > ) > { > - UINT64 SystemCount; > - ArmArchTimerReadReg (CntPct, (VOID *)&SystemCount); > - > - return SystemCount; > + return ArmReadCntPct (); > } > > UINTN > @@ -102,10 +94,7 @@ ArmGenericTimerGetTimerCtrlReg ( > VOID > ) > { > - UINTN Value; > - ArmArchTimerReadReg (CntpCtl, (VOID *)&Value); > - > - return Value; > + return ArmReadCntpCtl (); > } > > VOID > @@ -114,7 +103,7 @@ ArmGenericTimerSetTimerCtrlReg ( > UINTN Value > ) > { > - ArmArchTimerWriteReg (CntpCtl, (VOID *)&Value); > + ArmWriteCntpCtl (Value); > } > > UINT64 > @@ -123,10 +112,7 @@ ArmGenericTimerGetCompareVal ( > VOID > ) > { > - UINT64 Value; > - ArmArchTimerReadReg (CntpCval, (VOID *)&Value); > - > - return Value; > + return ArmReadCntpCval (); > } > > VOID > @@ -135,5 +121,5 @@ ArmGenericTimerSetCompareVal ( > IN UINT64 Value > ) > { > - ArmArchTimerWriteReg (CntpCval, (VOID *)&Value); > + ArmWriteCntpCval (Value); > } > diff --git a/ArmPkg/Library/ArmGenericTimerVirtCounterLib/ArmGenericTimerVirtCounterLib.c b/ArmPkg/Library/ArmGenericTimerVirtCounterLib/ArmGenericTimerVirtCounterLib.c > index f99c8525b900..69a4ceb62db6 100644 > --- a/ArmPkg/Library/ArmGenericTimerVirtCounterLib/ArmGenericTimerVirtCounterLib.c > +++ b/ArmPkg/Library/ArmGenericTimerVirtCounterLib/ArmGenericTimerVirtCounterLib.c > @@ -14,7 +14,7 @@ > **/ > > #include > -#include > +#include > > VOID > EFIAPI > @@ -24,7 +24,7 @@ ArmGenericTimerEnableTimer ( > { > UINTN TimerCtrlReg; > > - ArmArchTimerReadReg (CntvCtl, (VOID *)&TimerCtrlReg); > + TimerCtrlReg = ArmReadCntvCtl (); > TimerCtrlReg |= ARM_ARCH_TIMER_ENABLE; > > // > @@ -36,7 +36,7 @@ ArmGenericTimerEnableTimer ( > // leaving this in once KVM gets fixed. > // > TimerCtrlReg &= ~ARM_ARCH_TIMER_IMASK; > - ArmArchTimerWriteReg (CntvCtl, (VOID *)&TimerCtrlReg); > + ArmWriteCntvCtl (TimerCtrlReg); > } > > VOID > @@ -47,9 +47,9 @@ ArmGenericTimerDisableTimer ( > { > UINTN TimerCtrlReg; > > - ArmArchTimerReadReg (CntvCtl, (VOID *)&TimerCtrlReg); > + TimerCtrlReg = ArmReadCntvCtl (); > TimerCtrlReg &= ~ARM_ARCH_TIMER_ENABLE; > - ArmArchTimerWriteReg (CntvCtl, (VOID *)&TimerCtrlReg); > + ArmWriteCntvCtl (TimerCtrlReg); > } > > VOID > @@ -58,7 +58,7 @@ ArmGenericTimerSetTimerFreq ( > IN UINTN FreqInHz > ) > { > - ArmArchTimerWriteReg (CntFrq, (VOID *)&FreqInHz); > + ArmWriteCntFrq (FreqInHz); > } > > UINTN > @@ -67,9 +67,7 @@ ArmGenericTimerGetTimerFreq ( > VOID > ) > { > - UINTN ArchTimerFreq = 0; > - ArmArchTimerReadReg (CntFrq, (VOID *)&ArchTimerFreq); > - return ArchTimerFreq; > + return ArmReadCntFrq (); > } > > UINTN > @@ -78,10 +76,7 @@ ArmGenericTimerGetTimerVal ( > VOID > ) > { > - UINTN ArchTimerValue; > - ArmArchTimerReadReg (CntvTval, (VOID *)&ArchTimerValue); > - > - return ArchTimerValue; > + return ArmReadCntvTval (); > } > > > @@ -91,7 +86,7 @@ ArmGenericTimerSetTimerVal ( > IN UINTN Value > ) > { > - ArmArchTimerWriteReg (CntvTval, (VOID *)&Value); > + ArmWriteCntvTval (Value); > } > > UINT64 > @@ -100,10 +95,7 @@ ArmGenericTimerGetSystemCount ( > VOID > ) > { > - UINT64 SystemCount; > - ArmArchTimerReadReg (CntvCt, (VOID *)&SystemCount); > - > - return SystemCount; > + return ArmReadCntvCt (); > } > > UINTN > @@ -112,10 +104,7 @@ ArmGenericTimerGetTimerCtrlReg ( > VOID > ) > { > - UINTN Value; > - ArmArchTimerReadReg (CntvCtl, (VOID *)&Value); > - > - return Value; > + return ArmReadCntvCtl (); > } > > VOID > @@ -124,7 +113,7 @@ ArmGenericTimerSetTimerCtrlReg ( > UINTN Value > ) > { > - ArmArchTimerWriteReg (CntvCtl, (VOID *)&Value); > + ArmWriteCntvCtl (Value); > } > > UINT64 > @@ -133,10 +122,7 @@ ArmGenericTimerGetCompareVal ( > VOID > ) > { > - UINT64 Value; > - ArmArchTimerReadReg (CntvCval, (VOID *)&Value); > - > - return Value; > + return ArmReadCntvCval (); > } > > VOID > @@ -145,5 +131,5 @@ ArmGenericTimerSetCompareVal ( > IN UINT64 Value > ) > { > - ArmArchTimerWriteReg (CntvCval, (VOID *)&Value); > + ArmWriteCntvCval (Value); > } > diff --git a/ArmPkg/Library/ArmLib/AArch64/AArch64ArchTimer.c b/ArmPkg/Library/ArmLib/AArch64/AArch64ArchTimer.c > deleted file mode 100644 > index 31286eefff30..000000000000 > --- a/ArmPkg/Library/ArmLib/AArch64/AArch64ArchTimer.c > +++ /dev/null > @@ -1,167 +0,0 @@ > -/** @file > -* > -* Copyright (c) 2011-2013, 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 > -* which accompanies this distribution. The full text of the license may be found at > -* http://opensource.org/licenses/bsd-license.php > -* > -* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, > -* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. > -* > -**/ > - > -#include > -#include > -#include > -#include > -#include > -#include > -#include "AArch64Lib.h" > -#include "ArmLibPrivate.h" > -#include > - > -VOID > -EFIAPI > -ArmArchTimerReadReg ( > - IN ARM_ARCH_TIMER_REGS Reg, > - OUT VOID *DstBuf > - ) > -{ > - // Check if the Generic/Architecture timer is implemented > - if (ArmIsArchTimerImplemented ()) { > - > - switch (Reg) { > - > - case CntFrq: > - *((UINTN *)DstBuf) = ArmReadCntFrq (); > - break; > - > - case CntPct: > - *((UINT64 *)DstBuf) = ArmReadCntPct (); > - break; > - > - case CntkCtl: > - *((UINTN *)DstBuf) = ArmReadCntkCtl(); > - break; > - > - case CntpTval: > - *((UINTN *)DstBuf) = ArmReadCntpTval (); > - break; > - > - case CntpCtl: > - *((UINTN *)DstBuf) = ArmReadCntpCtl (); > - break; > - > - case CntvTval: > - *((UINTN *)DstBuf) = ArmReadCntvTval (); > - break; > - > - case CntvCtl: > - *((UINTN *)DstBuf) = ArmReadCntvCtl (); > - break; > - > - case CntvCt: > - *((UINT64 *)DstBuf) = ArmReadCntvCt (); > - break; > - > - case CntpCval: > - *((UINT64 *)DstBuf) = ArmReadCntpCval (); > - break; > - > - case CntvCval: > - *((UINT64 *)DstBuf) = ArmReadCntvCval (); > - break; > - > - case CntvOff: > - *((UINT64 *)DstBuf) = ArmReadCntvOff (); > - break; > - > - case CnthCtl: > - case CnthpTval: > - case CnthpCtl: > - case CnthpCval: > - DEBUG ((EFI_D_ERROR, "The register is related to Hypervisor Mode. Can't perform requested operation\n ")); > - break; > - > - default: > - DEBUG ((EFI_D_ERROR, "Unknown ARM Generic Timer register %x. \n ", Reg)); > - } > - } else { > - DEBUG ((EFI_D_ERROR, "Attempt to read ARM Generic Timer registers. But ARM Generic Timer extension is not implemented \n ")); > - ASSERT (0); > - } > -} > - > -VOID > -EFIAPI > -ArmArchTimerWriteReg ( > - IN ARM_ARCH_TIMER_REGS Reg, > - IN VOID *SrcBuf > - ) > -{ > - // Check if the Generic/Architecture timer is implemented > - if (ArmIsArchTimerImplemented ()) { > - > - switch (Reg) { > - > - case CntFrq: > - ArmWriteCntFrq (*((UINTN *)SrcBuf)); > - break; > - > - case CntPct: > - DEBUG ((EFI_D_ERROR, "Can't write to Read Only Register: CNTPCT \n")); > - break; > - > - case CntkCtl: > - ArmWriteCntkCtl (*((UINTN *)SrcBuf)); > - break; > - > - case CntpTval: > - ArmWriteCntpTval (*((UINTN *)SrcBuf)); > - break; > - > - case CntpCtl: > - ArmWriteCntpCtl (*((UINTN *)SrcBuf)); > - break; > - > - case CntvTval: > - ArmWriteCntvTval (*((UINTN *)SrcBuf)); > - break; > - > - case CntvCtl: > - ArmWriteCntvCtl (*((UINTN *)SrcBuf)); > - break; > - > - case CntvCt: > - DEBUG ((EFI_D_ERROR, "Can't write to Read Only Register: CNTVCT \n")); > - break; > - > - case CntpCval: > - ArmWriteCntpCval (*((UINT64 *)SrcBuf) ); > - break; > - > - case CntvCval: > - ArmWriteCntvCval (*((UINT64 *)SrcBuf) ); > - break; > - > - case CntvOff: > - ArmWriteCntvOff (*((UINT64 *)SrcBuf)); > - break; > - > - case CnthCtl: > - case CnthpTval: > - case CnthpCtl: > - case CnthpCval: > - DEBUG ((EFI_D_ERROR, "The register is related to Hypervisor Mode. Can't perform requested operation\n ")); > - break; > - > - default: > - DEBUG ((EFI_D_ERROR, "Unknown ARM Generic Timer register %x. \n ", Reg)); > - } > - } else { > - DEBUG ((EFI_D_ERROR, "Attempt to write to ARM Generic Timer registers. But ARM Generic Timer extension is not implemented \n ")); > - ASSERT (0); > - } > -} > diff --git a/ArmPkg/Library/ArmLib/Arm/ArmV7ArchTimer.c b/ArmPkg/Library/ArmLib/Arm/ArmV7ArchTimer.c > deleted file mode 100644 > index c0b3a9ed5d24..000000000000 > --- a/ArmPkg/Library/ArmLib/Arm/ArmV7ArchTimer.c > +++ /dev/null > @@ -1,167 +0,0 @@ > -/** @file > -* > -* 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 > -* which accompanies this distribution. The full text of the license may be found at > -* http://opensource.org/licenses/bsd-license.php > -* > -* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, > -* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. > -* > -**/ > - > -#include > -#include > -#include > -#include > -#include > -#include > -#include "ArmV7Lib.h" > -#include "ArmLibPrivate.h" > -#include > - > -VOID > -EFIAPI > -ArmArchTimerReadReg ( > - IN ARM_ARCH_TIMER_REGS Reg, > - OUT VOID *DstBuf > - ) > -{ > - // Check if the Generic/Architecture timer is implemented > - if (ArmIsArchTimerImplemented ()) { > - switch (Reg) { > - case CntFrq: > - *((UINTN *)DstBuf) = ArmReadCntFrq (); > - return; > - > - case CntPct: > - *((UINT64 *)DstBuf) = ArmReadCntPct (); > - return; > - > - case CntkCtl: > - *((UINTN *)DstBuf) = ArmReadCntkCtl(); > - return; > - > - case CntpTval: > - *((UINTN *)DstBuf) = ArmReadCntpTval (); > - return; > - > - case CntpCtl: > - *((UINTN *)DstBuf) = ArmReadCntpCtl (); > - return; > - > - case CntvTval: > - *((UINTN *)DstBuf) = ArmReadCntvTval (); > - return; > - > - case CntvCtl: > - *((UINTN *)DstBuf) = ArmReadCntvCtl (); > - return; > - > - case CntvCt: > - *((UINT64 *)DstBuf) = ArmReadCntvCt (); > - return; > - > - case CntpCval: > - *((UINT64 *)DstBuf) = ArmReadCntpCval (); > - return; > - > - case CntvCval: > - *((UINT64 *)DstBuf) = ArmReadCntvCval (); > - return; > - > - case CntvOff: > - *((UINT64 *)DstBuf) = ArmReadCntvOff (); > - return; > - > - case CnthCtl: > - case CnthpTval: > - case CnthpCtl: > - case CnthpCval: > - DEBUG ((EFI_D_ERROR, "The register is related to Hypervisor Mode. Can't perform requested operation\n ")); > - break; > - > - default: > - DEBUG ((EFI_D_ERROR, "Unknown ARM Generic Timer register %x. \n ", Reg)); > - } > - } else { > - DEBUG ((EFI_D_ERROR, "Attempt to read ARM Generic Timer registers. But ARM Generic Timer extension is not implemented \n ")); > - ASSERT (0); > - } > - > - *((UINT64 *)DstBuf) = 0; > -} > - > -VOID > -EFIAPI > -ArmArchTimerWriteReg ( > - IN ARM_ARCH_TIMER_REGS Reg, > - IN VOID *SrcBuf > - ) > -{ > - // Check if the Generic/Architecture timer is implemented > - if (ArmIsArchTimerImplemented ()) { > - > - switch (Reg) { > - > - case CntFrq: > - ArmWriteCntFrq (*((UINTN *)SrcBuf)); > - break; > - > - case CntPct: > - DEBUG ((EFI_D_ERROR, "Can't write to Read Only Register: CNTPCT \n")); > - break; > - > - case CntkCtl: > - ArmWriteCntkCtl (*((UINTN *)SrcBuf)); > - break; > - > - case CntpTval: > - ArmWriteCntpTval (*((UINTN *)SrcBuf)); > - break; > - > - case CntpCtl: > - ArmWriteCntpCtl (*((UINTN *)SrcBuf)); > - break; > - > - case CntvTval: > - ArmWriteCntvTval (*((UINTN *)SrcBuf)); > - break; > - > - case CntvCtl: > - ArmWriteCntvCtl (*((UINTN *)SrcBuf)); > - break; > - > - case CntvCt: > - DEBUG ((EFI_D_ERROR, "Can't write to Read Only Register: CNTVCT \n")); > - break; > - > - case CntpCval: > - ArmWriteCntpCval (*((UINT64 *)SrcBuf) ); > - break; > - > - case CntvCval: > - ArmWriteCntvCval (*((UINT64 *)SrcBuf) ); > - break; > - > - case CntvOff: > - ArmWriteCntvOff (*((UINT64 *)SrcBuf)); > - break; > - > - case CnthCtl: > - case CnthpTval: > - case CnthpCtl: > - case CnthpCval: > - DEBUG ((EFI_D_ERROR, "The register is related to Hypervisor Mode. Can't perform requested operation\n ")); > - break; > - > - default: > - DEBUG ((EFI_D_ERROR, "Unknown ARM Generic Timer register %x. \n ", Reg)); > - } > - } else { > - DEBUG ((EFI_D_ERROR, "Attempt to write to ARM Generic Timer registers. But ARM Generic Timer extension is not implemented \n ")); > - ASSERT (0); > - } > -} > diff --git a/ArmPkg/Library/ArmLib/ArmBaseLib.inf b/ArmPkg/Library/ArmLib/ArmBaseLib.inf > index 05a585343cda..79e17be6d411 100644 > --- a/ArmPkg/Library/ArmLib/ArmBaseLib.inf > +++ b/ArmPkg/Library/ArmLib/ArmBaseLib.inf > @@ -27,7 +27,6 @@ [Sources] > > [Sources.ARM] > Arm/ArmV7Lib.c > - Arm/ArmV7ArchTimer.c > > Arm/ArmLibSupport.S | GCC > Arm/ArmLibSupportV7.S | GCC > @@ -41,7 +40,6 @@ [Sources.ARM] > > [Sources.AARCH64] > AArch64/AArch64Lib.c > - AArch64/AArch64ArchTimer.c > > AArch64/ArmLibSupport.S > AArch64/ArmLibSupportV8.S > -- > 2.7.4 > [1] https://github.com/tianocore/edk2/commit/90d1f671cdad43fa80ba295b3f8d1133d68229df 90d1f67 2017-01-20 ArmPlatformPkg/NorFlashDxe: Change Flash memory attributes before writes [Achin Gupta]