On Wed, 22 Jan 2025 at 19:09, Adriano Cordova <adria...@gmail.com> wrote: > > Support setting the device path with efi_dp_from_eth, efi_dp_from_ipv4, > and efi_dp_from_http to an ethernet device other than the current > ethernet udevice. Calling eth_dp_from_eth with eth_get_dev() as the > argument recovers the pevious functionality.
The commit meesage can be a bit clearer. i.e "There's a need to construct device path using an ethernet device different than the default. Add a udevice argument to the device path generation, and keep the callsites with eth_get_dev() to preserve existing functionality" or something along those lines. > > Signed-off-by: Adriano Cordova <adriano.cord...@canonical.com> > --- > include/efi_loader.h | 10 +++++----- > lib/efi_loader/efi_bootbin.c | 3 ++- > lib/efi_loader/efi_device_path.c | 21 ++++++++++++--------- > lib/efi_loader/efi_net.c | 24 ++++++++++++++---------- > 4 files changed, 33 insertions(+), 25 deletions(-) > > diff --git a/include/efi_loader.h b/include/efi_loader.h > index 97152bbb6a..8be52e2766 100644 > --- a/include/efi_loader.h > +++ b/include/efi_loader.h > @@ -128,9 +128,9 @@ static inline void efi_set_bootdev(const char *dev, const > char *devnr, > [...] > diff --git a/lib/efi_loader/efi_net.c b/lib/efi_loader/efi_net.c > index f0cf317d4f..a399f6f593 100644 > --- a/lib/efi_loader/efi_net.c > +++ b/lib/efi_loader/efi_net.c > @@ -949,10 +949,12 @@ efi_status_t efi_net_register(void) > &netobj->net); > if (r != EFI_SUCCESS) > goto failure_to_add_protocol; > - if (!net_dp) > - efi_net_set_dp("Net", NULL); > - r = efi_add_protocol(&netobj->header, &efi_guid_device_path, > - net_dp); > + > + if (net_dp) > + r = efi_add_protocol(&netobj->header, &efi_guid_device_path, > + net_dp); > + else > + r = efi_net_set_dp("Net", NULL, eth_get_dev()); This changes what the code previously does. Don't we still want to add the protocol for the default device? > if (r != EFI_SUCCESS) > goto failure_to_add_protocol; > r = efi_add_protocol(&netobj->header, > &efi_pxe_base_code_protocol_guid, > @@ -1068,17 +1070,18 @@ out_of_resources: > * > * @dev: dev to set the device path from > * @server: remote server address > + * @udev: net udevice > * Return: status code > */ > -efi_status_t efi_net_set_dp(const char *dev, const char *server) > +efi_status_t efi_net_set_dp(const char *dev, const char *server, struct > udevice *udev) > { > efi_free_pool(net_dp); > > net_dp = NULL; > if (!strcmp(dev, "Net")) > - net_dp = efi_dp_from_eth(); > + net_dp = efi_dp_from_eth(udev); > else if (!strcmp(dev, "Http")) > - net_dp = efi_dp_from_http(server); > + net_dp = efi_dp_from_http(server, udev); > > if (!net_dp) > return EFI_OUT_OF_RESOURCES; > @@ -1091,14 +1094,15 @@ efi_status_t efi_net_set_dp(const char *dev, const > char *server) > * > * Produce a copy of the current device path > * > - * @dp: copy of the current device path, or NULL on error > + * @dp: copy of the current device path > + * @udev: net udevice > */ > -void efi_net_get_dp(struct efi_device_path **dp) > +void efi_net_get_dp(struct efi_device_path **dp, struct udevice *udev) > { > if (!dp) > return; > if (!net_dp) > - efi_net_set_dp("Net", NULL); > + efi_net_set_dp("Net", NULL, udev); > if (net_dp) > *dp = efi_dp_dup(net_dp); > } > -- > 2.43.0 > Thanks /Ilias