On Sat, Aug 17, 2013 at 11:16:16PM -0700, Jordan Justen wrote:
> 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]>
> Cc: Michael Chang <[email protected]>
> Cc: Laszlo Ersek <[email protected]>
> ---
> Michael,
>
> Does this patch fix the issue you highlighted (way back) on June
> 21st in your patch:
> * OvmfPkg/NvVarsFileLib: handle the inital file not found
It seems not fix the problem if I use regular openSUSE 12.3
installation to a new virtual disk or chooses to recreate the ESP
if it already exists.
However the manual test step works, if without your patch it fails. I
list the steps for reference.
Fistly to simulate the initial (disk) condition.
Delete NvVars File
$ rm /boot/efi/NvVars
Delete openSUSE boot entry
$ efibootmgr -b 0005 -B
Delete NvVars variables
$ cd /sys/firmware/efi/vars
$ cat NvVars-<GUID ..>/raw_var > del_var
Power off
$ poweroff
Now we can start vm to install the bootloader, use efi shell to
launch the installed grub2. In the booted system, use
$ grub2-install
Check if boot variable are written correctly
$ efibootmgr -v
Reboot and check if opensuse shows in the EFI boot manager ..
So there could be some other corner cases, but I cannot tell it now.
I can continue to investigate it or do you have any other better
idea?
Thanks,
Michael
>
> It is a bit of a guess on my part if this will fix the issue you are
> seeing, but it sounds like it might based on your patch. If it does
> fix the issue, then I would prefer this patch.
>
> -Jordan
>
> OvmfPkg/Library/NvVarsFileLib/FsAccess.c | 54
> +++++++++++++++++++++++-------
> 1 file changed, 42 insertions(+), 12 deletions(-)
>
> diff --git a/OvmfPkg/Library/NvVarsFileLib/FsAccess.c
> b/OvmfPkg/Library/NvVarsFileLib/FsAccess.c
> index 190a564..937e4ab 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"));
> }
>
> --
> 1.7.10.4
>
--
Michael Chang
Software Engineer
Rm. B, 26F, No.216, Tun Hwa S. Rd., Sec.2
Taipei 106, Taiwan, R.O.C
+886223760030
[email protected]
SUSE
------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead.
Download for free and get started troubleshooting in minutes.
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel