From patchwork Tue Aug 26 13:03:43 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 36019 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oi0-f69.google.com (mail-oi0-f69.google.com [209.85.218.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 354092057E for ; Tue, 26 Aug 2014 13:04:46 +0000 (UTC) Received: by mail-oi0-f69.google.com with SMTP id i138sf10928480oig.4 for ; Tue, 26 Aug 2014 06:04: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=Hd7+duYhgQwIUiXU5G0knVup0+wgja18UuQ9TDdWPqfZfw0YRX8A0vYW2S5LwRQOn5 M9oB0W4BEE1BSQf3xxl2v8TVRA/nO42ACE7GKyElU2XHQ3ov2Rs5wcMH7fAmrQdcXx6i 95R11g9ItD6MWqu2ZSgWHlrbh0HKGAqAIeKGtgzDf4EY/RNn8ZUmDIX0xi79/ti6zlWL 0RERZh5w3YYzl+w64XY3Ds3I01qqQRGg6MZ7Krn2peSzz0V7J7849AW4sLcL8NP1A15Q lFteF1taedJmORNgT9l0ZmbAb0rjJxRsbsScIgnYqxbmr4brlHodtEuTjYMTl9qA5GF8 eWLQ== X-Gm-Message-State: ALoCoQloVzWIsFjrHm7pgWcM8i16RTG14v1i7ghSzxjAXqAp/ZFV1P5USy0cGgO1i5Dw3CudDXvP X-Received: by 10.50.117.10 with SMTP id ka10mr14068378igb.1.1409058285812; Tue, 26 Aug 2014 06:04:45 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.38.176 with SMTP id t45ls2470351qgt.60.gmail; Tue, 26 Aug 2014 06:04:45 -0700 (PDT) X-Received: by 10.52.94.36 with SMTP id cz4mr215936vdb.75.1409058285600; Tue, 26 Aug 2014 06:04:45 -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 mi2si1374268vcb.68.2014.08.26.06.04.45 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 26 Aug 2014 06:04:45 -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 hq11so16780392vcb.16 for ; Tue, 26 Aug 2014 06:04:45 -0700 (PDT) X-Received: by 10.220.187.134 with SMTP id cw6mr115422vcb.71.1409058285504; Tue, 26 Aug 2014 06:04: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 uj3csp197129vcb; Tue, 26 Aug 2014 06:04:45 -0700 (PDT) X-Received: by 10.50.111.167 with SMTP id ij7mr21848285igb.49.1409058264825; Tue, 26 Aug 2014 06:04:24 -0700 (PDT) Received: from lists.sourceforge.net (lists.sourceforge.net. [216.34.181.88]) by mx.google.com with ESMTPS id gd11si2801900igd.62.2014.08.26.06.04.24 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 26 Aug 2014 06:04:24 -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-2.v29.ch3.sourceforge.com) by sfs-ml-2.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1XMGQ0-0007e4-RD; Tue, 26 Aug 2014 13:04:12 +0000 Received: from sog-mx-3.v43.ch3.sourceforge.com ([172.29.43.193] helo=mx.sourceforge.net) by sfs-ml-2.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1XMGPz-0007dy-7L for edk2-devel@lists.sourceforge.net; Tue, 26 Aug 2014 13:04:11 +0000 Received-SPF: pass (sog-mx-3.v43.ch3.sourceforge.com: domain of linaro.org designates 74.125.82.176 as permitted sender) client-ip=74.125.82.176; envelope-from=ard.biesheuvel@linaro.org; helo=mail-we0-f176.google.com; Received: from mail-we0-f176.google.com ([74.125.82.176]) by sog-mx-3.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-SHA:128) (Exim 4.76) id 1XMGPv-0005VJ-07 for edk2-devel@lists.sourceforge.net; Tue, 26 Aug 2014 13:04:11 +0000 Received: by mail-we0-f176.google.com with SMTP id q58so14607336wes.7 for ; Tue, 26 Aug 2014 06:04:00 -0700 (PDT) X-Received: by 10.194.178.10 with SMTP id cu10mr2096122wjc.113.1409058240797; Tue, 26 Aug 2014 06:04:00 -0700 (PDT) Received: from ards-macbook-pro.local (BSN-143-76-23.dial-up.dsl.siol.net. [89.143.76.23]) by mx.google.com with ESMTPSA id l3sm12043420wib.11.2014.08.26.06.03.58 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 26 Aug 2014 06:04:00 -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: Tue, 26 Aug 2014 15:03:43 +0200 Message-Id: <1409058229-28802-3-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1409058229-28802-1-git-send-email-ard.biesheuvel@linaro.org> References: <1409058229-28802-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: 1XMGPv-0005VJ-07 Subject: [edk2] [PATCH v2 2/8] 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.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 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