From patchwork Mon Aug 25 19:19:25 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 35935 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qg0-f71.google.com (mail-qg0-f71.google.com [209.85.192.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 03A5A20565 for ; Mon, 25 Aug 2014 19:20:43 +0000 (UTC) Received: by mail-qg0-f71.google.com with SMTP id f51sf42664518qge.2 for ; Mon, 25 Aug 2014 12:20:42 -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=qxskCupjH1en4ljE+FIXPsjMFEt6PbQM8okwjOisr9o=; b=RHIMe6DAFI91HLlEL9pOWnZaaDdERP55uX7lGHukL6/AtMdREgwMjGtSmmfZZuAPkW laEM/cg2PRUHdsW6iNHLLX6XoYA+XXwXgY5+JS98AwUN7V3dTxa+u9QxG2hwfqf2MNP1 +EbSzGK7+2oz/5jE/9P3u+TtxL17VsqC/0wptD5Rv4S9CV3T+ouUyakVAhxRI7OVs07Q Lm+1Bg09uQVcfurfzlr26jrG7VrKqoXUQZ2e9y/4e31GsRFfoAcaJFwbM2z37YRsyI2H 5J1WcNa1fGNHIsQxD24VpKfJD3Cg0705NvzGTUdrqZUWNXpFrwvnFpiBjMDKq0OTcwoP S3Bw== X-Gm-Message-State: ALoCoQksue2fuCku/Q0jRh9ZzqpzPxYrgowaG0V1BET6ICMJ7EAm7onn4uZfVDqe47P7pvykceXI X-Received: by 10.236.227.169 with SMTP id d39mr2255213yhq.45.1408994442884; Mon, 25 Aug 2014 12:20:42 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.27.242 with SMTP id 105ls822042qgx.17.gmail; Mon, 25 Aug 2014 12:20:42 -0700 (PDT) X-Received: by 10.52.146.17 with SMTP id sy17mr7297950vdb.29.1408994442744; Mon, 25 Aug 2014 12:20:42 -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 dp8si507279vcb.12.2014.08.25.12.20.42 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 25 Aug 2014 12:20:42 -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 hq11so15649192vcb.38 for ; Mon, 25 Aug 2014 12:20:42 -0700 (PDT) X-Received: by 10.220.118.136 with SMTP id v8mr7152633vcq.50.1408994442669; Mon, 25 Aug 2014 12:20:42 -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 uj3csp141535vcb; Mon, 25 Aug 2014 12:20:42 -0700 (PDT) X-Received: by 10.43.158.201 with SMTP id lv9mr7757887icc.58.1408994442101; Mon, 25 Aug 2014 12:20:42 -0700 (PDT) Received: from lists.sourceforge.net (lists.sourceforge.net. [216.34.181.88]) by mx.google.com with ESMTPS id lp4si902362igb.8.2014.08.25.12.20.41 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 25 Aug 2014 12:20:42 -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-4.v29.ch3.sourceforge.com) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1XLzog-0002Id-AI; Mon, 25 Aug 2014 19:20:34 +0000 Received: from sog-mx-2.v43.ch3.sourceforge.com ([172.29.43.192] helo=mx.sourceforge.net) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1XLzoe-0002IT-96 for edk2-devel@lists.sourceforge.net; Mon, 25 Aug 2014 19:20:32 +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 1XLzod-0006Vc-5P for edk2-devel@lists.sourceforge.net; Mon, 25 Aug 2014 19:20:32 +0000 Received: by mail-wi0-f180.google.com with SMTP id n3so3045243wiv.7 for ; Mon, 25 Aug 2014 12:20:25 -0700 (PDT) X-Received: by 10.194.61.99 with SMTP id o3mr4865034wjr.103.1408994424945; Mon, 25 Aug 2014 12:20:24 -0700 (PDT) Received: from ards-macbook-pro.local ([193.77.13.198]) by mx.google.com with ESMTPSA id b3sm3476891wiw.22.2014.08.25.12.20.20 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 25 Aug 2014 12:20:24 -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: Mon, 25 Aug 2014 21:19:25 +0200 Message-Id: <1408994367-11143-9-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1408994367-11143-1-git-send-email-ard.biesheuvel@linaro.org> References: <1408994367-11143-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: 1XLzod-0006Vc-5P Subject: [edk2] [PATCH 08/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.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. 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 b654e7ca4552..a9eb856f76ee 100644 --- a/ArmPkg/ArmPkg.dec +++ b/ArmPkg/ArmPkg.dec @@ -112,12 +112,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] @@ -139,6 +133,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 ce9300d00efc..9ebfe20f222a 100644 --- a/ArmPkg/Library/BdsLib/BdsLib.inf +++ b/ArmPkg/Library/BdsLib/BdsLib.inf @@ -77,10 +77,11 @@ [FeaturePcd] gArmTokenSpaceGuid.PcdArmPsciSupport -[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 28ba9842856a..e803ca0d6270 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 fb77e4db5d23..ed8e2095e2f9 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 @@ -61,6 +59,10 @@ gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesData gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderCode gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderData + +[Pcd] + gArmTokenSpaceGuid.PcdSystemMemoryBase + gArmTokenSpaceGuid.PcdSystemMemorySize [depex] TRUE diff --git a/ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.c b/ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.c index c6a6fe64ba81..0a91869b0ed3 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 ee44004d8469..0ed14a8b184a 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 @@ -68,6 +66,10 @@ gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesData gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderCode gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderData + +[Pcd] + gArmTokenSpaceGuid.PcdSystemMemoryBase + gArmTokenSpaceGuid.PcdSystemMemorySize [Depex] TRUE diff --git a/ArmPlatformPkg/PrePi/PeiUniCore.inf b/ArmPlatformPkg/PrePi/PeiUniCore.inf index ec3b89876846..1ccebc3d89e4 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