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.
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Liming Gao <liming.gao@intel.com>
///\r
#define MAX_ADDRESS 0xFFFFFFFFFFFFFFFFULL\r
\r
+///\r
+/// Maximum usable address at boot time (48 bits using 4 KB pages)\r
+///\r
+#define MAX_ALLOC_ADDRESS 0xFFFFFFFFFFFFULL\r
+\r
///\r
/// Maximum legal AArch64 INTN and UINTN values.\r
///\r
///\r
#define MAX_ADDRESS 0xFFFFFFFF\r
\r
+///\r
+/// Maximum usable address at boot time\r
+///\r
+#define MAX_ALLOC_ADDRESS MAX_ALLOC_ADDRESS\r
+\r
///\r
/// Maximum legal ARM INTN and UINTN values.\r
///\r
///\r
#define MAX_ADDRESS ((UINTN)(~0ULL >> (64 - sizeof (INTN) * 8)))\r
\r
+///\r
+/// Maximum usable address at boot time (48 bits using 4 KB pages)\r
+///\r
+#define MAX_ALLOC_ADDRESS MAX_ADDRESS\r
+\r
///\r
/// Maximum legal EBC INTN and UINTN values.\r
///\r
///\r
#define MAX_ADDRESS 0xFFFFFFFF\r
\r
+///\r
+/// Maximum usable address at boot time\r
+///\r
+#define MAX_ALLOC_ADDRESS MAX_ADDRESS\r
+\r
///\r
/// Maximum legal IA-32 INTN and UINTN values.\r
///\r
///\r
#define MAX_ADDRESS 0xFFFFFFFFFFFFFFFFULL\r
\r
+///\r
+/// Maximum usable address at boot time\r
+///\r
+#define MAX_ALLOC_ADDRESS MAX_ADDRESS\r
+\r
///\r
/// Maximum legal x64 INTN and UINTN values.\r
///\r