summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJordan Justen <jordan.l.justen@intel.com>2013-08-30 19:29:09 +0000
committerjljusten <jljusten@6f19259b-4bc3-4df7-8a09-765794883524>2013-08-30 19:29:09 +0000
commit6bc7a0882d278227ef3107bf24c9b9712aa62732 (patch)
tree6af5c3f5c541f6fe459c1e2aa04ac682b95656d0
parent4ca3c688a4f9042a954e5303f017893de7214d09 (diff)
downloadedk2-platforms-6bc7a0882d278227ef3107bf24c9b9712aa62732.tar.xz
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 <jordan.l.justen@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Tested-by: Michael Chang <mchang@suse.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14613 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r--OvmfPkg/Library/NvVarsFileLib/FsAccess.c54
1 files changed, 42 insertions, 12 deletions
diff --git a/OvmfPkg/Library/NvVarsFileLib/FsAccess.c b/OvmfPkg/Library/NvVarsFileLib/FsAccess.c
index 190a56497f..937e4abe19 100644
--- a/OvmfPkg/Library/NvVarsFileLib/FsAccess.c
+++ b/OvmfPkg/Library/NvVarsFileLib/FsAccess.c
@@ -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 @@ ReadNvVarsFile (
/**
+ 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 @@ LoadNvVarsFromFs (
// 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 @@ SaveNvVarsToFs (
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"));
}