audk/ArmVirtPkg
Laszlo Ersek afa456de25 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 d27ec22d11 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 04fe914ba5.

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>
2016-05-06 10:04:50 +02:00
..
FdtClientDxe ArmVirtPkg/VirtFdtDxe: move FDT config table installation to FdtClientDxe 2016-04-13 17:26:06 +02:00
HighMemDxe ArmVirtPkg: HighMemDxe: add memory space for the high memory nodes 2015-12-04 16:17:17 +00:00
Include ArmVirtPkg: introduce FdtClientProtocol 2016-04-11 18:12:21 +02:00
Library ArmVirtPkg/PlatformBootManagerLib: rebase boot order manipulation 2016-05-06 10:04:50 +02:00
PciHostBridgeDxe ArmVirtPkg/PciHostBridgeDxe: move to FDT client protocol 2016-04-12 17:59:05 +02:00
PrePi ArmVirtPkg/PrePiRelocatable: add ARM support 2015-12-17 17:11:16 +00:00
VirtioFdtDxe ArmVirtPkg/VirtFdtDxe: remove Xenio handling and rename to VirtioFdtDxe 2016-04-13 17:26:07 +02:00
XenioFdtDxe ArmVirtPkg/ArmVirtXen: move from VirtFdtDxe to new XenioFdtDxe driver 2016-04-13 17:26:06 +02:00
ArmVirt.dsc.inc ArmVirtPkg: drop bogus ArmPlatformSecExtraActionLib resolution 2016-04-07 14:35:20 +02:00
ArmVirtPkg.dec ArmVirtPkg/VirtFdtDxe: remove handling of fw_cfg DT node 2016-04-12 11:07:36 +02:00
ArmVirtQemu.dsc ArmVirtPkg/PlatformBootManagerLib: don't launch the Boot Manager Menu 2016-05-06 10:04:49 +02:00
ArmVirtQemu.fdf ArmVirtPkg/VirtFdtDxe: remove Xenio handling and rename to VirtioFdtDxe 2016-04-13 17:26:07 +02:00
ArmVirtQemuKernel.dsc ArmVirtPkg/PlatformBootManagerLib: don't launch the Boot Manager Menu 2016-05-06 10:04:49 +02:00
ArmVirtQemuKernel.fdf ArmVirtPkg/VirtFdtDxe: remove Xenio handling and rename to VirtioFdtDxe 2016-04-13 17:26:07 +02:00
ArmVirtXen.dsc ArmVirtPkg/ArmVirtXen: move from VirtFdtDxe to new XenioFdtDxe driver 2016-04-13 17:26:06 +02:00
ArmVirtXen.fdf ArmVirtPkg/ArmVirtXen: move from VirtFdtDxe to new XenioFdtDxe driver 2016-04-13 17:26:06 +02:00
Contributions.txt ArmVirtPkg: add "Contributions.txt" and "License.txt" 2015-06-08 22:00:36 +00:00
License.txt ArmVirtPkg: add "Contributions.txt" and "License.txt" 2015-06-08 22:00:36 +00:00