[edk2] [PATCH 2/2] OvmfPkg/QemuBootOrderLib: let an OFW devpath match multiple UEFI boot opts

Laszlo Ersek posted 2 patches 7 years ago
[edk2] [PATCH 2/2] OvmfPkg/QemuBootOrderLib: let an OFW devpath match multiple UEFI boot opts
Posted by Laszlo Ersek 7 years ago
This means that SetBootOrderFromQemu() will preserve all UEFI boot options
matched by any given OFW devpath, such as PXEv4, HTTPv4, PXEv6 and HTTPv6
boot options for the same NIC. Currently we stop the matching / appending
for the OFW devpath coming from the outer loop whenever we find the first
UEFI boot option match in the inner loop.

(The previous patch was about multiple OFW devpaths matching a single UEFI
boot option (which should never happen). This patch is about a single OFW
devpath matching multiple UEFI boot options. With the "break" statement
removed here, the small optimization from the last patch becomes a bit
more relevant, because now the inner loop always counts up to
ActiveCount.)

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
 OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c b/OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c
index a9a62e9d4007..366104adf535 100644
--- a/OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c
+++ b/OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c
@@ -1863,31 +1863,30 @@ SetBootOrderFromQemu (
       for (Idx = 0; Idx < ActiveCount; ++Idx) {
         if (!ActiveOption[Idx].Appended &&
             Match (
               Translated,
               TranslatedSize, // contains length, not size, in CHAR16's here
               ActiveOption[Idx].BootOption->FilePath
               )
             ) {
           //
           // match found, store ID and continue with next OpenFirmware path
           //
           Status = BootOrderAppend (&BootOrder, &ActiveOption[Idx]);
           if (Status != RETURN_SUCCESS) {
             goto ErrorFreeExtraPciRoots;
           }
-          break;
         }
       } // scanned all active boot options
     }   // translation successful
 
     TranslatedSize = ARRAY_SIZE (Translated);
     Status = TranslateOfwPath (&FwCfgPtr, ExtraPciRoots, Translated,
                &TranslatedSize);
   } // scanning of OpenFirmware paths done
 
   if (Status == RETURN_NOT_FOUND && BootOrder.Produced > 0) {
     //
     // No more OpenFirmware paths, some matches found: rewrite BootOrder NvVar.
     // Some of the active boot options that have not been selected over fw_cfg
     // should be preserved at the end of the boot order.
     //
-- 
2.14.1.3.gb7cf6e02401b

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH 2/2] OvmfPkg/QemuBootOrderLib: let an OFW devpath match multiple UEFI boot opts
Posted by Ard Biesheuvel 7 years ago
On 27 November 2017 at 19:03, Laszlo Ersek <lersek@redhat.com> wrote:
> This means that SetBootOrderFromQemu() will preserve all UEFI boot options
> matched by any given OFW devpath, such as PXEv4, HTTPv4, PXEv6 and HTTPv6
> boot options for the same NIC. Currently we stop the matching / appending
> for the OFW devpath coming from the outer loop whenever we find the first
> UEFI boot option match in the inner loop.
>
> (The previous patch was about multiple OFW devpaths matching a single UEFI
> boot option (which should never happen). This patch is about a single OFW
> devpath matching multiple UEFI boot options. With the "break" statement
> removed here, the small optimization from the last patch becomes a bit
> more relevant, because now the inner loop always counts up to
> ActiveCount.)
>
> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>

Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

> ---
>  OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c b/OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c
> index a9a62e9d4007..366104adf535 100644
> --- a/OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c
> +++ b/OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c
> @@ -1863,31 +1863,30 @@ SetBootOrderFromQemu (
>        for (Idx = 0; Idx < ActiveCount; ++Idx) {
>          if (!ActiveOption[Idx].Appended &&
>              Match (
>                Translated,
>                TranslatedSize, // contains length, not size, in CHAR16's here
>                ActiveOption[Idx].BootOption->FilePath
>                )
>              ) {
>            //
>            // match found, store ID and continue with next OpenFirmware path
>            //
>            Status = BootOrderAppend (&BootOrder, &ActiveOption[Idx]);
>            if (Status != RETURN_SUCCESS) {
>              goto ErrorFreeExtraPciRoots;
>            }
> -          break;
>          }
>        } // scanned all active boot options
>      }   // translation successful
>
>      TranslatedSize = ARRAY_SIZE (Translated);
>      Status = TranslateOfwPath (&FwCfgPtr, ExtraPciRoots, Translated,
>                 &TranslatedSize);
>    } // scanning of OpenFirmware paths done
>
>    if (Status == RETURN_NOT_FOUND && BootOrder.Produced > 0) {
>      //
>      // No more OpenFirmware paths, some matches found: rewrite BootOrder NvVar.
>      // Some of the active boot options that have not been selected over fw_cfg
>      // should be preserved at the end of the boot order.
>      //
> --
> 2.14.1.3.gb7cf6e02401b
>
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH 2/2] OvmfPkg/QemuBootOrderLib: let an OFW devpath match multiple UEFI boot opts
Posted by Laszlo Ersek 7 years ago
On 11/28/17 08:56, Ard Biesheuvel wrote:
> On 27 November 2017 at 19:03, Laszlo Ersek <lersek@redhat.com> wrote:
>> This means that SetBootOrderFromQemu() will preserve all UEFI boot options
>> matched by any given OFW devpath, such as PXEv4, HTTPv4, PXEv6 and HTTPv6
>> boot options for the same NIC. Currently we stop the matching / appending
>> for the OFW devpath coming from the outer loop whenever we find the first
>> UEFI boot option match in the inner loop.
>>
>> (The previous patch was about multiple OFW devpaths matching a single UEFI
>> boot option (which should never happen). This patch is about a single OFW
>> devpath matching multiple UEFI boot options. With the "break" statement
>> removed here, the small optimization from the last patch becomes a bit
>> more relevant, because now the inner loop always counts up to
>> ActiveCount.)
>>
>> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>> Cc: Jordan Justen <jordan.l.justen@intel.com>
>> Contributed-under: TianoCore Contribution Agreement 1.1
>> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> 
> Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

Series pushed as commit range f9bc2f876326..dc32e820f028.

Thanks!
Laszlo
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel