aboutsummaryrefslogtreecommitdiff
path: root/cmd/bootefi.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2022-02-05 16:16:38 -0500
committerTom Rini <trini@konsulko.com>2022-02-05 16:16:38 -0500
commitb5c5b9a0bee56030f9f05ece52334b5207b72673 (patch)
tree7d4f13a4800ffdf132344be5ee10510fac33766d /cmd/bootefi.c
parent3aaabfe9ff4bbcd11096513b1b28d1fb0a40800f (diff)
parent6bbe12f61c4f7208b428cc038170dc286c872a91 (diff)
Merge tag 'efi-2022-04-rc2-2' of https://source.denx.de/u-boot/custodians/u-boot-efi
Pull request for efi-2022-04-rc2-2 UEFI * add unit test for RISCV_EFI_BOOT_PROTOCOL * disable UEFI for Colibri VF610 * add handle for UART * fix printing of Unicode strings * simplify enumeration of block devices
Diffstat (limited to 'cmd/bootefi.c')
-rw-r--r--cmd/bootefi.c32
1 files changed, 21 insertions, 11 deletions
diff --git a/cmd/bootefi.c b/cmd/bootefi.c
index 3a8b2b6061..94d18ca73f 100644
--- a/cmd/bootefi.c
+++ b/cmd/bootefi.c
@@ -65,6 +65,9 @@ void efi_set_bootdev(const char *dev, const char *devnr, const char *path,
struct efi_device_path *device, *image;
efi_status_t ret;
+ log_debug("dev=%s, devnr=%s, path=%s, buffer=%p, size=%zx\n", dev,
+ devnr, path, buffer, buffer_size);
+
/* Forget overwritten image */
if (buffer + buffer_size >= image_addr &&
image_addr + image_size >= buffer)
@@ -72,18 +75,19 @@ void efi_set_bootdev(const char *dev, const char *devnr, const char *path,
/* Remember only PE-COFF and FIT images */
if (efi_check_pe(buffer, buffer_size, NULL) != EFI_SUCCESS) {
-#ifdef CONFIG_FIT
- if (fit_check_format(buffer, IMAGE_SIZE_INVAL))
+ if (IS_ENABLED(CONFIG_FIT) &&
+ !fit_check_format(buffer, IMAGE_SIZE_INVAL)) {
+ /*
+ * FIT images of type EFI_OS are started via command
+ * bootm. We should not use their boot device with the
+ * bootefi command.
+ */
+ buffer = 0;
+ buffer_size = 0;
+ } else {
+ log_debug("- not remembering image\n");
return;
- /*
- * FIT images of type EFI_OS are started via command bootm.
- * We should not use their boot device with the bootefi command.
- */
- buffer = 0;
- buffer_size = 0;
-#else
- return;
-#endif
+ }
}
/* efi_set_bootdev() is typically called repeatedly, recover memory */
@@ -103,7 +107,11 @@ void efi_set_bootdev(const char *dev, const char *devnr, const char *path,
efi_free_pool(image_tmp);
}
bootefi_image_path = image;
+ log_debug("- recorded device %ls\n", efi_dp_str(device));
+ if (image)
+ log_debug("- and image %ls\n", efi_dp_str(image));
} else {
+ log_debug("- efi_dp_from_name() failed, err=%lx\n", ret);
efi_clear_bootdev();
}
}
@@ -451,6 +459,7 @@ efi_status_t efi_run_image(void *source_buffer, efi_uintn_t source_size)
u16 *load_options;
if (!bootefi_device_path || !bootefi_image_path) {
+ log_debug("Not loaded from disk\n");
/*
* Special case for efi payload not loaded from disk,
* such as 'bootefi hello' or for example payload
@@ -476,6 +485,7 @@ efi_status_t efi_run_image(void *source_buffer, efi_uintn_t source_size)
file_path = efi_dp_append(bootefi_device_path,
bootefi_image_path);
msg_path = bootefi_image_path;
+ log_debug("Loaded from disk\n");
}
log_info("Booting %pD\n", msg_path);