From patchwork Mon Jan 26 19:03:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 43783 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-we0-f198.google.com (mail-we0-f198.google.com [74.125.82.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 540CD20D5D for ; Mon, 26 Jan 2015 19:04:45 +0000 (UTC) Received: by mail-we0-f198.google.com with SMTP id q59sf5294533wes.1 for ; Mon, 26 Jan 2015 11:04:44 -0800 (PST) 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=PVZ6Gam56h77gM02Hf4nAgN47BMFxf3+RSKk9uojXDs=; b=Jr3MK+w0ndVfZgsGCx/KdBsruWi+aDnm2QbpG+X9q9tYB6cxGw8t1Xq1ajzF1FaPgk Br+Qe/34+qhbmdShf89+QTYz12CE+IckVnFtqEXD/A1ge8dgh1dNNe5VHB8UD0wtSE9J Pa/pOTNZajsAtjtt+2mlX+5VEPfBCH6JUnwFAZfc2/LPUNZIf+i0Q3P3m4XhFqUny6Fu YJR1fhbOHSq/EQ1j5OsoRAwUfnHZedF/5nv7eKTiN4RKuRuY//jUeKvBrlaa2+dA6ecH a8k8XHLB+Fodr5kitawasW+C1Xpju5Uh8AZbV/bxRtSAL+UqxNBkAhGyxnJF0ISUFx7S nbOg== X-Gm-Message-State: ALoCoQn3vPgUt+EEfkty0+KVCcO+xmRQOqw/T6ofk/Oygr66X5wFCmlGk6E5ATEhmTPgK//DDcH0 X-Received: by 10.152.87.15 with SMTP id t15mr1489999laz.9.1422299084529; Mon, 26 Jan 2015 11:04:44 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.204.104 with SMTP id kx8ls539356lac.82.gmail; Mon, 26 Jan 2015 11:04:44 -0800 (PST) X-Received: by 10.112.161.34 with SMTP id xp2mr22741050lbb.73.1422299084336; Mon, 26 Jan 2015 11:04:44 -0800 (PST) Received: from mail-la0-f46.google.com (mail-la0-f46.google.com. [209.85.215.46]) by mx.google.com with ESMTPS id fb6si9761652lbc.117.2015.01.26.11.04.44 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 26 Jan 2015 11:04:44 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.46 as permitted sender) client-ip=209.85.215.46; Received: by mail-la0-f46.google.com with SMTP id s18so9416756lam.5 for ; Mon, 26 Jan 2015 11:04:44 -0800 (PST) X-Received: by 10.112.180.135 with SMTP id do7mr22611338lbc.23.1422299084249; Mon, 26 Jan 2015 11:04:44 -0800 (PST) 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.35.133 with SMTP id h5csp870358lbj; Mon, 26 Jan 2015 11:04:43 -0800 (PST) X-Received: by 10.50.102.4 with SMTP id fk4mr17954102igb.28.1422299079539; Mon, 26 Jan 2015 11:04:39 -0800 (PST) Received: from lists.sourceforge.net (lists.sourceforge.net. [216.34.181.88]) by mx.google.com with ESMTPS id j189si8033641ioe.54.2015.01.26.11.04.38 (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 26 Jan 2015 11:04:39 -0800 (PST) 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 1YFoxW-00078H-Oy; Mon, 26 Jan 2015 19:04:26 +0000 Received: from sog-mx-1.v43.ch3.sourceforge.com ([172.29.43.191] helo=mx.sourceforge.net) by sfs-ml-2.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1YFoxV-000789-SN for edk2-devel@lists.sourceforge.net; Mon, 26 Jan 2015 19:04:25 +0000 Received-SPF: pass (sog-mx-1.v43.ch3.sourceforge.com: domain of linaro.org designates 74.125.82.170 as permitted sender) client-ip=74.125.82.170; envelope-from=ard.biesheuvel@linaro.org; helo=mail-we0-f170.google.com; Received: from mail-we0-f170.google.com ([74.125.82.170]) by sog-mx-1.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-SHA:128) (Exim 4.76) id 1YFoxV-0005cd-1H for edk2-devel@lists.sourceforge.net; Mon, 26 Jan 2015 19:04:27 +0000 Received: by mail-we0-f170.google.com with SMTP id w55so5425776wes.1 for ; Mon, 26 Jan 2015 11:04:20 -0800 (PST) X-Received: by 10.194.61.145 with SMTP id p17mr44869330wjr.35.1422299055311; Mon, 26 Jan 2015 11:04:15 -0800 (PST) Received: from ards-macbook-pro.local ([197.129.8.190]) by mx.google.com with ESMTPSA id fo17sm15471007wjc.19.2015.01.26.11.04.12 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 26 Jan 2015 11:04:14 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.sourceforge.net, lersek@redhat.com, olivier.martin@arm.com, roy.franz@linaro.org, leif.lindholm@linaro.org, stefano.stabellini@eu.citrix.com, ian.campbell@citrix.com, anthony.perard@citrix.com, christoffer.dall@linaro.org, xen-devel@lists.xen.org, ilias.biris@linaro.org Date: Mon, 26 Jan 2015 19:03:11 +0000 Message-Id: <1422299011-2409-10-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1422299011-2409-1-git-send-email-ard.biesheuvel@linaro.org> References: <1422299011-2409-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: 1YFoxV-0005cd-1H Subject: [edk2] [PATCH v2 09/29] ArmPlatformPkg/PrePi: allow use of patchable PCDs 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.46 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 Avoid using FixedPcdGetXX () to reference system memory and FD base address PCDs so that the platform can choose to use patchable PCDs instead. This allows a runtime self-relocating PrePi to poke alternate values into them that can only be discovered at runtime. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel --- ArmPlatformPkg/PrePi/AArch64/ModuleEntryPoint.S | 8 ++++---- ArmPlatformPkg/PrePi/PrePi.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ArmPlatformPkg/PrePi/AArch64/ModuleEntryPoint.S b/ArmPlatformPkg/PrePi/AArch64/ModuleEntryPoint.S index fcea9496cbd5..3fa6bf1f0322 100644 --- a/ArmPlatformPkg/PrePi/AArch64/ModuleEntryPoint.S +++ b/ArmPlatformPkg/PrePi/AArch64/ModuleEntryPoint.S @@ -42,14 +42,14 @@ _SetSVCMode: // at the top of the DRAM) _SetupStackPosition: // Compute Top of System Memory - LoadConstantToReg (FixedPcdGet64 (PcdSystemMemoryBase), x1) - LoadConstantToReg (FixedPcdGet64 (PcdSystemMemorySize), x2) + ldr x1, PcdGet64 (PcdSystemMemoryBase) + ldr x2, PcdGet64 (PcdSystemMemorySize) sub x2, x2, #1 add x1, x1, x2 // x1 = SystemMemoryTop = PcdSystemMemoryBase + PcdSystemMemorySize // Calculate Top of the Firmware Device - LoadConstantToReg (FixedPcdGet32(PcdFdBaseAddress), x2) - LoadConstantToReg (FixedPcdGet32(PcdFdSize), x3) + ldr x2, PcdGet64 (PcdFdBaseAddress) + ldr w3, PcdGet32 (PcdFdSize) sub x3, x3, #1 add x3, x3, x2 // x3 = FdTop = PcdFdBaseAddress + PcdFdSize diff --git a/ArmPlatformPkg/PrePi/PrePi.c b/ArmPlatformPkg/PrePi/PrePi.c index 9a5e067ef537..0e551c518d6b 100755 --- a/ArmPlatformPkg/PrePi/PrePi.c +++ b/ArmPlatformPkg/PrePi/PrePi.c @@ -30,8 +30,8 @@ #include "PrePi.h" #include "LzmaDecompress.h" -#define IS_XIP() (((UINT32)FixedPcdGet32 (PcdFdBaseAddress) > (UINT32)(FixedPcdGet64 (PcdSystemMemoryBase) + FixedPcdGet32 (PcdSystemMemorySize))) || \ - ((FixedPcdGet32 (PcdFdBaseAddress) + FixedPcdGet32 (PcdFdSize)) < FixedPcdGet64 (PcdSystemMemoryBase))) +#define IS_XIP() (((UINT32)PcdGet64 (PcdFdBaseAddress) > (UINT32)(PcdGet64 (PcdSystemMemoryBase) + PcdGet64 (PcdSystemMemorySize))) || \ + ((PcdGet64 (PcdFdBaseAddress) + PcdGet32 (PcdFdSize)) < PcdGet64 (PcdSystemMemoryBase))) // Not used when PrePi in run in XIP mode UINTN mGlobalVariableBase = 0; @@ -108,8 +108,8 @@ PrePiMain ( // If ensure the FD is either part of the System Memory or totally outside of the System Memory (XIP) ASSERT (IS_XIP() || - ((FixedPcdGet32 (PcdFdBaseAddress) >= FixedPcdGet64 (PcdSystemMemoryBase)) && - ((UINT32)(FixedPcdGet32 (PcdFdBaseAddress) + FixedPcdGet32 (PcdFdSize)) <= (UINT32)(FixedPcdGet64 (PcdSystemMemoryBase) + FixedPcdGet64 (PcdSystemMemorySize))))); + ((PcdGet64 (PcdFdBaseAddress) >= PcdGet64 (PcdSystemMemoryBase)) && + ((UINT32)(PcdGet64 (PcdFdBaseAddress) + PcdGet32 (PcdFdSize)) <= (UINT32)(PcdGet64 (PcdSystemMemoryBase) + PcdGet64 (PcdSystemMemorySize))))); // Initialize the architecture specific bits ArchInitialize ();