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 <kra...@redhat.com> Cc: Jordan Justen <jordan.l.jus...@intel.com> Cc: Marcel Apfelbaum <mar...@redhat.com> Cc: Thomas Lamprecht <t.lampre...@proxmox.com> Ref: https://github.com/tianocore/edk2/issues/59 Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <ler...@redhat.com> --- OvmfPkg/PlatformPei/MemDetect.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) 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); // -- 1.8.3.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel