This will allow us to identify those UEFI boot options (while keeping
their relative order) that have *not* been selected by fw_cfg.

Contributed-under: TianoCore Contribution Agreement 1.0

Signed-off-by: Laszlo Ersek <[email protected]>
---
 OvmfPkg/Library/PlatformBdsLib/QemuBootOrder.c |   20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/OvmfPkg/Library/PlatformBdsLib/QemuBootOrder.c 
b/OvmfPkg/Library/PlatformBdsLib/QemuBootOrder.c
index 7139cc2..94c2411 100644
--- a/OvmfPkg/Library/PlatformBdsLib/QemuBootOrder.c
+++ b/OvmfPkg/Library/PlatformBdsLib/QemuBootOrder.c
@@ -243,20 +243,22 @@ typedef struct {
 **/
 typedef struct {
   CONST BDS_COMMON_OPTION *BootOption; // reference only, no ownership
+  BOOLEAN                 Appended;    // has been added to a BOOT_ORDER?
 } ACTIVE_OPTION;
 
 
 /**
 
-  Append BootOptionId to BootOrder, reallocating the latter if needed.
+  Append an active boot option to BootOrder, reallocating the latter if needed.
 
   @param[in out] BootOrder     The structure pointing to the array and holding
                                allocation and usage counters.
 
-  @param[in]     BootOptionId  The value to append to the array.
+  @param[in]     ActiveOption  The active boot option whose ID should be
+                               appended to the array.
 
 
-  @retval RETURN_SUCCESS           BootOptionId appended.
+  @retval RETURN_SUCCESS           ID of ActiveOption appended.
 
   @retval RETURN_OUT_OF_RESOURCES  Memory reallocation failed.
 
@@ -264,8 +266,8 @@ typedef struct {
 STATIC
 RETURN_STATUS
 BootOrderAppend (
-  IN OUT  BOOT_ORDER *BootOrder,
-  IN      UINT16     BootOptionId
+  IN OUT  BOOT_ORDER    *BootOrder,
+  IN OUT  ACTIVE_OPTION *ActiveOption
   )
 {
   if (BootOrder->Produced == BootOrder->Allocated) {
@@ -286,7 +288,9 @@ BootOrderAppend (
     BootOrder->Data      = DataNew;
   }
 
-  BootOrder->Data[BootOrder->Produced++] = BootOptionId;
+  BootOrder->Data[BootOrder->Produced++] =
+                                         ActiveOption->BootOption->BootCurrent;
+  ActiveOption->Appended = TRUE;
   return RETURN_SUCCESS;
 }
 
@@ -340,6 +344,7 @@ CollectActiveOptions (
       if (IS_LOAD_OPTION_TYPE (Current->Attribute, LOAD_OPTION_ACTIVE)) {
         if (ScanMode == 1) {
           (*ActiveOption)[*Count].BootOption = Current;
+          (*ActiveOption)[*Count].Appended   = FALSE;
         }
         ++*Count;
       }
@@ -1116,8 +1121,7 @@ SetBootOrderFromQemu (
           //
           // match found, store ID and continue with next OpenFirmware path
           //
-          Status = BootOrderAppend (&BootOrder,
-                     ActiveOption[Idx].BootOption->BootCurrent);
+          Status = BootOrderAppend (&BootOrder, &ActiveOption[Idx]);
           if (Status != RETURN_SUCCESS) {
             goto ErrorFreeActiveOption;
           }
-- 
1.7.1



------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58041391&iu=/4140/ostg.clktrk
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to