MdeModulePkg/Bds: Memory Bins don't count the memory used by RAM Disk
MemoryTypeInformation don't count the reserved memory used by RAM Disk, but it still check all types of memory and do reset when any type of memory size changes. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Siyuan Fu <siyuan.fu@intel.com> Reviewed-by: Samer El-Haj-Mahmoud <elhaj@hpe.com>
This commit is contained in:
@@ -124,14 +124,18 @@ BmMatchDevicePaths (
|
||||
This routine adjust the memory information for different memory type and
|
||||
save them into the variables for next boot. It resets the system when
|
||||
memory information is updated and the current boot option belongs to
|
||||
boot category instead of application category.
|
||||
boot category instead of application category. It doesn't count the
|
||||
reserved memory occupied by RAM Disk.
|
||||
|
||||
@param Boot TRUE if current boot option belongs to boot category instead of
|
||||
application category.
|
||||
@param Boot TRUE if current boot option belongs to boot
|
||||
category instead of application category.
|
||||
@param RamDiskSizeInPages Reserved memory size in pages occupied by
|
||||
RAM Disk.
|
||||
**/
|
||||
VOID
|
||||
BmSetMemoryTypeInformationVariable (
|
||||
IN BOOLEAN Boot
|
||||
IN BOOLEAN Boot,
|
||||
IN UINTN RamDiskSizeInPages
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
@@ -224,6 +228,13 @@ BmSetMemoryTypeInformationVariable (
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
// Do not count the reserved memory occupied by RAM Disk.
|
||||
//
|
||||
if (CurrentMemoryTypeInformation[Index1].Type == EfiReservedMemoryType) {
|
||||
CurrentMemoryTypeInformation[Index1].NumberOfPages -= RamDiskSizeInPages;
|
||||
}
|
||||
|
||||
//
|
||||
// Previous is the number of pages pre-allocated
|
||||
// Current is the number of pages actually needed
|
||||
|
Reference in New Issue
Block a user