From patchwork Thu Mar 10 21:05:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laszlo Ersek X-Patchwork-Id: 63746 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp675473lbc; Thu, 10 Mar 2016 13:05:45 -0800 (PST) X-Received: by 10.66.235.129 with SMTP id um1mr6314300pac.17.1457643927637; Thu, 10 Mar 2016 13:05:27 -0800 (PST) Return-Path: Received: from ml01.01.org (ml01.01.org. [198.145.21.10]) by mx.google.com with ESMTPS id va5si8354078pac.165.2016.03.10.13.05.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 10 Mar 2016 13:05:27 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 37BC51A1F5A; Thu, 10 Mar 2016 13:05:42 -0800 (PST) X-Original-To: edk2-devel@ml01.01.org Delivered-To: edk2-devel@ml01.01.org Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id BEBC11A1F59 for ; Thu, 10 Mar 2016 13:05:40 -0800 (PST) Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id 544488C564; Thu, 10 Mar 2016 21:05:25 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-113-82.phx2.redhat.com [10.3.113.82]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u2AL5K4t003627; Thu, 10 Mar 2016 16:05:23 -0500 From: Laszlo Ersek To: edk2-devel@ml01.01.org Date: Thu, 10 Mar 2016 22:05:15 +0100 Message-Id: <1457643917-24710-2-git-send-email-lersek@redhat.com> In-Reply-To: <1457643917-24710-1-git-send-email-lersek@redhat.com> References: <1457643917-24710-1-git-send-email-lersek@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 Cc: Marcel Apfelbaum , Jordan Justen Subject: [edk2] [PATCH 1/3] OvmfPkg: PlatformPei: factor out GetFirstNonAddress() X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" Factor out the expression that is currently the basis of the address width calculation into a standalone function. In the next patches we'll raise the return value under certain circumstances. Cc: Gerd Hoffmann Cc: Jordan Justen Cc: Marcel Apfelbaum Cc: Thomas Lamprecht Ref: https://github.com/tianocore/edk2/issues/59 Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek --- OvmfPkg/PlatformPei/MemDetect.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) -- 1.8.3.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/OvmfPkg/PlatformPei/MemDetect.c b/OvmfPkg/PlatformPei/MemDetect.c index 455fcbb49d13..286f6914a702 100644 --- a/OvmfPkg/PlatformPei/MemDetect.c +++ b/OvmfPkg/PlatformPei/MemDetect.c @@ -88,6 +88,22 @@ GetSystemMemorySizeAbove4gb ( /** + Return the highest address that DXE could possibly use, plus one. +**/ +STATIC +UINT64 +GetFirstNonAddress ( + VOID + ) +{ + UINT64 FirstNonAddress; + + FirstNonAddress = BASE_4GB + GetSystemMemorySizeAbove4gb (); + return FirstNonAddress; +} + + +/** Initialize the mPhysMemAddressWidth variable, based on guest RAM size. **/ VOID @@ -103,7 +119,7 @@ AddressWidthInitialization ( // The DXL IPL keys off of the physical address bits advertized in the CPU // HOB. To conserve memory, we calculate the minimum address width here. // - FirstNonAddress = BASE_4GB + GetSystemMemorySizeAbove4gb (); + FirstNonAddress = GetFirstNonAddress (); mPhysMemAddressWidth = (UINT8)HighBitSet64 (FirstNonAddress); //