mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-29 09:45:52 +00:00
bootstd: Correct handling of script from network
When reading a script from a network, no block device is available. Update the implementation to support this correctly, avoiding setting environment variables which relate only to block devices. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
This commit is contained in:
parent
cfed2219e3
commit
60b180fdba
1 changed files with 31 additions and 20 deletions
|
@ -185,31 +185,42 @@ static int script_set_bootflow(struct udevice *dev, struct bootflow *bflow,
|
||||||
|
|
||||||
static int script_boot(struct udevice *dev, struct bootflow *bflow)
|
static int script_boot(struct udevice *dev, struct bootflow *bflow)
|
||||||
{
|
{
|
||||||
struct blk_desc *desc = dev_get_uclass_plat(bflow->blk);
|
struct blk_desc *desc;
|
||||||
ulong addr;
|
ulong addr;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
if (desc->uclass_id == UCLASS_USB) {
|
if (bflow->blk) {
|
||||||
ret = env_set("devtype", "usb");
|
desc = dev_get_uclass_plat(bflow->blk);
|
||||||
|
if (desc->uclass_id == UCLASS_USB) {
|
||||||
|
ret = env_set("devtype", "usb");
|
||||||
|
} else {
|
||||||
|
/*
|
||||||
|
* If the uclass is AHCI, but the driver is ATA
|
||||||
|
* (not scsi), set devtype to sata
|
||||||
|
*/
|
||||||
|
if (IS_ENABLED(CONFIG_SATA) &&
|
||||||
|
desc->uclass_id == UCLASS_AHCI)
|
||||||
|
ret = env_set("devtype", "sata");
|
||||||
|
else
|
||||||
|
ret = env_set("devtype", blk_get_devtype(bflow->blk));
|
||||||
|
}
|
||||||
|
if (!ret)
|
||||||
|
ret = env_set_hex("devnum", desc->devnum);
|
||||||
|
if (!ret)
|
||||||
|
ret = env_set_hex("distro_bootpart", bflow->part);
|
||||||
|
if (!ret)
|
||||||
|
ret = env_set("prefix", bflow->subdir);
|
||||||
|
if (!ret && IS_ENABLED(CONFIG_ARCH_SUNXI) &&
|
||||||
|
!strcmp("mmc", blk_get_devtype(bflow->blk)))
|
||||||
|
ret = env_set_hex("mmc_bootdev", desc->devnum);
|
||||||
} else {
|
} else {
|
||||||
/* If the uclass is AHCI, but the driver is ATA
|
const struct udevice *media = dev_get_parent(bflow->dev);
|
||||||
* (not scsi), set devtype to sata
|
|
||||||
*/
|
ret = env_set("devtype",
|
||||||
if (IS_ENABLED(CONFIG_SATA) &&
|
uclass_get_name(device_get_uclass_id(media)));
|
||||||
desc->uclass_id == UCLASS_AHCI)
|
if (!ret)
|
||||||
ret = env_set("devtype", "sata");
|
ret = env_set_hex("devnum", dev_seq(media));
|
||||||
else
|
|
||||||
ret = env_set("devtype", blk_get_devtype(bflow->blk));
|
|
||||||
}
|
}
|
||||||
if (!ret)
|
|
||||||
ret = env_set_hex("devnum", desc->devnum);
|
|
||||||
if (!ret)
|
|
||||||
ret = env_set_hex("distro_bootpart", bflow->part);
|
|
||||||
if (!ret)
|
|
||||||
ret = env_set("prefix", bflow->subdir);
|
|
||||||
if (!ret && IS_ENABLED(CONFIG_ARCH_SUNXI) &&
|
|
||||||
!strcmp("mmc", blk_get_devtype(bflow->blk)))
|
|
||||||
ret = env_set_hex("mmc_bootdev", desc->devnum);
|
|
||||||
if (ret)
|
if (ret)
|
||||||
return log_msg_ret("env", ret);
|
return log_msg_ret("env", ret);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue