MdePkg/Base: introduce MAX_ALLOC_ADDRESS

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>
This commit is contained in:
Ard Biesheuvel 2018-12-07 11:27:32 +01:00
parent 5c8bc8be9e
commit 67b8f806d2
5 changed files with 25 additions and 0 deletions

View File

@ -142,6 +142,11 @@ typedef INT64 INTN;
///
#define MAX_ADDRESS 0xFFFFFFFFFFFFFFFFULL
///
/// Maximum usable address at boot time (48 bits using 4 KB pages)
///
#define MAX_ALLOC_ADDRESS 0xFFFFFFFFFFFFULL
///
/// Maximum legal AArch64 INTN and UINTN values.
///

View File

@ -148,6 +148,11 @@ typedef INT32 INTN;
///
#define MAX_ADDRESS 0xFFFFFFFF
///
/// Maximum usable address at boot time
///
#define MAX_ALLOC_ADDRESS MAX_ALLOC_ADDRESS
///
/// Maximum legal ARM INTN and UINTN values.
///

View File

@ -103,6 +103,11 @@ typedef unsigned long UINTN;
///
#define MAX_ADDRESS ((UINTN)(~0ULL >> (64 - sizeof (INTN) * 8)))
///
/// Maximum usable address at boot time (48 bits using 4 KB pages)
///
#define MAX_ALLOC_ADDRESS MAX_ADDRESS
///
/// Maximum legal EBC INTN and UINTN values.
///

View File

@ -246,6 +246,11 @@ typedef INT32 INTN;
///
#define MAX_ADDRESS 0xFFFFFFFF
///
/// Maximum usable address at boot time
///
#define MAX_ALLOC_ADDRESS MAX_ADDRESS
///
/// Maximum legal IA-32 INTN and UINTN values.
///

View File

@ -260,6 +260,11 @@ typedef INT64 INTN;
///
#define MAX_ADDRESS 0xFFFFFFFFFFFFFFFFULL
///
/// Maximum usable address at boot time
///
#define MAX_ALLOC_ADDRESS MAX_ADDRESS
///
/// Maximum legal x64 INTN and UINTN values.
///