]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkModulePkg/Library/GenericBdsLib/BdsMisc.c
Do not reset system when the MemoryTypeInformation variable cannot be written.
[mirror_edk2.git] / IntelFrameworkModulePkg / Library / GenericBdsLib / BdsMisc.c
index 971188bd0a85620331b3bf5287f8bd7544518105..cafbe71e25993f28fc5976713f2768168e13f2db 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Misc BDS library function\r
 \r
-Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -1422,19 +1422,23 @@ BdsSetMemoryTypeInformationVariable (
     Status = gRT->SetVariable (\r
                     EFI_MEMORY_TYPE_INFORMATION_VARIABLE_NAME,\r
                     &gEfiMemoryTypeInformationGuid,\r
-                    EFI_VARIABLE_NON_VOLATILE  | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,\r
+                    EFI_VARIABLE_NON_VOLATILE  | EFI_VARIABLE_BOOTSERVICE_ACCESS,\r
                     VariableSize,\r
                     PreviousMemoryTypeInformation\r
                     );\r
 \r
-    //\r
-    // If the Memory Type Information settings have been modified, then reset the platform\r
-    // 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 && 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 (!EFI_ERROR (Status)) {\r
+      //\r
+      // If the Memory Type Information settings have been modified, then reset the platform\r
+      // 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 && PcdGetBool (PcdResetOnMemoryTypeInformationChange)) {\r
+        DEBUG ((EFI_D_INFO, "Memory Type Information settings change. Warm Reset!!!\n"));\r
+        gRT->ResetSystem (EfiResetWarm, EFI_SUCCESS, 0, NULL);\r
+      }\r
+    } else {\r
+      DEBUG ((EFI_D_ERROR, "Memory Type Information settings cannot be saved. OS S4 may fail!\n"));\r
     }\r
   }\r
 }\r