]> git.proxmox.com Git - mirror_edk2.git/commitdiff
OvmfPkg: QemuBootOrder: mark UEFI boot options selected by fw_cfg
authorLaszlo Ersek <lersek@redhat.com>
Fri, 13 Sep 2013 08:14:51 +0000 (08:14 +0000)
committerjljusten <jljusten@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 13 Sep 2013 08:14:51 +0000 (08:14 +0000)
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 <lersek@redhat.com>
Tested-by: Michael Chang <mchang@suse.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14667 6f19259b-4bc3-4df7-8a09-765794883524

OvmfPkg/Library/PlatformBdsLib/QemuBootOrder.c

index 72f78f1ca0d68b4bbabd5ac2fdc3966d1b34396b..31c3378856da2fd6458770e335a39a484d212e4d 100644 (file)
@@ -244,20 +244,22 @@ typedef struct {
 **/\r
 typedef struct {\r
   CONST BDS_COMMON_OPTION *BootOption; // reference only, no ownership\r
+  BOOLEAN                 Appended;    // has been added to a BOOT_ORDER?\r
 } ACTIVE_OPTION;\r
 \r
 \r
 /**\r
 \r
-  Append BootOptionId to BootOrder, reallocating the latter if needed.\r
+  Append an active boot option to BootOrder, reallocating the latter if needed.\r
 \r
   @param[in out] BootOrder     The structure pointing to the array and holding\r
                                allocation and usage counters.\r
 \r
-  @param[in]     BootOptionId  The value to append to the array.\r
+  @param[in]     ActiveOption  The active boot option whose ID should be\r
+                               appended to the array.\r
 \r
 \r
-  @retval RETURN_SUCCESS           BootOptionId appended.\r
+  @retval RETURN_SUCCESS           ID of ActiveOption appended.\r
 \r
   @retval RETURN_OUT_OF_RESOURCES  Memory reallocation failed.\r
 \r
@@ -265,8 +267,8 @@ typedef struct {
 STATIC\r
 RETURN_STATUS\r
 BootOrderAppend (\r
-  IN OUT  BOOT_ORDER *BootOrder,\r
-  IN      UINT16     BootOptionId\r
+  IN OUT  BOOT_ORDER    *BootOrder,\r
+  IN OUT  ACTIVE_OPTION *ActiveOption\r
   )\r
 {\r
   if (BootOrder->Produced == BootOrder->Allocated) {\r
@@ -287,7 +289,9 @@ BootOrderAppend (
     BootOrder->Data      = DataNew;\r
   }\r
 \r
-  BootOrder->Data[BootOrder->Produced++] = BootOptionId;\r
+  BootOrder->Data[BootOrder->Produced++] =\r
+                                         ActiveOption->BootOption->BootCurrent;\r
+  ActiveOption->Appended = TRUE;\r
   return RETURN_SUCCESS;\r
 }\r
 \r
@@ -343,6 +347,7 @@ CollectActiveOptions (
       if (IS_LOAD_OPTION_TYPE (Current->Attribute, LOAD_OPTION_ACTIVE)) {\r
         if (ScanMode == 1) {\r
           (*ActiveOption)[*Count].BootOption = Current;\r
+          (*ActiveOption)[*Count].Appended   = FALSE;\r
         }\r
         ++*Count;\r
       }\r
@@ -1119,8 +1124,7 @@ SetBootOrderFromQemu (
           //\r
           // match found, store ID and continue with next OpenFirmware path\r
           //\r
-          Status = BootOrderAppend (&BootOrder,\r
-                     ActiveOption[Idx].BootOption->BootCurrent);\r
+          Status = BootOrderAppend (&BootOrder, &ActiveOption[Idx]);\r
           if (Status != RETURN_SUCCESS) {\r
             goto ErrorFreeActiveOption;\r
           }\r