summaryrefslogtreecommitdiffstats
path: root/OvmfPkg/PlatformPei/MemDetect.c
diff options
context:
space:
mode:
authorLaszlo Ersek <lersek@redhat.com>2016-03-04 17:23:35 +0100
committerLaszlo Ersek <lersek@redhat.com>2016-03-23 17:46:56 +0100
commitd5371680638151ff1a4332294e60a1c12163752e (patch)
tree3387377b6449d2355df3d81e1be760b70783d595 /OvmfPkg/PlatformPei/MemDetect.c
parent8f35eb92c419f8a02dcaaac41073d88739a86562 (diff)
downloadedk2-d5371680638151ff1a4332294e60a1c12163752e.tar.gz
edk2-d5371680638151ff1a4332294e60a1c12163752e.tar.bz2
edk2-d5371680638151ff1a4332294e60a1c12163752e.zip
OvmfPkg: PlatformPei: factor out GetFirstNonAddress()
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 <kraxel@redhat.com> Cc: Jordan Justen <jordan.l.justen@intel.com> Cc: Marcel Apfelbaum <marcel@redhat.com> Cc: Thomas Lamprecht <t.lamprecht@proxmox.com> Ref: https://github.com/tianocore/edk2/issues/59 Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Diffstat (limited to 'OvmfPkg/PlatformPei/MemDetect.c')
-rw-r--r--OvmfPkg/PlatformPei/MemDetect.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/OvmfPkg/PlatformPei/MemDetect.c b/OvmfPkg/PlatformPei/MemDetect.c
index 455fcbb49d..286f6914a7 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);
//