summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorniruiyu <niruiyu@6f19259b-4bc3-4df7-8a09-765794883524>2012-09-27 02:57:01 +0000
committerniruiyu <niruiyu@6f19259b-4bc3-4df7-8a09-765794883524>2012-09-27 02:57:01 +0000
commit3999f1feef2134f1bb7dc6f89dcb01e49765b392 (patch)
tree2a84a289b4546848b2d9797bd67821dedfeb5600
parent68978a52aedbca80bfa787250b1ad78e303ddc4f (diff)
downloadedk2-3999f1feef2134f1bb7dc6f89dcb01e49765b392.zip
edk2-3999f1feef2134f1bb7dc6f89dcb01e49765b392.tar.gz
edk2-3999f1feef2134f1bb7dc6f89dcb01e49765b392.tar.bz2
Reset system only when the pre-allocated memory is more than 1.5 of needed memory and boot mode is BOOT_WITH_DEFAULT_SETTING, or less than the needed memory.
Signed-off-by: Ruiyu Ni<ruiyu.ni@intel.com> Reviewed-by: Elvin Li<elvin.li@intel.com> git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13748 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r--IntelFrameworkModulePkg/Library/GenericBdsLib/BdsMisc.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsMisc.c b/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsMisc.c
index da91b7d..971188b 100644
--- a/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsMisc.c
+++ b/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsMisc.c
@@ -1283,10 +1283,8 @@ BdsLibGetImageHeader (
}
/**
- This routine adjusts the memory information for different memory type and
- saves them into the variables for next boot. It conditionally resets the
- system when the memory information changes. Platform can reserve memory
- large enough (125% of actual requirement) to avoid the reset in the first boot.
+ This routine adjust the memory information for different memory type and
+ save them into the variables for next boot.
**/
VOID
BdsSetMemoryTypeInformationVariable (
@@ -1392,13 +1390,14 @@ BdsSetMemoryTypeInformationVariable (
Next = Previous;
//
- // Write next varible to 125% * current and Inconsistent Memory Reserved across bootings may lead to S4 fail
+ // Inconsistent Memory Reserved across bootings may lead to S4 fail
+ // Write next varible to 125% * current when the pre-allocated memory is:
+ // 1. More than 150% of needed memory and boot mode is BOOT_WITH_DEFAULT_SETTING
+ // 2. Less than the needed memory
//
- if (Current < Previous) {
+ if ((Current + (Current >> 1)) < Previous) {
if (BootMode == BOOT_WITH_DEFAULT_SETTINGS) {
Next = Current + (Current >> 2);
- } else if (!MemoryTypeInformationVariableExists) {
- Next = MAX (Current + (Current >> 2), Previous);
}
} else if (Current > Previous) {
Next = Current + (Current >> 2);