audk/MdeModulePkg
Sunny Wang fb5848c588 MdeModulePkg/UefiBootManagerLib: Fix data in MemoryTypeInformation
After booting a large-size ISO RAM disk (HTTP boot option pointing to
a ISO file) and reboot system, system will possibly run into the
following ASSERT because the BDS core code doesn't consider the
case that Memory page management (Page.c) would possibly NOT update
current memory usage statistics(CurrentMemoryTypeInformation) if
system allocates a memory buffer with a large number of pages.
ASSERT [DxeCore] u:\MdeModulePkg\Core\Dxe\Gcd\Gcd.c(2273):
Length >= MinimalMemorySizeNeeded

The BDS code block for skipping counting reserved memory occupied
by RAM Disk didn't consider the Memory page management's behavior
mentioned above, which caused that the
CurrentMemoryTypeInformation[Index1].NumberOfPages will be updated
to a "very big value" because RamDiskSizeInPages is bigger than
CurrentMemoryTypeInformation[Index1].NumberOfPages. For example,
NumberOfPages is 0x9000 (current use) and RamDiskSizeInPages is
0xC0000 (ISO image size). The result will become a very big value
0xFFF49000.

Therefore, we need to add a check to prevent BDS core code updating
wrong data (very big value) to MemoryTypeInformation variable. This
code change is a improvement for fixing this issue for most cases.
There is still a corner case even when the memory bins don't include
the RAM disk memory, the memory used by all other modules exceeds
RamDiskSizeInPages. Ray will send the other patch to fix this corner
case.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Sunny Wang <sunnywang@hpe.com>
Reviewed-by: Samer El-Haj-Mahmoud <elhaj@hpe.com>
Reviewed-by: Ruiyu Ni <Ruiyu.ni@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
2016-06-27 10:38:09 +08:00
..
Application MdeModulePkg: Replace UnicodeStrToAsciiStr/AsciiStrToUnicodeStr 2016-06-21 12:46:24 +08:00
Bus MdeModulePkg: SdMmc: Add delay before eMMC reset 2016-06-24 11:28:35 +08:00
Core MdeModulePkg: Remove NORETURN for PeiCore() and DxeMain() function 2016-06-23 15:45:40 +08:00
Include MdeModulePkg/BootLogoLib: pull GraphicsOutput protocol into class header 2016-05-27 11:27:00 +02:00
Library MdeModulePkg/UefiBootManagerLib: Fix data in MemoryTypeInformation 2016-06-27 10:38:09 +08:00
Logo MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
Universal MdeModulePkg: Fix the wrong IpSb->State update 2016-06-23 15:40:31 +08:00
Contributions.txt */Contributions.txt: Update example email address 2015-02-03 17:29:14 +00:00
License.txt Update copyright format 2012-04-24 06:49:39 +00:00
MdeModulePkg.dec MdeModulePkg:Prevent the BmRepairAllControllers routine in an infinite loop 2016-06-03 15:57:47 +08:00
MdeModulePkg.dsc MdeModulePkg RamDiskDxe: VALID_ARCH cleanup to list supported options 2016-05-25 13:29:43 +08:00
MdeModulePkg.uni MdeModulePkg:Prevent the BmRepairAllControllers routine in an infinite loop 2016-06-03 15:57:47 +08:00
MdeModulePkgExtra.uni MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00