From patchwork Thu Apr 30 07:12:06 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 47758 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f71.google.com (mail-wg0-f71.google.com [74.125.82.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 4B90220553 for ; Thu, 30 Apr 2015 07:12:41 +0000 (UTC) Received: by wgin8 with SMTP id n8sf12464355wgi.0 for ; Thu, 30 Apr 2015 00:12:40 -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=M525ixMBGm8FofPgTG1YCVu6ZUAuox1Oxs9t2tYEdk0=; b=NSklm9X/jkplXG/lmNNfd6uOQFbD4hFJhWyRe9mTMjblnZB1MTw2stcOcS4vgrr5zE 4aT+hIuOeqDVK/9oq/JDyObPLdVHWecXZhOwAqog7EzgBYiH7iiCGUhM3vw9A7gVKxHL PwvVXRz6cKCPrjKvgBrqxNeoJA7FF9YyLtQsc4/LGD9xTyZ8dU2JGljz5l2IJHYOQD3I Uh8v5PLFWcx7CqY1eKxQdHV5BCSzBQ5ivqGXX79BVVcvAtPfbKcKvzNqiMjFuBy9VwJS UO8p8cGXWK8VXtJnJCq8PH9M7jMEjnoC11eS/r4Qo/U4zGsRaKpuAY9ZXFnksPNgCEyP GP+w== X-Gm-Message-State: ALoCoQlqkT8gRsaTOO5aobfEanzqDdC17k5P/5bFaDZc2n4EP8MBcGBmUEHjbEAcvSKWC0wJUIuU X-Received: by 10.112.203.168 with SMTP id kr8mr1738820lbc.10.1430377960606; Thu, 30 Apr 2015 00:12:40 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.37.105 with SMTP id x9ls343695laj.11.gmail; Thu, 30 Apr 2015 00:12:40 -0700 (PDT) X-Received: by 10.152.1.4 with SMTP id 4mr2527104lai.25.1430377960465; Thu, 30 Apr 2015 00:12:40 -0700 (PDT) Received: from mail-la0-f45.google.com (mail-la0-f45.google.com. [209.85.215.45]) by mx.google.com with ESMTPS id h5si1094829laa.48.2015.04.30.00.12.40 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Apr 2015 00:12:40 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.45 as permitted sender) client-ip=209.85.215.45; Received: by labbd9 with SMTP id bd9so37354507lab.2 for ; Thu, 30 Apr 2015 00:12:40 -0700 (PDT) X-Received: by 10.113.10.134 with SMTP id ea6mr2486544lbd.29.1430377960362; Thu, 30 Apr 2015 00:12:40 -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.67.65 with SMTP id l1csp2938738lbt; Thu, 30 Apr 2015 00:12:39 -0700 (PDT) X-Received: by 10.42.64.76 with SMTP id f12mr7630370ici.93.1430377958844; Thu, 30 Apr 2015 00:12:38 -0700 (PDT) Received: from lists.sourceforge.net (lists.sourceforge.net. [216.34.181.88]) by mx.google.com with ESMTPS id gy8si1436627icb.23.2015.04.30.00.12.38 (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 30 Apr 2015 00:12:38 -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 1Ynie6-0000fN-Kq; Thu, 30 Apr 2015 07:12:30 +0000 Received: from sog-mx-3.v43.ch3.sourceforge.com ([172.29.43.193] helo=mx.sourceforge.net) by sfs-ml-1.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1Ynie5-0000fF-KK for edk2-devel@lists.sourceforge.net; Thu, 30 Apr 2015 07:12:29 +0000 Received-SPF: pass (sog-mx-3.v43.ch3.sourceforge.com: domain of linaro.org designates 209.85.212.182 as permitted sender) client-ip=209.85.212.182; envelope-from=ard.biesheuvel@linaro.org; helo=mail-wi0-f182.google.com; Received: from mail-wi0-f182.google.com ([209.85.212.182]) by sog-mx-3.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-SHA:128) (Exim 4.76) id 1Ynie3-0005Vm-Jr for edk2-devel@lists.sourceforge.net; Thu, 30 Apr 2015 07:12:29 +0000 Received: by wicmx19 with SMTP id mx19so6009280wic.1 for ; Thu, 30 Apr 2015 00:12:21 -0700 (PDT) X-Received: by 10.180.219.42 with SMTP id pl10mr2802258wic.70.1430377941637; Thu, 30 Apr 2015 00:12:21 -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 ha4sm1056830wib.0.2015.04.30.00.12.19 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 30 Apr 2015 00:12:20 -0700 (PDT) From: Ard Biesheuvel To: lersek@redhat.com, olivier.martin@arm.com, leif.lindholm@linaro.org, roy.franz@linaro.org, geoff@infradead.org, edk2-devel@lists.sourceforge.net Date: Thu, 30 Apr 2015 09:12:06 +0200 Message-Id: <1430377926-18431-3-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1430377926-18431-1-git-send-email-ard.biesheuvel@linaro.org> References: <1430377926-18431-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: 1Ynie3-0005Vm-Jr Subject: [edk2] [PATCH v2 2/2] ArmVExpressPkg: disallow the use of ArmVExpressSysConfigLib at 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.45 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 The ArmVExpressSysConfigLib library does not (and cannot) runtime remap its MMIO registers, so return RETURN_UNSUPPORTED when trying to use it after calling SetVirtualAddressMap(). Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel --- ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSysConfigLib/ArmVExpressSysConfig.c | 6 ++++++ ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSysConfigLib/ArmVExpressSysConfigLib.inf | 1 + 2 files changed, 7 insertions(+) diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSysConfigLib/ArmVExpressSysConfig.c b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSysConfigLib/ArmVExpressSysConfig.c index 6dfbacd11762..83b71aa2c1ad 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSysConfigLib/ArmVExpressSysConfig.c +++ b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSysConfigLib/ArmVExpressSysConfig.c @@ -13,8 +13,10 @@ **/ #include +#include #include #include +#include #include #include @@ -72,6 +74,10 @@ AccessSysCfgRegister ( { UINT32 SysCfgCtrl; + if (EfiGoneVirtual()) { + return RETURN_UNSUPPORTED; + } + // Clear the COMPLETE bit MmioAnd32(ARM_VE_SYS_CFGSTAT_REG, ~SYS_CFGSTAT_COMPLETE); diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSysConfigLib/ArmVExpressSysConfigLib.inf b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSysConfigLib/ArmVExpressSysConfigLib.inf index c1647756efbe..268202cc2038 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSysConfigLib/ArmVExpressSysConfigLib.inf +++ b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSysConfigLib/ArmVExpressSysConfigLib.inf @@ -33,3 +33,4 @@ [LibraryClasses] BaseLib IoLib + UefiRuntimeLib