(sorry for butting in)

On 06/24/13 23:13, Jordan Justen wrote:
> On Fri, Jun 21, 2013 at 1:27 AM, Michael Chang <[email protected]> wrote:
>> My fresh vm installation with OVMF firmware has problem that the OS boot
>> entry are not displayed by boot manager. It happens only when the EFI
>> System Partition are created from scratch, that is there's no NvVars in
>> it initially.
>>
>> After some testing and debugging, the cause is modified BootOrder gets
>> overwritten by the loaded NvVars, which is using a stale dump created
>> from previous boot.
>>
>> This patch fixes the problem for me by handing the initial case (ie NvVars
>> file not found) with loading NvVars immediately after it's been saved. Then
>> the system is flagged as NvVars loaded and would not attempt to restore it
>> in reboot which could always use stale dumps.
> 
> Is the side-effect of calling LoadNvVarsFromFs that the "NvVars"
> variable is set, and this fixes things?

Yes, and yes.

> Maybe SaveNvVarsToFs should make sure this variable is set?

The best place to set it would be IMHO the end of
PlatformBdsRestoreNvVarsFromHardDisk(), after the loop completed
successfully (ie. we've found the first Simple File System where we can
store the NvVars file).

However the loop could use some reorganization as well, and assignments
to some other global variables could be / should be migrated out of it too:

VisitAllInstancesOfProtocol() currently ignores the return value of the
callback function, and it maybe should when called from
VisitAllPciInstances(), but when called from
PlatformBdsRestoreNvVarsFromHardDisk(), I think the loop should
terminate at the first successful SaveNvVarsToFs().

In VisitingFileSystemInstance(), "ConnectedToFileSystem" should not
exist. VisitingFileSystemInstance() should terminate the calling loop by
retval. "mEmuVariableEvent" should be set up after the calling loop
completes too.

Same for "mNvVarsFileLibFsHandle" in ConnectNvVarsToFileSystem().

for each simple file system Fs:
  if the variable "NvVars" is not set:
    restore variables from Fs, ignore error
  save variables to Fs
  if success, break

if Fs is not NULL
  set the "NvVars" variable
  set mEmuVariableEvent
  set mNvVarsFileLibFsHandle

Laszlo

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to