From patchwork Thu Aug 28 14:13:50 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 36212 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qg0-f70.google.com (mail-qg0-f70.google.com [209.85.192.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id D991220551 for ; Thu, 28 Aug 2014 14:14:45 +0000 (UTC) Received: by mail-qg0-f70.google.com with SMTP id i50sf4586925qgf.9 for ; Thu, 28 Aug 2014 07:14:45 -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: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=RcCJox/CH4RbaO41gqNVXgeejAG+5oGA2N1tt6PKWBg=; b=awaIEhG5C6Gl5CX34RYoYEWxHGdBIBQLZG/1x0SolEJN+47UgNZW0fK/2jwK28HyIl JI3Bu55XIEvvkmQFrA+IOugY5RyQE74PNNkMD8TP+8WHQd9HtxTKbuwVoUWFwlRpxAtI t/MbG5aSH7hseWABjf13pafiFN6eSwoKO3vVahvzxWZUKHeIibQFDtZ3vEihGkgZ8Ixm ekQtGA7MqUozvV3vVbYVUQZgYcxrj2s3Rc46pXrvzCkIsris9UR4hzswjWsbw9Ou1nh3 IXNKU1J8uueY7jw/RsLBJCa3v96iQQocAlsHOefBXGaSB4H9zvOUQN4EfGe1c7LYwVDw JH/g== X-Gm-Message-State: ALoCoQmalTInCFOviRGjwHYs7XAbBHkb7qPLfGfQe01wcdQCnDGf/JGc+gnza4O6Q20FLmc2giOl X-Received: by 10.52.182.66 with SMTP id ec2mr2270429vdc.0.1409235285706; Thu, 28 Aug 2014 07:14:45 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.95.182 with SMTP id i51ls593023qge.20.gmail; Thu, 28 Aug 2014 07:14:45 -0700 (PDT) X-Received: by 10.52.141.76 with SMTP id rm12mr774160vdb.71.1409235285634; Thu, 28 Aug 2014 07:14:45 -0700 (PDT) Received: from mail-vc0-f172.google.com (mail-vc0-f172.google.com [209.85.220.172]) by mx.google.com with ESMTPS id i9si3559476vca.73.2014.08.28.07.14.45 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 28 Aug 2014 07:14:45 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.172 as permitted sender) client-ip=209.85.220.172; Received: by mail-vc0-f172.google.com with SMTP id ij19so862807vcb.31 for ; Thu, 28 Aug 2014 07:14:45 -0700 (PDT) X-Received: by 10.52.129.200 with SMTP id ny8mr2802802vdb.27.1409235285544; Thu, 28 Aug 2014 07:14:45 -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 uj3csp243458vcb; Thu, 28 Aug 2014 07:14:44 -0700 (PDT) X-Received: by 10.50.102.73 with SMTP id fm9mr5704484igb.44.1409235283401; Thu, 28 Aug 2014 07:14:43 -0700 (PDT) Received: from lists.sourceforge.net (lists.sourceforge.net. [216.34.181.88]) by mx.google.com with ESMTPS id t3si4250002ica.14.2014.08.28.07.14.42 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 28 Aug 2014 07:14:43 -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-1.v29.ch3.sourceforge.com) by sfs-ml-1.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1XN0TB-0004wH-GA; Thu, 28 Aug 2014 14:14:33 +0000 Received: from sog-mx-2.v43.ch3.sourceforge.com ([172.29.43.192] helo=mx.sourceforge.net) by sfs-ml-1.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1XN0T9-0004vq-9A for edk2-devel@lists.sourceforge.net; Thu, 28 Aug 2014 14:14:31 +0000 Received-SPF: pass (sog-mx-2.v43.ch3.sourceforge.com: domain of linaro.org designates 74.125.82.180 as permitted sender) client-ip=74.125.82.180; envelope-from=ard.biesheuvel@linaro.org; helo=mail-we0-f180.google.com; Received: from mail-we0-f180.google.com ([74.125.82.180]) by sog-mx-2.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-SHA:128) (Exim 4.76) id 1XN0T8-0002SZ-I4 for edk2-devel@lists.sourceforge.net; Thu, 28 Aug 2014 14:14:31 +0000 Received: by mail-we0-f180.google.com with SMTP id w61so833905wes.39 for ; Thu, 28 Aug 2014 07:14:21 -0700 (PDT) X-Received: by 10.194.87.41 with SMTP id u9mr3557795wjz.124.1409235261088; Thu, 28 Aug 2014 07:14:21 -0700 (PDT) Received: from ards-macbook-pro.local (BSN-61-108-214.dial-up.dsl.siol.net. [86.61.108.214]) by mx.google.com with ESMTPSA id bk6sm10278657wjb.26.2014.08.28.07.14.19 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 28 Aug 2014 07:14:20 -0700 (PDT) From: Ard Biesheuvel To: lersek@redhat.com, olivier.martin@arm.com, edk2-devel@lists.sourceforge.net, peter.maydell@linaro.org, christoffer.dall@linaro.org, drjones@redhat.com, ilias.biris@linaro.org, leif.lindholm@linaro.org Date: Thu, 28 Aug 2014 16:13:50 +0200 Message-Id: <1409235244-25783-3-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1409235244-25783-1-git-send-email-ard.biesheuvel@linaro.org> References: <1409235244-25783-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: 1XN0T8-0002SZ-I4 Subject: [edk2] [PATCH v4 02/16] ArmPkg: allow dynamically discovered virtual timer interrupt 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.172 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 To support booting on virtual machines whose interrupt routing is discovered from the device tree, allow the interrupt numbers to be redeclared as PcdsDynamic by the platform .dsc Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel --- ArmPkg/ArmPkg.dec | 2 ++ ArmPkg/Drivers/TimerDxe/TimerDxe.c | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ArmPkg/ArmPkg.dec b/ArmPkg/ArmPkg.dec index c2551d7c3307..0392af52758f 100644 --- a/ArmPkg/ArmPkg.dec +++ b/ArmPkg/ArmPkg.dec @@ -140,6 +140,8 @@ # Maximum file size for TFTP servers that do not support 'tsize' extension gArmTokenSpaceGuid.PcdMaxTftpFileSize|0x01000000|UINT32|0x00000000 + +[PcdsFixedAtBuild.common,PcdsDynamic.common] # # ARM Architectural Timer # diff --git a/ArmPkg/Drivers/TimerDxe/TimerDxe.c b/ArmPkg/Drivers/TimerDxe/TimerDxe.c index 9227be8326b0..2787f05c62be 100644 --- a/ArmPkg/Drivers/TimerDxe/TimerDxe.c +++ b/ArmPkg/Drivers/TimerDxe/TimerDxe.c @@ -36,6 +36,8 @@ EFI_EVENT EfiExitBootServicesEvent = (EFI_EVENT)NULL; // The current period of the timer interrupt UINT64 mTimerPeriod = 0; +UINTN mArmArchTimerTimerFreq = 0; + // Cached copy of the Hardware Interrupt protocol instance EFI_HARDWARE_INTERRUPT_PROTOCOL *gInterrupt = NULL; @@ -144,7 +146,7 @@ TimerDriverSetTimerPeriod ( // Convert TimerPeriod to micro sec units TimerTicks = DivU64x32 (TimerPeriod, 10); - TimerTicks = MultU64x32 (TimerTicks, (PcdGet32(PcdArmArchTimerFreqInHz)/1000000)); + TimerTicks = MultU64x32 (TimerTicks, mArmArchTimerTimerFreq); ArmArchTimerSetTimerVal((UINTN)TimerTicks); @@ -343,6 +345,8 @@ TimerInitialize ( Status = TimerDriverSetTimerPeriod (&gTimer, 0); ASSERT_EFI_ERROR (Status); + mArmArchTimerTimerFreq = ArmArchTimerGetTimerFreq () / 1000000; + // Install secure and Non-secure interrupt handlers // Note: Because it is not possible to determine the security state of the // CPU dynamically, we just install interrupt handler for both sec and non-sec