From patchwork Wed Sep 3 11:18:03 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 36572 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f200.google.com (mail-ob0-f200.google.com [209.85.214.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id E95B8202E4 for ; Wed, 3 Sep 2014 11:18:56 +0000 (UTC) Received: by mail-ob0-f200.google.com with SMTP id va2sf44610224obc.3 for ; Wed, 03 Sep 2014 04:18:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:cc:subject:precedence:reply-to:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version :errors-to:x-original-sender:x-original-authentication-results :mailing-list:content-type:content-transfer-encoding; bh=QffxpMUC4SZO3S8ByDy8VVwRBCqGE0NsSFTAEXJdnzo=; b=WTVUSTcPjpR1dzNUByX5SHlq350YSCjjzMb01pJoQhYPN0imU5scXrPKhdynrntCh5 H7U474VkMvKWkxZmjYsfH135anC7gBxQh3/J285/U536WX6C5G4TDQWXVkG7Y1EWIm1a lyRes88hHV+6lXTW+0UudvxZgDwsnwwbt+AqDCWH3rtV2G77lVA72AzSOfz7ip/QmPgT WdxEdz+1oVSXKDfsnUwQf1JVGD4AbMeQSFVccO2eq4PV4G+hEAjNYA+7P9GDR09MvPFG 6vvtpxbxMsHlv6G7JZKJLt/tOhI/HNSGG2y7Iev9ayROs5R1Bgg8fAwVuv0xxiQwEWsJ w60A== X-Gm-Message-State: ALoCoQkYJwLBFdBw8LWDRm9FHBhcjyGqu0+b7dXZcXZVvLnhKk1x4vXXwrEvWuJxZK4DBwr9FxvB X-Received: by 10.182.56.200 with SMTP id c8mr23566510obq.7.1409743136598; Wed, 03 Sep 2014 04:18:56 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.107.182 with SMTP id h51ls2768311qgf.80.gmail; Wed, 03 Sep 2014 04:18:56 -0700 (PDT) X-Received: by 10.220.77.65 with SMTP id f1mr38445vck.48.1409743136489; Wed, 03 Sep 2014 04:18:56 -0700 (PDT) Received: from mail-vc0-f174.google.com (mail-vc0-f174.google.com [209.85.220.174]) by mx.google.com with ESMTPS id p18si710395vdg.54.2014.09.03.04.18.56 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 03 Sep 2014 04:18:56 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.174 as permitted sender) client-ip=209.85.220.174; Received: by mail-vc0-f174.google.com with SMTP id hy4so8644557vcb.33 for ; Wed, 03 Sep 2014 04:18:56 -0700 (PDT) X-Received: by 10.220.187.134 with SMTP id cw6mr25783vcb.71.1409743136410; Wed, 03 Sep 2014 04:18:56 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.45.67 with SMTP id uj3csp663959vcb; Wed, 3 Sep 2014 04:18:55 -0700 (PDT) X-Received: by 10.50.80.116 with SMTP id q20mr36368172igx.22.1409743135461; Wed, 03 Sep 2014 04:18:55 -0700 (PDT) Received: from lists.sourceforge.net (lists.sourceforge.net. [216.34.181.88]) by mx.google.com with ESMTPS id w5si1694364igb.16.2014.09.03.04.18.54 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 03 Sep 2014 04:18:55 -0700 (PDT) Received-SPF: pass (google.com: domain of edk2-devel-bounces@lists.sourceforge.net designates 216.34.181.88 as permitted sender) client-ip=216.34.181.88; Received: from localhost ([127.0.0.1] helo=sfs-ml-4.v29.ch3.sourceforge.com) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1XP8aN-0003Y6-Bu; Wed, 03 Sep 2014 11:18:47 +0000 Received: from sog-mx-2.v43.ch3.sourceforge.com ([172.29.43.192] helo=mx.sourceforge.net) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1XP8aL-0003XV-F1 for edk2-devel@lists.sourceforge.net; Wed, 03 Sep 2014 11:18:45 +0000 Received-SPF: pass (sog-mx-2.v43.ch3.sourceforge.com: domain of linaro.org designates 74.125.82.171 as permitted sender) client-ip=74.125.82.171; envelope-from=ard.biesheuvel@linaro.org; helo=mail-we0-f171.google.com; Received: from mail-we0-f171.google.com ([74.125.82.171]) by sog-mx-2.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-SHA:128) (Exim 4.76) id 1XP8aK-0005Et-83 for edk2-devel@lists.sourceforge.net; Wed, 03 Sep 2014 11:18:45 +0000 Received: by mail-we0-f171.google.com with SMTP id u56so8403850wes.30 for ; Wed, 03 Sep 2014 04:18:38 -0700 (PDT) X-Received: by 10.194.81.37 with SMTP id w5mr47151216wjx.12.1409743118008; Wed, 03 Sep 2014 04:18:38 -0700 (PDT) Received: from ards-macbook-pro.local (cag06-7-83-153-85-71.fbx.proxad.net. [83.153.85.71]) by mx.google.com with ESMTPSA id p1sm15258661wjy.22.2014.09.03.04.18.36 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 03 Sep 2014 04:18:37 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.sourceforge.net, lersek@redhat.com, olivier.martin@arm.com Date: Wed, 3 Sep 2014 13:18:03 +0200 Message-Id: <1409743096-14919-11-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1409743096-14919-1-git-send-email-ard.biesheuvel@linaro.org> References: <1409743096-14919-1-git-send-email-ard.biesheuvel@linaro.org> X-Spam-Score: -1.5 (-) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -1.5 SPF_CHECK_PASS SPF reports sender host as permitted sender for sender-domain -0.0 SPF_PASS SPF: sender matches SPF record X-Headers-End: 1XP8aK-0005Et-83 Cc: peter.maydell@linaro.org, ilias.biris@linaro.org, christoffer.dall@linaro.org Subject: [edk2] [PATCH v6 10/23] ArmPkg: move TimerDxe and ArmArchTimerLib to new ArmGenericTimerCounterLib X-BeenThere: edk2-devel@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list Reply-To: edk2-devel@lists.sourceforge.net List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.sourceforge.net X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ard.biesheuvel@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.174 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Update TimerDxe and ArmArchTimerLib to use 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 Signed-off-by: Ard Biesheuvel --- ArmPkg/Drivers/TimerDxe/TimerDxe.c | 1 + ArmPkg/Drivers/TimerDxe/TimerDxe.inf | 1 + ArmPkg/Include/Library/ArmArchTimer.h | 66 ------------ ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.c | 2 +- ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.inf | 1 + ArmPkg/Library/ArmLib/AArch64/AArch64ArchTimer.c | 119 --------------------- ArmPkg/Library/ArmLib/ArmV7/ArmV7ArchTimer.c | 119 --------------------- .../ArmRealViewEbPkg/ArmRealViewEb.dsc.inc | 1 + ArmPlatformPkg/ArmVExpressPkg/ArmVExpress.dsc.inc | 1 + 9 files changed, 6 insertions(+), 305 deletions(-) diff --git a/ArmPkg/Drivers/TimerDxe/TimerDxe.c b/ArmPkg/Drivers/TimerDxe/TimerDxe.c index 6c4494ed4ce6..99a8665afa3f 100644 --- a/ArmPkg/Drivers/TimerDxe/TimerDxe.c +++ b/ArmPkg/Drivers/TimerDxe/TimerDxe.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include diff --git a/ArmPkg/Drivers/TimerDxe/TimerDxe.inf b/ArmPkg/Drivers/TimerDxe/TimerDxe.inf index 161d286d9c57..9e9768fbb567 100644 --- a/ArmPkg/Drivers/TimerDxe/TimerDxe.inf +++ b/ArmPkg/Drivers/TimerDxe/TimerDxe.inf @@ -41,6 +41,7 @@ DebugLib UefiDriverEntryPoint IoLib + ArmGenericTimerCounterLib [Guids] diff --git a/ArmPkg/Include/Library/ArmArchTimer.h b/ArmPkg/Include/Library/ArmArchTimer.h index c41b53ee4143..876c1f65c525 100644 --- a/ArmPkg/Include/Library/ArmArchTimer.h +++ b/ArmPkg/Include/Library/ArmArchTimer.h @@ -52,70 +52,4 @@ ArmArchTimerWriteReg ( IN VOID *SrcBuf ); -VOID -EFIAPI -ArmArchTimerEnableTimer ( - VOID - ); - -VOID -EFIAPI -ArmArchTimerDisableTimer ( - VOID - ); - -VOID -EFIAPI -ArmArchTimerSetTimerFreq ( - IN UINTN FreqInHz - ); - -UINTN -EFIAPI -ArmArchTimerGetTimerFreq ( - VOID - ); - -VOID -EFIAPI -ArmArchTimerSetTimerVal ( - IN UINTN Val - ); - -UINTN -EFIAPI -ArmArchTimerGetTimerVal ( - VOID - ); - -UINT64 -EFIAPI -ArmArchTimerGetSystemCount ( - VOID - ); - -UINTN -EFIAPI -ArmArchTimerGetTimerCtrlReg ( - VOID - ); - -VOID -EFIAPI -ArmArchTimerSetTimerCtrlReg ( - UINTN Val - ); - -UINT64 -EFIAPI -ArmArchTimerGetCompareVal ( - VOID - ); - -VOID -EFIAPI -ArmArchTimerSetCompareVal ( - IN UINT64 Val - ); - #endif // __ARM_ARCH_TIMER_H__ diff --git a/ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.c b/ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.c index ec4c39dbc989..137491187f14 100644 --- a/ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.c +++ b/ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.c @@ -20,7 +20,7 @@ #include #include #include -#include +#include #define TICKS_PER_MICRO_SEC (PcdGet32 (PcdArmArchTimerFreqInHz)/1000000U) diff --git a/ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.inf b/ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.inf index ecdf0837f121..03a4b1efa657 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 66a979f7046a..63ce1978c091 100644 --- a/ArmPkg/Library/ArmLib/AArch64/AArch64ArchTimer.c +++ b/ArmPkg/Library/ArmLib/AArch64/AArch64ArchTimer.c @@ -166,122 +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); -} - -UINT64 -EFIAPI -ArmArchTimerGetCompareVal ( - VOID - ) -{ - UINT64 Val; - ArmArchTimerReadReg (CntpCval, (VOID *)&Val); - - return 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 836c27329eca..49be71bbe088 100644 --- a/ArmPkg/Library/ArmLib/ArmV7/ArmV7ArchTimer.c +++ b/ArmPkg/Library/ArmLib/ArmV7/ArmV7ArchTimer.c @@ -166,122 +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); -} - -UINT64 -EFIAPI -ArmArchTimerGetCompareVal ( - VOID - ) -{ - UINT64 Val; - ArmArchTimerReadReg (CntpCval, (VOID *)&Val); - - return Val; -} - -VOID -EFIAPI -ArmArchTimerSetCompareVal ( - IN UINT64 Val - ) -{ - ArmArchTimerWriteReg (CntpCval, (VOID *)&Val); -} diff --git a/ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb.dsc.inc b/ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb.dsc.inc index 28a18eda3a50..bb6eb70fd458 100644 --- a/ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb.dsc.inc +++ b/ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb.dsc.inc @@ -62,6 +62,7 @@ DmaLib|ArmPkg/Library/ArmDmaLib/ArmDmaLib.inf ArmGicLib|ArmPkg/Drivers/ArmGic/ArmGicLib.inf ArmSmcLib|ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf + ArmGenericTimerCounterLib|ArmPkg/Library/ArmGenericTimerPhysCounterLib/ArmGenericTimerPhysCounterLib.inf # RealView Emulation Board Specific Libraries EfiResetSystemLib|ArmPlatformPkg/ArmRealViewEbPkg/Library/ResetSystemLib/ResetSystemLib.inf diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress.dsc.inc b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress.dsc.inc index 424c1311c55d..8e76e748fc5a 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress.dsc.inc +++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress.dsc.inc @@ -69,6 +69,7 @@ ArmGicLib|ArmPkg/Drivers/ArmGic/ArmGicLib.inf ArmPlatformStackLib|ArmPlatformPkg/Library/ArmPlatformStackLib/ArmPlatformStackLib.inf ArmSmcLib|ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf + ArmGenericTimerCounterLib|ArmPkg/Library/ArmGenericTimerPhysCounterLib/ArmGenericTimerPhysCounterLib.inf # Versatile Express Specific Libraries ArmPlatformSysConfigLib|ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSysConfigLib/ArmVExpressSysConfigLib.inf