mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-19 19:34:35 +00:00
net: eth_bootdev_hunt() should not run DHCP
Currently when booting dhcp_run() may be executed multiple times: once in eth_bootdev_hunt() and once in the network booting bootmeth. We need to call eth_bootdev_hunt() when setting up the EFI sub-system to supply the simple network protocol. We don't need an IP address set up. We can reduce the bootime by not executing dhcp_run() in eth_bootdev_hunt(). Furthermore eth_bootdev_hunt() with autostart=yes leads on the legacy network stack leads to downloading a file via TFTP and to booting the downloaded file. Instead of running dchp_run() just check that there is a network device in eth_bootdev_hunt(). Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
37e0cf42cb
commit
1f68057e03
1 changed files with 18 additions and 12 deletions
|
@ -64,9 +64,23 @@ static int eth_bootdev_bind(struct udevice *dev)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* eth_bootdev_hunt() - probe all network devices
|
||||||
|
*
|
||||||
|
* Network devices can also come from USB, but that is a higher
|
||||||
|
* priority (BOOTDEVP_5_SCAN_SLOW) than network, so it should have been
|
||||||
|
* enumerated already. If something like 'bootflow scan dhcp' is used,
|
||||||
|
* then the user will need to run 'usb start' first.
|
||||||
|
*
|
||||||
|
* @info: info structure describing this hunter
|
||||||
|
* @show: true to show information from the hunter
|
||||||
|
*
|
||||||
|
* Return: 0 if device found, -EINVAL otherwise
|
||||||
|
*/
|
||||||
static int eth_bootdev_hunt(struct bootdev_hunter *info, bool show)
|
static int eth_bootdev_hunt(struct bootdev_hunter *info, bool show)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
struct udevice *dev = NULL;
|
||||||
|
|
||||||
if (!test_eth_enabled())
|
if (!test_eth_enabled())
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -78,19 +92,11 @@ static int eth_bootdev_hunt(struct bootdev_hunter *info, bool show)
|
||||||
log_warning("Failed to init PCI (%dE)\n", ret);
|
log_warning("Failed to init PCI (%dE)\n", ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
ret = -EINVAL;
|
||||||
* Ethernet devices can also come from USB, but that is a higher
|
uclass_foreach_dev_probe(UCLASS_ETH, dev)
|
||||||
* priority (BOOTDEVP_5_SCAN_SLOW) than ethernet, so it should have been
|
ret = 0;
|
||||||
* enumerated already. If something like 'bootflow scan dhcp' is used
|
|
||||||
* then the user will need to run 'usb start' first.
|
|
||||||
*/
|
|
||||||
if (IS_ENABLED(CONFIG_CMD_DHCP)) {
|
|
||||||
ret = dhcp_run(0, NULL, false);
|
|
||||||
if (ret)
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct bootdev_ops eth_bootdev_ops = {
|
struct bootdev_ops eth_bootdev_ops = {
|
||||||
|
|
Loading…
Add table
Reference in a new issue