[edk2] [RFC PATCH 1/7] MdePkg/Base: introduce MAX_ALLOC_ADDRESS

Ard Biesheuvel ard.biesheuvel at linaro.org
Fri Dec 7 03:22:58 PST 2018


On some architectures, the maximum representable address deviates from
the virtual address range that is accessible by the firmware at boot
time. For instance, on AArch64, UEFI mandates a 4 KB page size, which
limits the address space to 48 bits, while more than that may be
populated on a particular platform, for use by the OS.

So introduce a new macro MAX_ALLOC_ADDRESS, which represent the maximum
address the firmware should take into account when allocating memory
ranges that need to be accessible by the CPU at boot time. Initially,
it just defaults to MAX_ADDRESS, but later on, architectures may elect
to override it to a smaller number.

This means that all replacements of MAX_ADDRESS with MAX_ALLOC_ADDRESS
are functional no-ops unless an architecture sets a value for the latter.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel at linaro.org>
---
 MdePkg/Include/Base.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/MdePkg/Include/Base.h b/MdePkg/Include/Base.h
index bc877d8125a5..618f8ea85ce7 100644
--- a/MdePkg/Include/Base.h
+++ b/MdePkg/Include/Base.h
@@ -404,6 +404,10 @@ struct _LIST_ENTRY {
 #define MIN_INT32  (((INT32) -2147483647) - 1)
 #define MIN_INT64  (((INT64) -9223372036854775807LL) - 1)
 
+#ifndef MAX_ALLOC_ADDRESS
+#define MAX_ALLOC_ADDRESS   MAX_ADDRESS
+#endif
+
 #define  BIT0     0x00000001
 #define  BIT1     0x00000002
 #define  BIT2     0x00000004
-- 
2.19.2



More information about the edk2-devel mailing list