summaryrefslogtreecommitdiff
path: root/boot
diff options
context:
space:
mode:
authorTom Rini <[email protected]>2025-01-26 08:10:28 -0600
committerTom Rini <[email protected]>2025-01-26 08:10:28 -0600
commit8a2a71a4eec7afdca6377ee46b1ed7e78ec692c9 (patch)
tree460b9a426fc254b7fd9f4048dabccfb54822ba02 /boot
parent292278d6828e6c8c6ae11bc8658586d1acc411d4 (diff)
parent21de624eb89c647a21b06a5b0f5b186838be1d17 (diff)
Merge tag 'efi-2025-04-rc1-2' of https://source.denx.de/u-boot/custodians/u-boot-efi
Pull request efi-2025-04-rc1-2 Documentation: * describe creating a pflash file for qemu-system-riscv64 UEFI: * correct logging StartImage() * use LOGC_EFI consistently * reduce UEFI size if HAS_BOARD_SIZE_LIMIT=y * Update efi_run_image() to accept image and device path * Add a version of efi_binary_run() with more parameters * Move the fallback code from efi_run_image() * Pass in the required parameters from EFI bootmeth * bootmeth_efi: Support PXE booting Other: * Enable log filtering by function name
Diffstat (limited to 'boot')
-rw-r--r--boot/bootmeth_efi.c64
1 files changed, 3 insertions, 61 deletions
diff --git a/boot/bootmeth_efi.c b/boot/bootmeth_efi.c
index a2998452666..0c9b4c3d59d 100644
--- a/boot/bootmeth_efi.c
+++ b/boot/bootmeth_efi.c
@@ -52,40 +52,6 @@ static bool bootmeth_uses_network(struct bootflow *bflow)
device_get_uclass_id(media) == UCLASS_ETH;
}
-static void set_efi_bootdev(struct blk_desc *desc, struct bootflow *bflow)
-{
- const struct udevice *media_dev;
- int size = bflow->size;
- const char *dev_name;
- char devnum_str[9];
- char dirname[200];
- char *last_slash;
-
- /*
- * This is a horrible hack to tell EFI about this boot device. Once we
- * unify EFI with the rest of U-Boot we can clean this up. The same hack
- * exists in multiple places, e.g. in the fs, tftp and load commands.
- *
- * Once we can clean up the EFI code to make proper use of driver model,
- * this can go away.
- */
- media_dev = dev_get_parent(bflow->dev);
- snprintf(devnum_str, sizeof(devnum_str), "%x:%x",
- desc ? desc->devnum : dev_seq(media_dev),
- bflow->part);
-
- strlcpy(dirname, bflow->fname, sizeof(dirname));
- last_slash = strrchr(dirname, '/');
- if (last_slash)
- *last_slash = '\0';
-
- dev_name = device_get_uclass_id(media_dev) == UCLASS_MASS_STORAGE ?
- "usb" : blk_get_uclass_name(device_get_uclass_id(media_dev));
- log_debug("setting bootdev %s, %s, %s, %p, %x\n",
- dev_name, devnum_str, bflow->fname, bflow->buf, size);
- efi_set_bootdev(dev_name, devnum_str, bflow->fname, bflow->buf, size);
-}
-
static int efiload_read_file(struct bootflow *bflow, ulong addr)
{
struct blk_desc *desc = NULL;
@@ -102,8 +68,6 @@ static int efiload_read_file(struct bootflow *bflow, ulong addr)
return log_msg_ret("rdf", ret);
bflow->buf = map_sysmem(addr, bflow->size);
- set_efi_bootdev(desc, bflow);
-
return 0;
}
@@ -246,6 +210,7 @@ static int distro_efi_read_bootflow_net(struct bootflow *bflow)
if (size <= 0)
return log_msg_ret("sz", -EINVAL);
bflow->size = size;
+ bflow->buf = map_sysmem(addr, size);
/* bootfile should be setup by dhcp */
bootfile_name = env_get("bootfile");
@@ -255,10 +220,6 @@ static int distro_efi_read_bootflow_net(struct bootflow *bflow)
if (!bflow->fname)
return log_msg_ret("fi0", -ENOMEM);
- /* do the hideous EFI hack */
- efi_set_bootdev("Net", "", bflow->fname, map_sysmem(addr, 0),
- bflow->size);
-
/* read the DT file also */
fdt_addr_str = env_get("fdt_addr_r");
if (!fdt_addr_str)
@@ -332,29 +293,10 @@ static int distro_efi_boot(struct udevice *dev, struct bootflow *bflow)
if (bflow->flags & ~BOOTFLOWF_USE_BUILTIN_FDT)
fdt = bflow->fdt_addr;
- } else {
- /*
- * This doesn't actually work for network devices:
- *
- * do_bootefi_image() No UEFI binary known at 0x02080000
- *
- * But this is the same behaviour for distro boot, so it can be
- * fixed here.
- */
- fdt = env_get_hex("fdt_addr_r", 0);
}
- if (bflow->flags & BOOTFLOWF_USE_BUILTIN_FDT) {
- log_debug("Booting with built-in fdt\n");
- if (efi_binary_run(map_sysmem(kernel, 0), bflow->size,
- EFI_FDT_USE_INTERNAL))
- return log_msg_ret("run", -EINVAL);
- } else {
- log_debug("Booting with external fdt\n");
- if (efi_binary_run(map_sysmem(kernel, 0), bflow->size,
- map_sysmem(fdt, 0)))
- return log_msg_ret("run", -EINVAL);
- }
+ if (efi_bootflow_run(bflow))
+ return log_msg_ret("run", -EINVAL);
return 0;
}