From patchwork Mon Jul 6 18:26:24 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 50774 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f70.google.com (mail-wg0-f70.google.com [74.125.82.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id D333B218EA for ; Mon, 6 Jul 2015 18:27:00 +0000 (UTC) Received: by wgjx7 with SMTP id x7sf52677351wgj.3 for ; Mon, 06 Jul 2015 11:27:00 -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 :content-type:content-transfer-encoding:errors-to:x-original-sender :x-original-authentication-results:mailing-list; bh=aQB2eXW013ERkG8RBSSxCmUBOFCSpI4/tQbe1kCc5Y4=; b=REQHSUHZlWzgMwMZOeO3DisgHcU+iFSrGt8WH0MFLwSWOECr03F0kg94N/3TTSec3V k5FJ/11pJEHUnCELrFYH+nrNHBcGAazqtVmW6XfwXpRekCyv0GlEJpvGCuFmNz3GKlMS J470+F4g46e6HLFxm3rDE9LKp6sdge2uiWIbkuHH36oqG6bCZLJ+C9/R39rukB01GuVS /KyNMKDs16/eU5oNVcPtoCRsX7O09Rtbd04nGmnFGYgNuN6q4VuBBgWgKTuk97mIapwE FzygHGr74luK5Km1QN+vzckP8BE2vtjY1twaH8I2Bd8eQ3ZY/a4yA+jBHy4BDvdNpeiG xTAA== X-Gm-Message-State: ALoCoQktIUDXbiY/u1TiGfXsnGHvoRhPjfnDDTkZzjwvvMIr+ghqRMiTvGaNvW7x3PchNk3+/anC X-Received: by 10.180.182.49 with SMTP id eb17mr28981992wic.2.1436207220195; Mon, 06 Jul 2015 11:27:00 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.21.104 with SMTP id u8ls181675lae.31.gmail; Mon, 06 Jul 2015 11:26:59 -0700 (PDT) X-Received: by 10.152.43.37 with SMTP id t5mr202333lal.96.1436207219950; Mon, 06 Jul 2015 11:26:59 -0700 (PDT) Received: from mail-la0-f41.google.com (mail-la0-f41.google.com. [209.85.215.41]) by mx.google.com with ESMTPS id lv3si15895690lac.87.2015.07.06.11.26.59 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Jul 2015 11:26:59 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.41 as permitted sender) client-ip=209.85.215.41; Received: by laar3 with SMTP id r3so166515902laa.0 for ; Mon, 06 Jul 2015 11:26:59 -0700 (PDT) X-Received: by 10.152.22.99 with SMTP id c3mr236300laf.32.1436207219483; Mon, 06 Jul 2015 11:26:59 -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.112.108.230 with SMTP id hn6csp1891631lbb; Mon, 6 Jul 2015 11:26:58 -0700 (PDT) X-Received: by 10.50.8.68 with SMTP id p4mr45125769iga.4.1436207216685; Mon, 06 Jul 2015 11:26:56 -0700 (PDT) Received: from lists.sourceforge.net (lists.sourceforge.net. [216.34.181.88]) by mx.google.com with ESMTPS id x6si14027887igl.33.2015.07.06.11.26.55 (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 06 Jul 2015 11:26:56 -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-3.v29.ch3.sourceforge.com) by sfs-ml-3.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1ZCB6I-0003p6-9H; Mon, 06 Jul 2015 18:26:42 +0000 Received: from sog-mx-2.v43.ch3.sourceforge.com ([172.29.43.192] helo=mx.sourceforge.net) by sfs-ml-3.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1ZCB6G-0003ot-TF for edk2-devel@lists.sourceforge.net; Mon, 06 Jul 2015 18:26:40 +0000 Received-SPF: pass (sog-mx-2.v43.ch3.sourceforge.com: domain of linaro.org designates 209.85.212.180 as permitted sender) client-ip=209.85.212.180; envelope-from=ard.biesheuvel@linaro.org; helo=mail-wi0-f180.google.com; Received: from mail-wi0-f180.google.com ([209.85.212.180]) by sog-mx-2.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-SHA:128) (Exim 4.76) id 1ZCB6F-0005fn-Uk for edk2-devel@lists.sourceforge.net; Mon, 06 Jul 2015 18:26:40 +0000 Received: by wibdq8 with SMTP id dq8so161502885wib.1 for ; Mon, 06 Jul 2015 11:26:33 -0700 (PDT) X-Received: by 10.180.37.133 with SMTP id y5mr45079441wij.7.1436207193922; Mon, 06 Jul 2015 11:26:33 -0700 (PDT) Received: from ards-macbook-pro.arnhem.chello.nl (dhcp-077-250-063-167.chello.nl. [77.250.63.167]) by mx.google.com with ESMTPSA id fi6sm29908128wib.6.2015.07.06.11.26.32 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 06 Jul 2015 11:26:33 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.sourceforge.net, ryan.harkin@linaro.org, olivier.martin@arm.com, leif.lindholm@linaro.org Date: Mon, 6 Jul 2015 20:26:24 +0200 Message-Id: <1436207186-15424-2-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1436207186-15424-1-git-send-email-ard.biesheuvel@linaro.org> References: <1436207186-15424-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: 1ZCB6F-0005fn-Uk Subject: [edk2] [PATCH 1/3] ArmPlatformPkg/ArmVExpressPkg: add ArmPlatformSysConfigLib for runtime 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.215.41 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 This adds a ArmPlatformSysConfigLib implementation that is usable by DXE_RUNTIME_DRIVER modules. Since the system registers that this library encapsulates are not usable at runtime, this driver allows access to those registers only at boot time. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel --- ArmPlatformPkg/ArmVExpressPkg/Library/{ArmVExpressSysConfigLib/ArmVExpressSysConfig.c => ArmVExpressSysConfigRuntimeLib/ArmVExpressSysConfigRuntimeLib.c} | 10 ++++++++++ ArmPlatformPkg/ArmVExpressPkg/Library/{ArmVExpressSysConfigLib/ArmVExpressSysConfigLib.inf => ArmVExpressSysConfigRuntimeLib/ArmVExpressSysConfigRuntimeLib.inf} | 12 +++++++----- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSysConfigLib/ArmVExpressSysConfig.c b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSysConfigRuntimeLib/ArmVExpressSysConfigRuntimeLib.c similarity index 93% copy from ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSysConfigLib/ArmVExpressSysConfig.c copy to ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSysConfigRuntimeLib/ArmVExpressSysConfigRuntimeLib.c index 6dfbacd11762..1f915e3b0225 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSysConfigLib/ArmVExpressSysConfig.c +++ b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSysConfigRuntimeLib/ArmVExpressSysConfigRuntimeLib.c @@ -19,6 +19,9 @@ #include #include +#include +#include + // // SYS_CFGCTRL Bits // @@ -72,6 +75,10 @@ AccessSysCfgRegister ( { UINT32 SysCfgCtrl; + if (EfiAtRuntime ()) { + return RETURN_UNSUPPORTED; + } + // Clear the COMPLETE bit MmioAnd32(ARM_VE_SYS_CFGSTAT_REG, ~SYS_CFGSTAT_COMPLETE); @@ -229,6 +236,9 @@ ArmPlatformSysConfigSetDevice ( switch(Function) { case SYS_CFG_SCC: #ifdef ARM_VE_SCC_BASE + if (EfiAtRuntime ()) { + return RETURN_UNSUPPORTED; + } MmioWrite32 ((ARM_VE_SCC_BASE + (Device * 4)),Value); return RETURN_SUCCESS; #else diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSysConfigLib/ArmVExpressSysConfigLib.inf b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSysConfigRuntimeLib/ArmVExpressSysConfigRuntimeLib.inf similarity index 65% copy from ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSysConfigLib/ArmVExpressSysConfigLib.inf copy to ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSysConfigRuntimeLib/ArmVExpressSysConfigRuntimeLib.inf index b89455a421c3..988250d930cb 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSysConfigLib/ArmVExpressSysConfigLib.inf +++ b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSysConfigRuntimeLib/ArmVExpressSysConfigRuntimeLib.inf @@ -1,8 +1,9 @@ #/** @file # -# Component description file for ArmVExpressSysConfigLib module +# Component description file for ArmVExpressSysConfigRuntimeLib module # # Copyright (c) 2011-2012, ARM Ltd. All rights reserved.
+# Copyright (c) 2015, Linaro Ltd. All rights reserved.
# # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -16,14 +17,14 @@ [Defines] INF_VERSION = 0x00010005 - BASE_NAME = ArmVExpressSysConfigLib - FILE_GUID = a05b5cc0-82d2-11e0-82cb-0002a5d5c51b + BASE_NAME = ArmVExpressSysConfigRuntimeLib + FILE_GUID = 6275b819-615c-4a36-814a-c1f330b4e5d9 MODULE_TYPE = BASE VERSION_STRING = 1.0 - LIBRARY_CLASS = ArmPlatformSysConfigLib|SEC DXE_DRIVER + LIBRARY_CLASS = ArmPlatformSysConfigLib|DXE_RUNTIME_DRIVER [Sources.common] - ArmVExpressSysConfig.c + ArmVExpressSysConfigRuntimeLib.c [Packages] MdePkg/MdePkg.dec @@ -33,3 +34,4 @@ [Packages] [LibraryClasses] BaseLib IoLib + UefiRuntimeLib