]> git.proxmox.com Git - mirror_edk2.git/commit
ArmVirtPkg/PlatformBootManagerLib: rebase boot order manipulation
authorLaszlo Ersek <lersek@redhat.com>
Thu, 5 May 2016 15:45:42 +0000 (17:45 +0200)
committerLaszlo Ersek <lersek@redhat.com>
Fri, 6 May 2016 08:04:50 +0000 (10:04 +0200)
commitafa456de2538c82d227e50445fb1d4f2841e46c4
tree6f1e977ff9bb1503965075bd90f29ff64a0127fe
parentfa0f195451c01bbd432d145b7b3cf213025bf863
ArmVirtPkg/PlatformBootManagerLib: rebase boot order manipulation

QemuBootOrderLib can only filter out and reorder boot options; it cannot
create boot options. It relies on Platform BDS to auto-generate all
possible boot options first (for example, for new virtual devices that
have been configured since the last run of the virtual machine). Then it
will decide, case-by-case, whether each of those auto-generated boot
options should be preserved (and at what position), or removed.

Thus far, the only implementation of SetBootOrderFromQemu(), used in
connection with IntelFrameworkModulePkg BDS, has expected said complete
boot option list as an input parameter:

BdsEntry()                         [IntelFrameworkModulePkg/Universal/BdsDxe/BdsEntry.c]
  // create empty list
  InitializeListHead (
    &BootOptionList
    )

  PlatformBdsPolicyBehavior(       [ArmVirtPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.c]
    BootOptionList
    )

    BdsLibConnectAll()
    BdsLibEnumerateAllBootOption(
      BootOptionList
      )

    // at this point, BootOptionList starts with the preexistent boot
    // options, and ends with the auto-generated options

    SetBootOrderFromQemu(          [OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c]
      BootOptionList
      )

      // write out changed boot order to UEFI variables

    // The "BootOrder" variable may have changed. Refresh BootOptionList
    // from it, and return it to BdsEntry().

With MdeModulePkg BDS, a BootOptionList is not propagated from BdsEntry()
to SetBootOrderFromQemu() and back. All processing is based directly on
the underlying "BootOrder" and "Boot####" variables.

In OvmfPkg, commit d27ec22d1189 introduced a new instance of
QemuBootOrderLib, called QemuNewBootOrderLib. It is based on
UefiBootManagerLib, and rather than taking a complete BootOptionList as a
parameter, it expects that the "BootOrder" and "Boot####" variables are
complete in the above sense.

Rebase the boot order manipulation to UefiBootManagerLib and
QemuNewBootOrderLib, while keeping the requirement satisfied, like this:

BdsEntry()                               [MdeModulePkg/Universal/BdsDxe/BdsEntry.c]
  PlatformBootManagerAfterConsole()      [ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c]
    EfiBootManagerConnectAll()
    EfiBootManagerRefreshAllBootOption()

    // at this point all auto-generated options exist at the end of
    // "BootOrder"

    SetBootOrderFromQemu()               [OvmfPkg/Library/QemuNewBootOrderLib/QemuBootOrderLib.c]

      // read boot options from "BootOrder" and "Boot####", then
      // manipulate them

This patch parallels OvmfPkg commit 04fe914ba53e.

Once the USE_OLD_BDS fallback is removed from OvmfPkg, the parameter list
of the SetBootOrderFromQemu() prototype can be updated to VOID.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Tested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Ruiyu Ni <ruiyu.ni@Intel.com>
ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c