From patchwork Wed Aug 27 15:12:54 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 36109 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ig0-f198.google.com (mail-ig0-f198.google.com [209.85.213.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id BAC2D2054F for ; Wed, 27 Aug 2014 15:14:44 +0000 (UTC) Received: by mail-ig0-f198.google.com with SMTP id h18sf1872590igc.9 for ; Wed, 27 Aug 2014 08:14:44 -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=1q2LXqTcvaqnnR7bp4lhy6rv+CAyT0fteUdIjogCQl8=; b=C6kNv7HcjEmQ0gMefPETDFyrxRC78CDGo5ZqDIiS5hq3+PG/BzBd1Yx9tgZu7mLHaw d3160L+7lTP4iDk4AiZNo40UwqgZSHpH1KNt9fyZiF9mDW3/HMVTu+4mefG3E8+5gri+ JdxJj+kT0KJ8U4mJloQLfmyQjySVcpelwQyxZEZYhx0ttmWk+oPQkLwxfYpZAComvEv9 sD4mZPA6jg3Tmsb4Cyo6Co9vY8fXpAtY7tiT08VFW6EInh0NoyfT/OY88S1LNB/t5yOw cnHYMFAJNN4mSiPGiRntSdTLacCfQ6wWj0xnDb7NRlD45ayyxP12OtdDsjFhBdR57t8f LjdA== X-Gm-Message-State: ALoCoQnC/8mhoRUA/dpjcGkWXkn0Crnbg1U5GQhWbSlz9koHtbDma64CRB/JfUxgYozP8+JpekkW X-Received: by 10.42.130.70 with SMTP id u6mr26348598ics.2.1409152484319; Wed, 27 Aug 2014 08:14:44 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.27.242 with SMTP id 105ls158368qgx.17.gmail; Wed, 27 Aug 2014 08:14:44 -0700 (PDT) X-Received: by 10.236.44.41 with SMTP id m29mr53928981yhb.57.1409152484129; Wed, 27 Aug 2014 08:14:44 -0700 (PDT) Received: from mail-yk0-f177.google.com (mail-yk0-f177.google.com [209.85.160.177]) by mx.google.com with ESMTPS id a49si575372yha.130.2014.08.27.08.14.44 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 27 Aug 2014 08:14:44 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.160.177 as permitted sender) client-ip=209.85.160.177; Received: by mail-yk0-f177.google.com with SMTP id 79so303436ykr.22 for ; Wed, 27 Aug 2014 08:14:44 -0700 (PDT) X-Received: by 10.220.187.134 with SMTP id cw6mr931727vcb.71.1409152484030; Wed, 27 Aug 2014 08:14:44 -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 uj3csp97061vcb; Wed, 27 Aug 2014 08:14:43 -0700 (PDT) X-Received: by 10.42.107.145 with SMTP id d17mr14514191icp.61.1409152483098; Wed, 27 Aug 2014 08:14:43 -0700 (PDT) Received: from lists.sourceforge.net (lists.sourceforge.net. [216.34.181.88]) by mx.google.com with ESMTPS id z16si960259icd.90.2014.08.27.08.14.42 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 27 Aug 2014 08: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-2.v29.ch3.sourceforge.com) by sfs-ml-2.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1XMevj-0001xM-4I; Wed, 27 Aug 2014 15:14:35 +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 1XMevi-0001xG-Ea for edk2-devel@lists.sourceforge.net; Wed, 27 Aug 2014 15:14:34 +0000 Received-SPF: pass (sog-mx-3.v43.ch3.sourceforge.com: domain of linaro.org designates 74.125.82.48 as permitted sender) client-ip=74.125.82.48; envelope-from=ard.biesheuvel@linaro.org; helo=mail-wg0-f48.google.com; Received: from mail-wg0-f48.google.com ([74.125.82.48]) by sog-mx-3.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-SHA:128) (Exim 4.76) id 1XMevh-0004jX-46 for edk2-devel@lists.sourceforge.net; Wed, 27 Aug 2014 15:14:34 +0000 Received: by mail-wg0-f48.google.com with SMTP id x13so368756wgg.19 for ; Wed, 27 Aug 2014 08:14:26 -0700 (PDT) X-Received: by 10.194.84.69 with SMTP id w5mr38732818wjy.0.1409152466834; Wed, 27 Aug 2014 08:14:26 -0700 (PDT) Received: from ards-macbook-pro.local (BSN-143-138-142.dial-up.dsl.siol.net. [89.143.138.142]) by mx.google.com with ESMTPSA id fh5sm3972994wib.5.2014.08.27.08.14.16 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 27 Aug 2014 08:14:25 -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: Wed, 27 Aug 2014 17:12:54 +0200 Message-Id: <1409152378-19706-7-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1409152378-19706-1-git-send-email-ard.biesheuvel@linaro.org> References: <1409152378-19706-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: 1XMevh-0004jX-46 Subject: [edk2] [PATCH v3 06/10] ArmPkg, ArmPlatformPkg: allow dynamic PCDs for memory base and size 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.160.177 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 changes the definition and a bunch of references to gArmTokenSpaceGuid.PcdSystemMemoryBase and gArmTokenSpaceGuid.PcdSystemMemorySize so they can be declared as dynamic PCDs by the platform. Also, move the non-SEC call to ArmPlatformInitializeSystemMemory() earlier, so a platform has a chance to set these PCDs before they are first referenced. The purpose is allowing dynamically instantiated virtual machines to declare the system memory by passing a device tree. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel Reviewed-by: Laszlo Ersek --- ArmPkg/ArmPkg.dec | 12 ++++++------ ArmPkg/Library/BdsLib/BdsLib.inf | 3 ++- .../PrePi/PrePiArmPlatformGlobalVariableLib.inf | 7 ++++--- ArmPlatformPkg/MemoryInitPei/MemoryInitPeiLib.inf | 6 ++++-- ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.c | 16 ++++++++-------- ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.inf | 6 ++++-- ArmPlatformPkg/PrePi/PeiUniCore.inf | 6 ++++-- 7 files changed, 32 insertions(+), 24 deletions(-) diff --git a/ArmPkg/ArmPkg.dec b/ArmPkg/ArmPkg.dec index e5ed445ca367..43eff6641294 100644 --- a/ArmPkg/ArmPkg.dec +++ b/ArmPkg/ArmPkg.dec @@ -116,12 +116,6 @@ gArmTokenSpaceGuid.PcdHypFvBaseAddress|0|UINT32|0x0000003C gArmTokenSpaceGuid.PcdHypFvSize|0|UINT32|0x0000003D - # System Memory (DRAM): These PCDs define the region of in-built system memory - # Some platforms can get DRAM extensions, these additional regions will be declared - # to UEFI by ArmPlatformLib - gArmTokenSpaceGuid.PcdSystemMemoryBase|0|UINT64|0x00000029 - gArmTokenSpaceGuid.PcdSystemMemorySize|0|UINT64|0x0000002A - # Use ClusterId + CoreId to identify the PrimaryCore gArmTokenSpaceGuid.PcdArmPrimaryCoreMask|0xF03|UINT32|0x00000031 # The Primary Core is ClusterId[0] & CoreId[0] @@ -143,6 +137,12 @@ [PcdsFixedAtBuild.common,PcdsDynamic.common] + # System Memory (DRAM): These PCDs define the region of in-built system memory + # Some platforms can get DRAM extensions, these additional regions will be declared + # to UEFI by ArmPlatformLib + gArmTokenSpaceGuid.PcdSystemMemoryBase|0|UINT64|0x00000029 + gArmTokenSpaceGuid.PcdSystemMemorySize|0|UINT64|0x0000002A + # # ARM Architectural Timer # diff --git a/ArmPkg/Library/BdsLib/BdsLib.inf b/ArmPkg/Library/BdsLib/BdsLib.inf index 3e1ae8914abf..7302d6ab1b1c 100644 --- a/ArmPkg/Library/BdsLib/BdsLib.inf +++ b/ArmPkg/Library/BdsLib/BdsLib.inf @@ -77,10 +77,11 @@ [FeaturePcd] gArmTokenSpaceGuid.PcdArmLinuxSpinTable -[FixedPcd] +[Pcd] gArmTokenSpaceGuid.PcdSystemMemoryBase gArmTokenSpaceGuid.PcdSystemMemorySize +[FixedPcd] gArmTokenSpaceGuid.PcdArmMachineType gArmTokenSpaceGuid.PcdArmLinuxFdtMaxOffset gArmTokenSpaceGuid.PcdArmLinuxFdtAlignment diff --git a/ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/PrePi/PrePiArmPlatformGlobalVariableLib.inf b/ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/PrePi/PrePiArmPlatformGlobalVariableLib.inf index 5d3a93fb7207..596f5595412e 100644 --- a/ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/PrePi/PrePiArmPlatformGlobalVariableLib.inf +++ b/ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/PrePi/PrePiArmPlatformGlobalVariableLib.inf @@ -37,9 +37,10 @@ gArmTokenSpaceGuid.PcdFdBaseAddress gArmTokenSpaceGuid.PcdFdSize - gArmTokenSpaceGuid.PcdSystemMemoryBase - gArmTokenSpaceGuid.PcdSystemMemorySize - gArmPlatformTokenSpaceGuid.PcdCPUCorePrimaryStackSize gArmPlatformTokenSpaceGuid.PcdPeiGlobalVariableSize +[Pcd] + gArmTokenSpaceGuid.PcdSystemMemoryBase + gArmTokenSpaceGuid.PcdSystemMemorySize + diff --git a/ArmPlatformPkg/MemoryInitPei/MemoryInitPeiLib.inf b/ArmPlatformPkg/MemoryInitPei/MemoryInitPeiLib.inf index 4b21caa0279e..441f8848e7d9 100755 --- a/ArmPlatformPkg/MemoryInitPei/MemoryInitPeiLib.inf +++ b/ArmPlatformPkg/MemoryInitPei/MemoryInitPeiLib.inf @@ -48,8 +48,6 @@ gArmTokenSpaceGuid.PcdFdBaseAddress gArmTokenSpaceGuid.PcdFdSize - gArmTokenSpaceGuid.PcdSystemMemoryBase - gArmTokenSpaceGuid.PcdSystemMemorySize gArmPlatformTokenSpaceGuid.PcdSystemMemoryUefiRegionSize gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIReclaimMemory @@ -62,5 +60,9 @@ gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderCode gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderData +[Pcd] + gArmTokenSpaceGuid.PcdSystemMemoryBase + gArmTokenSpaceGuid.PcdSystemMemorySize + [depex] TRUE diff --git a/ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.c b/ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.c index 4821fdc2fa89..587c4b5ce3a3 100755 --- a/ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.c +++ b/ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.c @@ -103,14 +103,6 @@ InitializeMemory ( DEBUG ((EFI_D_ERROR, "Memory Init PEIM Loaded\n")); - // Ensure PcdSystemMemorySize has been set - ASSERT (FixedPcdGet64 (PcdSystemMemorySize) != 0); - - SystemMemoryBase = (UINTN)FixedPcdGet64 (PcdSystemMemoryBase); - SystemMemoryTop = SystemMemoryBase + (UINTN)FixedPcdGet64 (PcdSystemMemorySize); - FdBase = (UINTN)PcdGet32 (PcdFdBaseAddress); - FdTop = FdBase + (UINTN)PcdGet32 (PcdFdSize); - // // Initialize the System Memory (DRAM) // @@ -119,6 +111,14 @@ InitializeMemory ( ArmPlatformInitializeSystemMemory (); } + // Ensure PcdSystemMemorySize has been set + ASSERT (PcdGet64 (PcdSystemMemorySize) != 0); + + SystemMemoryBase = (UINTN)PcdGet64 (PcdSystemMemoryBase); + SystemMemoryTop = SystemMemoryBase + (UINTN)PcdGet64 (PcdSystemMemorySize); + FdBase = (UINTN)PcdGet32 (PcdFdBaseAddress); + FdTop = FdBase + (UINTN)PcdGet32 (PcdFdSize); + // // Declare the UEFI memory to PEI // diff --git a/ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.inf b/ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.inf index 504026e90f6c..9643392cada2 100755 --- a/ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.inf +++ b/ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.inf @@ -55,8 +55,6 @@ gArmTokenSpaceGuid.PcdFdBaseAddress gArmTokenSpaceGuid.PcdFdSize - gArmTokenSpaceGuid.PcdSystemMemoryBase - gArmTokenSpaceGuid.PcdSystemMemorySize gArmPlatformTokenSpaceGuid.PcdSystemMemoryUefiRegionSize gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIReclaimMemory @@ -69,5 +67,9 @@ gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderCode gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderData +[Pcd] + gArmTokenSpaceGuid.PcdSystemMemoryBase + gArmTokenSpaceGuid.PcdSystemMemorySize + [Depex] TRUE diff --git a/ArmPlatformPkg/PrePi/PeiUniCore.inf b/ArmPlatformPkg/PrePi/PeiUniCore.inf index 1c0737bdedcb..f8925737ff62 100755 --- a/ArmPlatformPkg/PrePi/PeiUniCore.inf +++ b/ArmPlatformPkg/PrePi/PeiUniCore.inf @@ -88,8 +88,6 @@ gArmPlatformTokenSpaceGuid.PcdPeiGlobalVariableSize - gArmTokenSpaceGuid.PcdSystemMemoryBase - gArmTokenSpaceGuid.PcdSystemMemorySize gArmPlatformTokenSpaceGuid.PcdSystemMemoryUefiRegionSize gArmPlatformTokenSpaceGuid.PcdCoreCount @@ -106,3 +104,7 @@ gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesData gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderCode gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderData + +[Pcd] + gArmTokenSpaceGuid.PcdSystemMemoryBase + gArmTokenSpaceGuid.PcdSystemMemorySize