From: Mark Kettenis <mark.kettenis@xs4all.nl>
To: AKASHI Takahiro <takahiro.akashi@linaro.org>
Cc: xypron.glpk@gmx.de, u-boot@lists.denx.de, takahiro.akashi@linaro.org
Subject: Re: [PATCH] efi_loader: disk: allow blk devices even without UCLASS_PARTITION
Date: Thu, 28 Apr 2022 22:08:21 +0200 (CEST) [thread overview]
Message-ID: <d3cd2ef0fc9c44e1@bloch.sibelius.xs4all.nl> (raw)
In-Reply-To: <20220428044916.52250-1-takahiro.akashi@linaro.org> (message from AKASHI Takahiro on Thu, 28 Apr 2022 13:49:16 +0900)
> From: AKASHI Takahiro <takahiro.akashi@linaro.org>
> Date: Thu, 28 Apr 2022 13:49:16 +0900
>
> While GPT partition is mandated in UEFI specification, CONFIG_PARTITION is
> seen optional under the current implementation.
> So modify efi_disk_rw_blocks() to allow accepting UCLASS_BLK devices.
>
> Fixes: commit d97e98c887ed ("efi_loader: disk: use udevice instead of blk_desc")
> Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> ---
> lib/efi_loader/efi_disk.c | 29 +++++++++++++++--------------
> 1 file changed, 15 insertions(+), 14 deletions(-)
confirmed that this does indeed fix the regression
Tested-by: Mark Kettenis <kettenis@openbsd.org>
> diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c
> index 8fb5b2363c45..f5b462fb164a 100644
> --- a/lib/efi_loader/efi_disk.c
> +++ b/lib/efi_loader/efi_disk.c
> @@ -99,21 +99,22 @@ static efi_status_t efi_disk_rw_blocks(struct efi_block_io *this,
> if (buffer_size & (blksz - 1))
> return EFI_BAD_BUFFER_SIZE;
>
> -#if CONFIG_IS_ENABLED(PARTITIONS)
> - if (direction == EFI_DISK_READ)
> - n = dev_read(diskobj->dev, lba, blocks, buffer);
> - else
> - n = dev_write(diskobj->dev, lba, blocks, buffer);
> -#else
> - /* dev is always a block device (UCLASS_BLK) */
> - struct blk_desc *desc;
> + if (CONFIG_IS_ENABLED(PARTITIONS) &&
> + device_get_uclass_id(diskobj->dev) == UCLASS_PARTITION) {
> + if (direction == EFI_DISK_READ)
> + n = dev_read(diskobj->dev, lba, blocks, buffer);
> + else
> + n = dev_write(diskobj->dev, lba, blocks, buffer);
> + } else {
> + /* dev is a block device (UCLASS_BLK) */
> + struct blk_desc *desc;
>
> - desc = dev_get_uclass_plat(diskobj->dev);
> - if (direction == EFI_DISK_READ)
> - n = blk_dread(desc, lba, blocks, buffer);
> - else
> - n = blk_dwrite(desc, lba, blocks, buffer);
> -#endif
> + desc = dev_get_uclass_plat(diskobj->dev);
> + if (direction == EFI_DISK_READ)
> + n = blk_dread(desc, lba, blocks, buffer);
> + else
> + n = blk_dwrite(desc, lba, blocks, buffer);
> + }
>
> /* We don't do interrupts, so check for timers cooperatively */
> efi_timer_check();
> --
> 2.33.0
>
>
prev parent reply other threads:[~2022-04-28 20:08 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-28 4:49 [PATCH] efi_loader: disk: allow blk devices even without UCLASS_PARTITION AKASHI Takahiro
2022-04-28 10:43 ` Heinrich Schuchardt
2022-05-09 5:33 ` AKASHI Takahiro
2022-05-19 5:11 ` AKASHI Takahiro
2022-06-01 0:29 ` AKASHI Takahiro
2022-04-28 20:08 ` Mark Kettenis [this message]
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=d3cd2ef0fc9c44e1@bloch.sibelius.xs4all.nl \
--to=mark.kettenis@xs4all.nl \
--cc=takahiro.akashi@linaro.org \
--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