/** @file\r
Misc library functions.\r
\r
-Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2011 - 2017, Intel Corporation. All rights reserved.<BR>\r
(C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
//\r
return;\r
}\r
- PreviousMemoryTypeInformation = GET_GUID_HOB_DATA (GuidHob);\r
- VariableSize = GET_GUID_HOB_DATA_SIZE (GuidHob);\r
+ VariableSize = GET_GUID_HOB_DATA_SIZE (GuidHob);\r
+ PreviousMemoryTypeInformation = AllocateCopyPool (VariableSize, GET_GUID_HOB_DATA (GuidHob));\r
+ if (PreviousMemoryTypeInformation == NULL) {\r
+ return;\r
+ }\r
\r
//\r
// Use a heuristic to adjust the Memory Type Information for the next boot\r
// then reset the platform so the new Memory Type Information setting will be used to guarantee that an S4\r
// entry/resume cycle will not fail.\r
//\r
- if (MemoryTypeInformationModified && Boot && PcdGetBool (PcdResetOnMemoryTypeInformationChange)) {\r
- DEBUG ((EFI_D_INFO, "Memory Type Information settings change. Warm Reset!!!\n"));\r
- gRT->ResetSystem (EfiResetWarm, EFI_SUCCESS, 0, NULL);\r
+ if (MemoryTypeInformationModified) {\r
+ DEBUG ((EFI_D_INFO, "Memory Type Information settings change.\n"));\r
+ if (Boot && PcdGetBool (PcdResetOnMemoryTypeInformationChange)) {\r
+ DEBUG ((EFI_D_INFO, "...Warm Reset!!!\n"));\r
+ gRT->ResetSystem (EfiResetWarm, EFI_SUCCESS, 0, NULL);\r
+ }\r
}\r
} else {\r
DEBUG ((EFI_D_ERROR, "Memory Type Information settings cannot be saved. OS S4 may fail!\n"));\r
}\r
}\r
+ FreePool (PreviousMemoryTypeInformation);\r
}\r
\r
/**\r