From patchwork Tue Aug 26 13:03:47 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 36022 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qg0-f69.google.com (mail-qg0-f69.google.com [209.85.192.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3E6F92057E for ; Tue, 26 Aug 2014 13:04:49 +0000 (UTC) Received: by mail-qg0-f69.google.com with SMTP id a108sf45211890qge.4 for ; Tue, 26 Aug 2014 06:04:49 -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=C8XdzMNCK1h+a2CYUBaTesVMj8zpeoNoAjxvCHul/gAlaNZzqIQPXWvkQwm9+qLFgA Q9SaLlGTJPuJKuGfiiG0U8SRz7gXabaeOrguL272n6+RjqfN2g+IvcKjBgi/KAs96Hz6 rMrEtPww4V4rll7pAUUNhvJ9d7zJlDM5r+KeG2onYlEQ6NFxR7Wz5PZjAbLUyb3RgG76 XiBzsdh4m59TkBRlN9Mg3lKrTTsPsC2AfTnAmeJ9J3/diPvEsvw0uqas9rGs/5sBzA27 LV9Z7BEkuSEITZzSRohh3D2we1Ffp31kNWoocDY+sE1DlLs6ajlJUubung2LVLC/rju7 6OoA== X-Gm-Message-State: ALoCoQlSWHaCiQ9zqYJKEbYyR0qy1GXiHNBA/RnkAezbTXkv7uQkyXpxhmLsGbPnLVqACa7Lu6O6 X-Received: by 10.236.1.198 with SMTP id 46mr17803577yhd.16.1409058289060; Tue, 26 Aug 2014 06:04:49 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.30.245 with SMTP id d108ls639465qgd.68.gmail; Tue, 26 Aug 2014 06:04:49 -0700 (PDT) X-Received: by 10.52.150.17 with SMTP id ue17mr71361vdb.89.1409058288983; Tue, 26 Aug 2014 06:04:48 -0700 (PDT) Received: from mail-vc0-f179.google.com (mail-vc0-f179.google.com [209.85.220.179]) by mx.google.com with ESMTPS id n9si1402518vca.20.2014.08.26.06.04.48 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 26 Aug 2014 06:04:48 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.179 as permitted sender) client-ip=209.85.220.179; Received: by mail-vc0-f179.google.com with SMTP id hq11so16911134vcb.10 for ; Tue, 26 Aug 2014 06:04:48 -0700 (PDT) X-Received: by 10.52.120.51 with SMTP id kz19mr69121vdb.95.1409058288906; Tue, 26 Aug 2014 06:04:48 -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 uj3csp197142vcb; Tue, 26 Aug 2014 06:04:48 -0700 (PDT) X-Received: by 10.43.167.196 with SMTP id nf4mr27685744icc.22.1409058273202; Tue, 26 Aug 2014 06:04:33 -0700 (PDT) Received: from lists.sourceforge.net (lists.sourceforge.net. [216.34.181.88]) by mx.google.com with ESMTPS id n1si2803675ige.61.2014.08.26.06.04.32 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 26 Aug 2014 06:04:33 -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 1XMGQA-0005eV-V5; Tue, 26 Aug 2014 13:04:23 +0000 Received: from sog-mx-4.v43.ch3.sourceforge.com ([172.29.43.194] helo=mx.sourceforge.net) by sfs-ml-3.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1XMGQA-0005eL-45 for edk2-devel@lists.sourceforge.net; Tue, 26 Aug 2014 13:04:22 +0000 Received-SPF: pass (sog-mx-4.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-4.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-SHA:128) (Exim 4.76) id 1XMGQ9-0001j4-2T for edk2-devel@lists.sourceforge.net; Tue, 26 Aug 2014 13:04:22 +0000 Received: by mail-we0-f170.google.com with SMTP id w62so14640193wes.1 for ; Tue, 26 Aug 2014 06:04:14 -0700 (PDT) X-Received: by 10.180.80.165 with SMTP id s5mr21467565wix.61.1409058254769; Tue, 26 Aug 2014 06:04:14 -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.04.08 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 26 Aug 2014 06:04:14 -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:47 +0200 Message-Id: <1409058229-28802-7-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: 1XMGQ9-0001j4-2T Subject: [edk2] [PATCH v2 6/8] 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.220.179 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 --- 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