From: Mattijs Korpershoek <mkorpershoek@baylibre.com>
To: Simon Glass <sjg@chromium.org>,
U-Boot Mailing List <u-boot@lists.denx.de>
Cc: Tom Rini <trini@konsulko.com>,
Heinrich Schuchardt <xypron.glpk@gmx.de>,
Simon Glass <sjg@chromium.org>
Subject: Re: [PATCH v2 10/14] bootstd: Correct handling of script from network
Date: Tue, 16 Jul 2024 09:45:36 +0200 [thread overview]
Message-ID: <87frs9n5jz.fsf@baylibre.com> (raw)
In-Reply-To: <20240716070419.1897560-11-sjg@chromium.org>
Hi Simon,
Thank you for the patch.
On mar., juil. 16, 2024 at 08:04, Simon Glass <sjg@chromium.org> wrote:
> 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>
> ---
>
> (no changes since v1)
>
> boot/bootmeth_script.c | 51 +++++++++++++++++++++++++-----------------
> 1 file changed, 31 insertions(+), 20 deletions(-)
>
> diff --git a/boot/bootmeth_script.c b/boot/bootmeth_script.c
> index 24da47c7259..c5cbf18c2e6 100644
> --- a/boot/bootmeth_script.c
> +++ b/boot/bootmeth_script.c
> @@ -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)
> {
> - struct blk_desc *desc = dev_get_uclass_plat(bflow->blk);
> + struct blk_desc *desc;
> ulong addr;
> int ret = 0;
>
> - if (desc->uclass_id == UCLASS_USB) {
> - ret = env_set("devtype", "usb");
> + if (bflow->blk) {
> + 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 {
> - /* 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));
> + const struct udevice *media = dev_get_parent(bflow->dev);
> +
> + ret = env_set("devtype",
> + uclass_get_name(device_get_uclass_id(media)));
> + if (!ret)
> + ret = env_set_hex("devnum", dev_seq(media));
> }
> - 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)
> return log_msg_ret("env", ret);
>
> --
> 2.34.1
next prev parent reply other threads:[~2024-07-16 7:45 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-16 7:04 [PATCH v2 00/14] doc: Add documentation for bootmeths Simon Glass
2024-07-16 7:04 ` [PATCH v2 01/14] MAINTAINERS: Rename BOOTDEVICE Simon Glass
2024-07-16 7:34 ` Mattijs Korpershoek
2024-07-16 7:04 ` [PATCH v2 02/14] doc: Move bootstd into its own directory Simon Glass
2024-07-16 7:35 ` Mattijs Korpershoek
2024-07-16 7:04 ` [PATCH v2 03/14] doc: Mention automatic binding of bootmeths Simon Glass
2024-07-16 7:36 ` Mattijs Korpershoek
2024-07-16 7:04 ` [PATCH v2 04/14] doc: Add a description for bootmeth_extlinux Simon Glass
2024-07-16 7:37 ` Mattijs Korpershoek
2024-07-16 7:04 ` [PATCH v2 05/14] doc: Add a description for bootmeth_pxe Simon Glass
2024-07-16 7:38 ` Mattijs Korpershoek
2024-07-16 7:04 ` [PATCH v2 06/14] doc: Add a description for bootmeth_qfw Simon Glass
2024-07-16 7:40 ` Mattijs Korpershoek
2024-07-16 7:04 ` [PATCH v2 07/14] doc: Add a description for bootmeth_cros Simon Glass
2024-07-16 7:41 ` Mattijs Korpershoek
2024-07-16 7:04 ` [PATCH v2 08/14] doc: Add a description for bootmeth_sandbox Simon Glass
2024-07-16 7:41 ` Mattijs Korpershoek
2024-07-16 7:04 ` [PATCH v2 09/14] bootstd: Tidy up comments on the boothmeth drivers Simon Glass
2024-07-16 7:42 ` Mattijs Korpershoek
2024-07-16 7:04 ` [PATCH v2 10/14] bootstd: Correct handling of script from network Simon Glass
2024-07-16 7:45 ` Mattijs Korpershoek [this message]
2024-07-16 7:04 ` [PATCH v2 11/14] doc: Add a description for bootmeth_script Simon Glass
2024-07-16 7:49 ` Mattijs Korpershoek
2024-07-16 7:04 ` [PATCH v2 12/14] doc: Add a link to VBE from the bootstd docs Simon Glass
2024-07-16 7:50 ` Mattijs Korpershoek
2024-07-16 7:04 ` [PATCH v2 13/14] boot: Correct indentation in efi bootmeth Simon Glass
2024-07-16 7:50 ` Mattijs Korpershoek
2024-07-16 7:04 ` [PATCH v2 14/14] doc: Describe the bootstd settings Simon Glass
2024-07-16 7:51 ` Mattijs Korpershoek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87frs9n5jz.fsf@baylibre.com \
--to=mkorpershoek@baylibre.com \
--cc=sjg@chromium.org \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
--cc=xypron.glpk@gmx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox