]> git.proxmox.com Git - mirror_edk2.git/commitdiff
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)
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

index 3eaceb56f614a9ac76910ef5ebb62d149b66385e..d4bfcd0c071572b0d20d2bcac688183dc1758140 100644 (file)
@@ -546,13 +546,12 @@ PlatformBootManagerAfterConsole (
   //\r
   TryRunningQemuKernel ();\r
 \r
-  BdsLibEnumerateAllBootOption (BootOptionList);\r
-  SetBootOrderFromQemu (BootOptionList);\r
   //\r
-  // The BootOrder variable may have changed, reload the in-memory list with\r
-  // it.\r
+  // Enumerate all possible boot options, then filter and reorder them based on\r
+  // the QEMU configuration.\r
   //\r
-  BdsLibBuildOptionFromVar (BootOptionList, L"BootOrder");\r
+  EfiBootManagerRefreshAllBootOption ();\r
+  SetBootOrderFromQemu (NULL);\r
 }\r
 \r
 /**\r