summaryrefslogtreecommitdiff
path: root/boot/bootmeth_efi.c
diff options
context:
space:
mode:
authorMathew McBride <matt@traverse.com.au>2023-04-24 13:49:50 +1200
committerTom Rini <trini@konsulko.com>2023-04-26 08:43:05 -0400
commit484e701d74c87b81d09734c00aafc6052caabb17 (patch)
tree5b044089775e04d92257f08bc6497bfc212f13e6 /boot/bootmeth_efi.c
parent1aabe4ef2b746c9aa76a25787a6aef57a165ca86 (diff)
downloadu-boot-484e701d74c87b81d09734c00aafc6052caabb17.tar.gz
u-boot-484e701d74c87b81d09734c00aafc6052caabb17.tar.bz2
u-boot-484e701d74c87b81d09734c00aafc6052caabb17.zip
bootstd: Use blk uclass device numbers to set efi bootdev
When loading a file from a block device, efiload_read_file was using the seq_num of the device (e.g "35" of virtio_blk#35) instead of the block device id (e.g what you get from running the corresponding device scan command, like "virtio 0") This cause EFI booting from these devices to fail as an invalid device number is passed to blk_get_device_part_str: Scanning bootdev 'virtio-blk#35.bootdev': distro_efi_read_bootflow_file start (efi,fname=<NULL>) distro_efi_read_bootflow_file start (efi,fname=<NULL>) setting bootdev virtio, 35, efi/boot/bootaa64.efi, 00000000beef9a40, 170800 efi_dp_from_name calling blk_get_device_part_str dev=virtio devnr=35 path=efi/boot/bootaa64.efi blk_get_device_part_str (virtio,35) blk_get_device_by_str (virtio, 35) ** Bad device specification virtio 35 ** Using default device tree: dtb/qemu-arm.dtb No device tree available 0 efi ready virtio 1 virtio-blk#35.bootdev.par efi/boot/bootaa64.efi ** Booting bootflow 'virtio-blk#35.bootdev.part_1' with efi blk_get_device_part_str (virtio,0:1) blk_get_device_by_str (virtio, 0) No UEFI binary known at beef9a40 (image buf=00000000beef9a40,addr=0000000000000000) Boot failed (err=-22) Signed-off-by: Mathew McBride <matt@traverse.com.au> Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'boot/bootmeth_efi.c')
-rw-r--r--boot/bootmeth_efi.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/boot/bootmeth_efi.c b/boot/bootmeth_efi.c
index d8bc7fafd1..6f70f2229b 100644
--- a/boot/bootmeth_efi.c
+++ b/boot/bootmeth_efi.c
@@ -112,7 +112,8 @@ static void set_efi_bootdev(struct blk_desc *desc, struct bootflow *bflow)
* this can go away.
*/
media_dev = dev_get_parent(bflow->dev);
- snprintf(devnum_str, sizeof(devnum_str), "%x:%x", dev_seq(media_dev),
+ snprintf(devnum_str, sizeof(devnum_str), "%x:%x",
+ desc ? desc->devnum : dev_seq(media_dev),
bflow->part);
strlcpy(dirname, bflow->fname, sizeof(dirname));