From patchwork Fri Sep 5 11:56:40 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 36824 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f71.google.com (mail-oa0-f71.google.com [209.85.219.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id CC012202E4 for ; Fri, 5 Sep 2014 11:57:35 +0000 (UTC) Received: by mail-oa0-f71.google.com with SMTP id g18sf59240197oah.10 for ; Fri, 05 Sep 2014 04:57:30 -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=U0KjTKkVKdR4R5gNfdV+EPJWM1hgsIRggeauAqILXtc=; b=lJwSAfNkHSBCei3UXSqqxj9vD0WKkI+xt1q19i8xJC73oekIWGqfFJi02nnf+ULSbv 1jJWZIkA01F/3cwUvKk5B2lLOZtMKg0Oby2o5AP6R7RyyX/FK96ufb1uYTRyIznPjDKH waLUbZ3jPub6tPtoWisyYgNbkixgyGmaibou5lHwIr+JR7RXnjhjLpR+9W+chyui4VX7 QoFMrqWdAbUwwgqf3H+thqRNz6t4KtslQj3N3c5kH6GV6myFgpyhWGBYbD1i1p7YlffD yVeYRlIqz6wHkEwEsQXA5jktzVFbsXaHvxEXNO4reoFJ0C7ZkdoJQUqe9nlQL1VvoMml FOVw== X-Gm-Message-State: ALoCoQm6TnB5vEAEdVYI/+ZItR0vk5hyhlphR+aAfc1NV8za2PVM1WktjTIAX1+Rj41P/WXo2/x/ X-Received: by 10.182.213.105 with SMTP id nr9mr6735433obc.36.1409918250272; Fri, 05 Sep 2014 04:57:30 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.108.230 with SMTP id j93ls747709qgf.31.gmail; Fri, 05 Sep 2014 04:57:30 -0700 (PDT) X-Received: by 10.52.149.209 with SMTP id uc17mr151869vdb.65.1409918250121; Fri, 05 Sep 2014 04:57:30 -0700 (PDT) Received: from mail-vc0-f171.google.com (mail-vc0-f171.google.com [209.85.220.171]) by mx.google.com with ESMTPS id um5si357906vcb.53.2014.09.05.04.57.30 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 05 Sep 2014 04:57:30 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.171 as permitted sender) client-ip=209.85.220.171; Received: by mail-vc0-f171.google.com with SMTP id id10so12203718vcb.16 for ; Fri, 05 Sep 2014 04:57:30 -0700 (PDT) X-Received: by 10.220.74.10 with SMTP id s10mr176450vcj.61.1409918250024; Fri, 05 Sep 2014 04:57:30 -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 uj3csp71047vcb; Fri, 5 Sep 2014 04:57:29 -0700 (PDT) X-Received: by 10.224.114.136 with SMTP id e8mr16943017qaq.67.1409918249300; Fri, 05 Sep 2014 04:57:29 -0700 (PDT) Received: from lists.sourceforge.net (lists.sourceforge.net. [216.34.181.88]) by mx.google.com with ESMTPS id t98si1184499qge.119.2014.09.05.04.57.28 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 05 Sep 2014 04:57:29 -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 1XPs8n-0002gL-K0; Fri, 05 Sep 2014 11:57:21 +0000 Received: from sog-mx-4.v43.ch3.sourceforge.com ([172.29.43.194] helo=mx.sourceforge.net) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1XPs8m-0002g8-1j for edk2-devel@lists.sourceforge.net; Fri, 05 Sep 2014 11:57:20 +0000 Received-SPF: pass (sog-mx-4.v43.ch3.sourceforge.com: domain of linaro.org designates 74.125.82.174 as permitted sender) client-ip=74.125.82.174; envelope-from=ard.biesheuvel@linaro.org; helo=mail-we0-f174.google.com; Received: from mail-we0-f174.google.com ([74.125.82.174]) by sog-mx-4.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-SHA:128) (Exim 4.76) id 1XPs8k-0002yN-QL for edk2-devel@lists.sourceforge.net; Fri, 05 Sep 2014 11:57:20 +0000 Received: by mail-we0-f174.google.com with SMTP id w61so210107wes.5 for ; Fri, 05 Sep 2014 04:57:12 -0700 (PDT) X-Received: by 10.194.58.148 with SMTP id r20mr14395968wjq.66.1409918232601; Fri, 05 Sep 2014 04:57:12 -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 dc9sm1758798wib.5.2014.09.05.04.57.11 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 05 Sep 2014 04:57:11 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.sourceforge.net, lersek@redhat.com, olivier.martin@arm.com Date: Fri, 5 Sep 2014 13:56:40 +0200 Message-Id: <1409918214-29584-11-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1409918214-29584-1-git-send-email-ard.biesheuvel@linaro.org> References: <1409918214-29584-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: 1XPs8k-0002yN-QL Cc: peter.maydell@linaro.org, ilias.biris@linaro.org, christoffer.dall@linaro.org Subject: [edk2] [PATCH v7 10/24] 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.171 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 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 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