mirror of
https://github.com/u-boot/u-boot.git
synced 2025-05-08 19:11:53 +00:00
efi_loader: disk: allow blk devices even without UCLASS_PARTITION
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 d97e98c887
("efi_loader: disk: use udevice instead of blk_desc")
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Tested-by: Mark Kettenis <kettenis@openbsd.org>
This commit is contained in:
parent
8da26f5156
commit
6c640422ba
1 changed files with 15 additions and 14 deletions
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue