From 3999f1feef2134f1bb7dc6f89dcb01e49765b392 Mon Sep 17 00:00:00 2001 From: niruiyu Date: Thu, 27 Sep 2012 02:57:01 +0000 Subject: [PATCH] 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 Reviewed-by: Elvin Li git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13748 6f19259b-4bc3-4df7-8a09-765794883524 --- .../Library/GenericBdsLib/BdsMisc.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsMisc.c b/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsMisc.c index da91b7d096..971188bd0a 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);