OvmfPkg/PlatformBootManagerLib: Use EfiBootManagerRefreshAllBootOption()

The patch uses EfiBootManagerRefreshAllBootOption() to collect
all boot options and uses SetBootOrderFromQemu exposed by
QemuNewBootOrderLib to adjust the boot option order.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
index 722776b..c13e8f8 100644
--- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
+++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
@@ -14,7 +14,6 @@
 

 #include "BdsPlatform.h"

 #include <Guid/RootBridgesConnectedEventGroup.h>

-#include <Library/QemuBootOrderLib.h>

 

 

 //

@@ -1389,14 +1388,10 @@
   // Process QEMU's -kernel command line option

   //

   TryRunningQemuKernel ();

-  BdsLibEnumerateAllBootOption (BootOptionList);

 

-  SetBootOrderFromQemu (BootOptionList);

-  //

-  // The BootOrder variable may have changed, reload the in-memory list with

-  // it.

-  //

-  BdsLibBuildOptionFromVar (BootOptionList, L"BootOrder");

+  EfiBootManagerRefreshAllBootOption ();

+

+  SetBootOrderFromQemu (NULL);

 }

 

 /**

diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h
index b14410c..4950d3a 100644
--- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h
+++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h
@@ -47,6 +47,7 @@
 #include <Library/IoLib.h>

 #include <Library/NvVarsFileLib.h>

 #include <Library/QemuFwCfgLib.h>

+#include <Library/QemuBootOrderLib.h>

 

 #include <Protocol/Decompress.h>

 #include <Protocol/PciIo.h>