Revision: 14613
          http://sourceforge.net/p/edk2/code/14613
Author:   jljusten
Date:     2013-08-30 19:29:09 +0000 (Fri, 30 Aug 2013)
Log Message:
-----------
OvmfPkg NvVarsFileLib: Set NvVars variable after writing vars file

The volatile 'NvVars' variable indicates that the variables do
not need to be loaded from the file again. After we write the
variables out to the file, there is clearly no need to load
them back from the file.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <[email protected]>
Reviewed-by: Laszlo Ersek <[email protected]>
Tested-by: Michael Chang <[email protected]>

Modified Paths:
--------------
    trunk/edk2/OvmfPkg/Library/NvVarsFileLib/FsAccess.c

Modified: trunk/edk2/OvmfPkg/Library/NvVarsFileLib/FsAccess.c
===================================================================
--- trunk/edk2/OvmfPkg/Library/NvVarsFileLib/FsAccess.c 2013-08-30 11:51:51 UTC 
(rev 14612)
+++ trunk/edk2/OvmfPkg/Library/NvVarsFileLib/FsAccess.c 2013-08-30 19:29:09 UTC 
(rev 14613)
@@ -1,7 +1,7 @@
 /** @file
   File System Access for NvVarsFileLib
 
-  Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2004 - 2013, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD 
License
   which accompanies this distribution.  The full text of the license may be 
found at
@@ -276,6 +276,39 @@
 
 
 /**
+  Writes a variable to indicate that the NV variables
+  have been loaded from the file system.
+
+**/
+STATIC
+VOID
+SetNvVarsVariable (
+  VOID
+  )
+{
+  BOOLEAN                        VarData;
+  UINTN                          Size;
+
+  //
+  // Write a variable to indicate we've already loaded the
+  // variable data.  If it is found, we skip the loading on
+  // subsequent attempts.
+  //
+  Size = sizeof (VarData);
+  VarData = TRUE;
+  gRT->SetVariable (
+         L"NvVars",
+         &gEfiSimpleFileSystemProtocolGuid,
+         EFI_VARIABLE_NON_VOLATILE |
+           EFI_VARIABLE_BOOTSERVICE_ACCESS |
+           EFI_VARIABLE_RUNTIME_ACCESS,
+         Size,
+         (VOID*) &VarData
+         );
+}
+
+
+/**
   Loads the non-volatile variables from the NvVars file on the
   given file system.
 
@@ -332,17 +365,7 @@
   // variable data.  If it is found, we skip the loading on
   // subsequent attempts.
   //
-  Size = sizeof (VarData);
-  VarData = TRUE;
-  gRT->SetVariable (
-         L"NvVars",
-         &gEfiSimpleFileSystemProtocolGuid,
-         EFI_VARIABLE_NON_VOLATILE |
-           EFI_VARIABLE_BOOTSERVICE_ACCESS |
-           EFI_VARIABLE_RUNTIME_ACCESS,
-         Size,
-         (VOID*) &VarData
-         );
+  SetNvVarsVariable();
 
   DEBUG ((
     EFI_D_INFO,
@@ -475,6 +498,13 @@
   FileHandleClose (File);
 
   if (!EFI_ERROR (Status)) {
+    //
+    // Write a variable to indicate we've already loaded the
+    // variable data.  If it is found, we skip the loading on
+    // subsequent attempts.
+    //
+    SetNvVarsVariable();
+
     DEBUG ((EFI_D_INFO, "Saved NV Variables to NvVars file\n"));
   }
 

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to