]> git.proxmox.com Git - mirror_edk2.git/commitdiff
OvmfPkg/BdsPlatform: don't restore NvVars from disk when flash is present
authorLaszlo Ersek <lersek@redhat.com>
Tue, 12 Nov 2013 18:35:32 +0000 (18:35 +0000)
committerjljusten <jljusten@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 12 Nov 2013 18:35:32 +0000 (18:35 +0000)
QemuFlashFvbServicesRuntimeDxe provides actual persistent storage for
non-volatile variables. When it is active, any on-disk NvVars file counts
as a stale source of variables -- hence don't load these files in BDS.

This also allows Secure Boot settings (eg. enrolled keys) to survive cold
VM reboots.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14844 6f19259b-4bc3-4df7-8a09-765794883524

OvmfPkg/Library/PlatformBdsLib/BdsPlatform.c
OvmfPkg/Library/PlatformBdsLib/PlatformBdsLib.inf

index ba6af2caefd8510708610b11777caf40dd88060d..ab9c93eaf8711a051222f67367710305a0aa2555 100644 (file)
@@ -1073,11 +1073,16 @@ Returns:
 \r
   ConnectRootBridge ();\r
 \r
-  //\r
-  // Try to restore variables from the hard disk early so\r
-  // they can be used for the other BDS connect operations.\r
-  //\r
-  PlatformBdsRestoreNvVarsFromHardDisk ();\r
+  if (PcdGetBool (PcdOvmfFlashVariablesEnable)) {\r
+    DEBUG ((EFI_D_INFO, "PlatformBdsPolicyBehavior: not restoring NvVars "\r
+      "from disk since flash variables appear to be supported.\n"));\r
+  } else {\r
+    //\r
+    // Try to restore variables from the hard disk early so\r
+    // they can be used for the other BDS connect operations.\r
+    //\r
+    PlatformBdsRestoreNvVarsFromHardDisk ();\r
+  }\r
 \r
   //\r
   // Init the time out value\r
index 7f7f4737944a44c3694b30c96c566d467ed8927e..a2b72bad3589990357423c9b68de7fb3254d1807 100644 (file)
@@ -57,6 +57,7 @@
   gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdPlatformBootTimeOut\r
   gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdLogoFile\r
   gUefiOvmfPkgTokenSpaceGuid.PcdEmuVariableEvent\r
+  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashVariablesEnable\r
 \r
 [Pcd.IA32, Pcd.X64]\r
   gEfiMdePkgTokenSpaceGuid.PcdFSBClock\r