MdeModulePkg: Added PcdMaxMemoryType.

This commit is contained in:
Mikhail Krichanov 2025-04-14 15:14:32 +03:00
parent 0ffae89c3e
commit 8a8e617dfe
5 changed files with 13 additions and 17 deletions

View File

@ -62,5 +62,8 @@
gEfiDevicePathProtocolGuid ## SOMETIMES_CONSUMES
gEfiUnicodeCollationProtocolGuid ## SOMETIMES_CONSUMES
[Pcd]
gEfiMdeModulePkgTokenSpaceGuid.PcdMaxMemoryType ## CONSUMES
[Depex]
TRUE

View File

@ -11,22 +11,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include <Library/UefiLib.h>
//
// +---------------------------------------------------+
// | 0..(EfiMaxMemoryType - 1) - Normal memory type |
// +---------------------------------------------------+
// | EfiMaxMemoryType..0x6FFFFFFF - Invalid |
// +---------------------------------------------------+
// | 0x70000000..0x7FFFFFFF - OEM reserved |
// +---------------------------------------------------+
// | 0x80000000..0xFFFFFFFF - OS reserved |
// +---------------------------------------------------+
//
#define MEMORY_TYPE_OS_RESERVED_MIN 0x80000000
#define MEMORY_TYPE_OS_RESERVED_MAX 0xFFFFFFFF
#define MEMORY_TYPE_OEM_RESERVED_MIN 0x70000000
#define MEMORY_TYPE_OEM_RESERVED_MAX 0x7FFFFFFF
//
// Memory type to guard (matching the related PCD definition)
//
@ -36,7 +20,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#define GUARD_HEAP_TYPE_ALL \
(GUARD_HEAP_TYPE_PAGE|GUARD_HEAP_TYPE_POOL|GUARD_HEAP_TYPE_FREED)
#define MAX_MEMORY_TYPE 100
#define MAX_MEMORY_TYPE FixedPcdGet32 (PcdMaxMemoryType)
/**
Called to initialize the pool.

View File

@ -38,3 +38,4 @@
gEfiMdeModulePkgTokenSpaceGuid.PcdHeapGuardPageType ## CONSUMES
gEfiMdeModulePkgTokenSpaceGuid.PcdHeapGuardPoolType ## CONSUMES
gEfiMdeModulePkgTokenSpaceGuid.PcdHeapGuardPropertyMask ## CONSUMES
gEfiMdeModulePkgTokenSpaceGuid.PcdMaxMemoryType ## CONSUMES

View File

@ -82,6 +82,8 @@ typedef struct {
//
POOL mPoolHead[MAX_MEMORY_TYPE];
STATIC_ASSERT (MAX_MEMORY_TYPE > EfiMaxMemoryType, "PcdMaxMemoryType must be greater than EfiMaxMemoryType");
STATIC BOOLEAN mIsCore;
//

View File

@ -1210,6 +1210,12 @@
# @Prompt Enable User Space.
gEfiMdeModulePkgTokenSpaceGuid.PcdEnableUserSpace|FALSE|BOOLEAN|0x30001062
## Sets the size of mPoolHead array in MemoryPoolLib. It must be greater than EfiMaxMemoryType.
# In DxeMain this array manages Pools of different memory types.
# In DxeUserSpace this array manages Pools in different User address spaces.
# @Prompt Max number of memory types (or User address spaces).
gEfiMdeModulePkgTokenSpaceGuid.PcdMaxMemoryType|100|UINT32|0x30001063
[PcdsFixedAtBuild, PcdsPatchableInModule]
## Dynamic type PCD can be registered callback function for Pcd setting action.
# PcdMaxPeiPcdCallBackNumberPerPcdEntry indicates the maximum number of callback function