diff options
author | Ni, Ruiyu <ruiyu.ni@intel.com> | 2016-03-29 18:32:13 +0800 |
---|---|---|
committer | Ruiyu Ni <ruiyu.ni@intel.com> | 2016-04-06 13:27:09 +0800 |
commit | 024bdafc6800ee1e219df16bc11ca7a4c007a81d (patch) | |
tree | b9c5c0d4503696b42d265a984cde28db249f5dcd | |
parent | 339ae051f6d095629b39d8d486c4f3a8a31e6480 (diff) | |
download | edk2-024bdafc6800ee1e219df16bc11ca7a4c007a81d.tar.gz edk2-024bdafc6800ee1e219df16bc11ca7a4c007a81d.tar.bz2 edk2-024bdafc6800ee1e219df16bc11ca7a4c007a81d.zip |
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>
-rw-r--r-- | MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c | 5 | ||||
-rw-r--r-- | MdeModulePkg/Library/UefiBootManagerLib/BmMisc.c | 19 | ||||
-rw-r--r-- | MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h | 12 |
3 files changed, 27 insertions, 9 deletions
diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c index 61a83455f7..5cae901d31 100644 --- a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c +++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c @@ -1567,6 +1567,7 @@ EfiBootManagerBoot ( UINTN FileSize;
EFI_BOOT_LOGO_PROTOCOL *BootLogo;
EFI_EVENT LegacyBootEvent;
+ UINTN RamDiskSizeInPages;
if (BootOption == NULL) {
return;
@@ -1701,8 +1702,10 @@ EfiBootManagerBoot ( // 6. Adjust the different type memory page number just before booting
// and save the updated info into the variable for next boot to use
//
+ BmGetRamDiskMemoryInfo (RamDiskDevicePath, &RamDiskSizeInPages);
BmSetMemoryTypeInformationVariable (
- (BOOLEAN) ((BootOption->Attributes & LOAD_OPTION_CATEGORY) == LOAD_OPTION_CATEGORY_BOOT)
+ (BOOLEAN) ((BootOption->Attributes & LOAD_OPTION_CATEGORY) == LOAD_OPTION_CATEGORY_BOOT),
+ RamDiskSizeInPages
);
DEBUG_CODE_BEGIN();
diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmMisc.c b/MdeModulePkg/Library/UefiBootManagerLib/BmMisc.c index 1768781bfc..c6ac242094 100644 --- a/MdeModulePkg/Library/UefiBootManagerLib/BmMisc.c +++ b/MdeModulePkg/Library/UefiBootManagerLib/BmMisc.c @@ -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;
@@ -225,6 +229,13 @@ BmSetMemoryTypeInformationVariable ( }
//
+ // 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
//
diff --git a/MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h b/MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h index 4660323562..7466719194 100644 --- a/MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h +++ b/MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h @@ -202,14 +202,18 @@ BmWriteBootToOsPerformanceData ( 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
);
/**
|