BaseTools: Move MEMORY_TYPE_* Defines to EFI_MEMORY_TYPE Enum

Per TCBZ2372, clang on Linux emits a warning if an enum-typed variable
is compared with a constant outside of the range of the enum. Such
comparisons are performed in multiple locations in DXE core on
variables of type EFI_MEMORY_TYPE. This patch moves the OEM and OS
reserved types into the EFI_MEMORY_TYPE enum itself to resolve this
issue and improve readability. This commit does this for the BaseTools
copy of this enum.

Signed-off-by: Oliver Smith-Denny <osde@linux.microsoft.com>
This commit is contained in:
Dmitry Antipov 2024-07-18 16:32:08 -07:00 committed by mergify[bot]
parent b1bce5e564
commit 41426040da
1 changed files with 14 additions and 1 deletions

View File

@ -14,6 +14,15 @@
//
// Enumeration of memory types introduced in UEFI.
// +---------------------------------------------------+
// | 0..(EfiMaxMemoryType - 1) - Normal memory type |
// +---------------------------------------------------+
// | EfiMaxMemoryType..0x6FFFFFFF - Invalid |
// +---------------------------------------------------+
// | 0x70000000..0x7FFFFFFF - OEM reserved |
// +---------------------------------------------------+
// | 0x80000000..0xFFFFFFFF - OS reserved |
// +---------------------------------------------------+
//
typedef enum {
EfiReservedMemoryType,
@ -31,7 +40,11 @@ typedef enum {
EfiMemoryMappedIOPortSpace,
EfiPalCode,
EfiPersistentMemory,
EfiMaxMemoryType
EfiMaxMemoryType,
MEMORY_TYPE_OEM_RESERVED_MIN = 0x70000000,
MEMORY_TYPE_OEM_RESERVED_MAX = 0x7FFFFFFF,
MEMORY_TYPE_OS_RESERVED_MIN = 0x80000000,
MEMORY_TYPE_OS_RESERVED_MAX = 0xFFFFFFFF
} EFI_MEMORY_TYPE;