}\r
\r
/**\r
- This routine adjusts the memory information for different memory type and \r
- saves them into the variables for next boot. It conditionally resets the\r
- system when the memory information changes. Platform can reserve memory \r
- large enough (125% of actual requirement) to avoid the reset in the first boot.\r
+ This routine adjust the memory information for different memory type and \r
+ save them into the variables for next boot.\r
**/\r
VOID\r
BdsSetMemoryTypeInformationVariable (\r
Next = Previous;\r
\r
//\r
- // Write next varible to 125% * current and Inconsistent Memory Reserved across bootings may lead to S4 fail\r
+ // Inconsistent Memory Reserved across bootings may lead to S4 fail\r
+ // Write next varible to 125% * current when the pre-allocated memory is:\r
+ // 1. More than 150% of needed memory and boot mode is BOOT_WITH_DEFAULT_SETTING\r
+ // 2. Less than the needed memory\r
//\r
- if (Current < Previous) {\r
+ if ((Current + (Current >> 1)) < Previous) {\r
if (BootMode == BOOT_WITH_DEFAULT_SETTINGS) {\r
Next = Current + (Current >> 2);\r
- } else if (!MemoryTypeInformationVariableExists) {\r
- Next = MAX (Current + (Current >> 2), Previous);\r
}\r
} else if (Current > Previous) {\r
Next = Current + (Current >> 2);\r