[PATCH] efi_loader: Let networking support depend on NETDEVICES

From: Jan Kiszka jan.kiszka@siemens.com
CONFIG_NET does not imply that there are actually network devices available, only CONFIG_NETDEVICES does. Changing to this dependency obsoletes the check in Kconfig because NETDEVICES means DM_ETH.
Suggested-by: Tom Rini trini@konsulko.com Signed-off-by: Jan Kiszka jan.kiszka@siemens.com --- lib/efi_loader/Kconfig | 1 - lib/efi_loader/Makefile | 2 +- lib/efi_loader/efi_device_path.c | 6 +++--- lib/efi_loader/efi_setup.c | 2 +- lib/efi_selftest/Makefile | 2 +- 5 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig index 41756ea5396..68e6c2531e1 100644 --- a/lib/efi_loader/Kconfig +++ b/lib/efi_loader/Kconfig @@ -11,7 +11,6 @@ config EFI_LOADER # We need EFI_STUB_32BIT to be set on x86_32 with EFI_STUB depends on !EFI_STUB || !X86 || X86_64 || EFI_STUB_32BIT depends on BLK - depends on DM_ETH || !NET depends on !EFI_APP default y if !ARM || SYS_CPU = armv7 || SYS_CPU = armv8 select CHARSET diff --git a/lib/efi_loader/Makefile b/lib/efi_loader/Makefile index e187d2a914f..418db296b20 100644 --- a/lib/efi_loader/Makefile +++ b/lib/efi_loader/Makefile @@ -68,7 +68,7 @@ obj-y += efi_watchdog.o obj-$(CONFIG_EFI_ESRT) += efi_esrt.o obj-$(CONFIG_DM_VIDEO) += efi_gop.o obj-$(CONFIG_BLK) += efi_disk.o -obj-$(CONFIG_NET) += efi_net.o +obj-$(CONFIG_NETDEVICES) += efi_net.o obj-$(CONFIG_GENERATE_ACPI_TABLE) += efi_acpi.o obj-$(CONFIG_GENERATE_SMBIOS_TABLE) += efi_smbios.o obj-$(CONFIG_EFI_RNG_PROTOCOL) += efi_rng.o diff --git a/lib/efi_loader/efi_device_path.c b/lib/efi_loader/efi_device_path.c index acae007f26f..d45985a7601 100644 --- a/lib/efi_loader/efi_device_path.c +++ b/lib/efi_loader/efi_device_path.c @@ -613,7 +613,7 @@ __maybe_unused static void *dp_fill(void *buf, struct udevice *dev) *vdp = ROOT; return &vdp[1]; } -#ifdef CONFIG_NET +#ifdef CONFIG_NETDEVICES case UCLASS_ETH: { struct efi_device_path_mac_addr *dp = dp_fill(buf, dev->parent); @@ -1052,7 +1052,7 @@ struct efi_device_path *efi_dp_from_uart(void) return buf; }
-#ifdef CONFIG_NET +#ifdef CONFIG_NETDEVICES struct efi_device_path *efi_dp_from_eth(void) { void *buf, *start; @@ -1169,7 +1169,7 @@ efi_status_t efi_dp_from_name(const char *dev, const char *devnr, return EFI_INVALID_PARAMETER;
if (!strcmp(dev, "Net")) { -#ifdef CONFIG_NET +#ifdef CONFIG_NETDEVICES if (device) *device = efi_dp_from_eth(); #endif diff --git a/lib/efi_loader/efi_setup.c b/lib/efi_loader/efi_setup.c index 9d7189336dc..212ce34b31c 100644 --- a/lib/efi_loader/efi_setup.c +++ b/lib/efi_loader/efi_setup.c @@ -331,7 +331,7 @@ efi_status_t efi_init_obj_list(void) if (ret != EFI_SUCCESS) goto out; #endif -#ifdef CONFIG_NET +#ifdef CONFIG_NETDEVICES ret = efi_net_register(); if (ret != EFI_SUCCESS) goto out; diff --git a/lib/efi_selftest/Makefile b/lib/efi_selftest/Makefile index daac6c39682..e4d75420bff 100644 --- a/lib/efi_selftest/Makefile +++ b/lib/efi_selftest/Makefile @@ -50,7 +50,7 @@ efi_selftest_variables_runtime.o \ efi_selftest_watchdog.o
obj-$(CONFIG_EFI_ECPT) += efi_selftest_ecpt.o -obj-$(CONFIG_NET) += efi_selftest_snp.o +obj-$(CONFIG_NETDEVICES) += efi_selftest_snp.o
obj-$(CONFIG_EFI_DEVICE_PATH_TO_TEXT) += efi_selftest_devicepath.o obj-$(CONFIG_EFI_UNICODE_COLLATION_PROTOCOL2) += \

On 10/14/22 18:10, Jan Kiszka wrote:
From: Jan Kiszka jan.kiszka@siemens.com
CONFIG_NET does not imply that there are actually network devices available, only CONFIG_NETDEVICES does. Changing to this dependenc
CONFIG_NETDEVICES=y does not imply that any network driver is selected it is just a tighter prerequisite than CONFIG_NET.
obsoletes the check in Kconfig because NETDEVICES means DM_ETH.
Suggested-by: Tom Rini trini@konsulko.com Signed-off-by: Jan Kiszka jan.kiszka@siemens.com
Thanks for the patch.
It is good to get rid of the dependency for CONFIG_EFI_LOADER.
Reviewed-by: Heinrich Schuchardt xypron.glpk@gmx.de

On 10/15/22 08:31, Heinrich Schuchardt wrote:
On 10/14/22 18:10, Jan Kiszka wrote:
From: Jan Kiszka jan.kiszka@siemens.com
CONFIG_NET does not imply that there are actually network devices available, only CONFIG_NETDEVICES does. Changing to this dependenc
CONFIG_NETDEVICES=y does not imply that any network driver is selected it is just a tighter prerequisite than CONFIG_NET.
obsoletes the check in Kconfig because NETDEVICES means DM_ETH.
Suggested-by: Tom Rini trini@konsulko.com Signed-off-by: Jan Kiszka jan.kiszka@siemens.com
Thanks for the patch.
It is good to get rid of the dependency for CONFIG_EFI_LOADER.
Reviewed-by: Heinrich Schuchardt xypron.glpk@gmx.de
For LicheePi_Zero_defconfig this patch results in:
arm-linux-gnueabi-ld.bfd: net/bootp.o: in function `dhcp_handler': net/bootp.c:1080: undefined reference to `efi_net_set_dhcp_ack'
I guess we should add:
diff --git a/net/bootp.c b/net/bootp.c index b260d5d09e..6c01e38153 100644 --- a/net/bootp.c +++ b/net/bootp.c @@ -1077,7 +1077,9 @@ static void dhcp_handler(uchar *pkt, unsigned dest, struct in_addr sip, strlen(CONFIG_SYS_BOOTFILE_PREFIX)) == 0) { #endif /* CONFIG_SYS_BOOTFILE_PREFIX */ dhcp_packet_process_options(bp); - efi_net_set_dhcp_ack(pkt, len); + if (CONFIG_IS_ENABLED(EFI_LOADER) && + CONFIG_IS_ENABLED(NET_DEVICES)) + efi_net_set_dhcp_ack(pkt, len);
As this was already incorrect before your patch:
Fixes: 0efe1bcf5c2c ("efi_loader: Add network access support")
Best regards
Heinrich

On 24.10.22 22:47, Heinrich Schuchardt wrote:
On 10/15/22 08:31, Heinrich Schuchardt wrote:
On 10/14/22 18:10, Jan Kiszka wrote:
From: Jan Kiszka jan.kiszka@siemens.com
CONFIG_NET does not imply that there are actually network devices available, only CONFIG_NETDEVICES does. Changing to this dependenc
CONFIG_NETDEVICES=y does not imply that any network driver is selected it is just a tighter prerequisite than CONFIG_NET.
obsoletes the check in Kconfig because NETDEVICES means DM_ETH.
Suggested-by: Tom Rini trini@konsulko.com Signed-off-by: Jan Kiszka jan.kiszka@siemens.com
Thanks for the patch.
It is good to get rid of the dependency for CONFIG_EFI_LOADER.
Reviewed-by: Heinrich Schuchardt xypron.glpk@gmx.de
For LicheePi_Zero_defconfig this patch results in:
arm-linux-gnueabi-ld.bfd: net/bootp.o: in function `dhcp_handler': net/bootp.c:1080: undefined reference to `efi_net_set_dhcp_ack'
I guess we should add:
diff --git a/net/bootp.c b/net/bootp.c index b260d5d09e..6c01e38153 100644 --- a/net/bootp.c +++ b/net/bootp.c @@ -1077,7 +1077,9 @@ static void dhcp_handler(uchar *pkt, unsigned dest, struct in_addr sip, strlen(CONFIG_SYS_BOOTFILE_PREFIX)) == 0) { #endif /* CONFIG_SYS_BOOTFILE_PREFIX */ dhcp_packet_process_options(bp); - efi_net_set_dhcp_ack(pkt, len); + if (CONFIG_IS_ENABLED(EFI_LOADER) && + CONFIG_IS_ENABLED(NET_DEVICES)) + efi_net_set_dhcp_ack(pkt, len);
As this was already incorrect before your patch:
Fixes: 0efe1bcf5c2c ("efi_loader: Add network access support")
Best regards
Heinrich
Will you send this, or should I submit a v2 of my patch with this included?
Jan
participants (2)
-
Heinrich Schuchardt
-
Jan Kiszka