[Concept,v2,03/18] efi: Update path_uefi() to avoid allowed_unaligned()

Message ID 20250820112340.147082-4-sjg@u-boot.org
State New
Headers
Series efi: Move towards the EFI app booting EFI applications |

Commit Message

Simon Glass Aug. 20, 2025, 11:23 a.m. UTC
  From: Simon Glass <sjg@chromium.org>

This call seems to have been added in an unrelated commit, likely to fix
a bug:

  046fe7b5074 ("efi_loader: efi_dp_from_file() expect UTF-8 path")

With standard boot we don't need to call efi_set_bootdev(). Also this
function is not available in the EFI app.

So for now, add a condition, to avoid a build error in the x86 app when
CONFIG_EFI_BINARY_EXEC is enabled.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

(no changes since v1)

 lib/efi/device_path.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
  

Patch

diff --git a/lib/efi/device_path.c b/lib/efi/device_path.c
index 0926b51e987..fb6653b23a3 100644
--- a/lib/efi/device_path.c
+++ b/lib/efi/device_path.c
@@ -741,12 +741,14 @@  static void path_to_uefi(void *uefi, const char *src)
 {
 	u16 *pos = uefi;
 
-	/*
-	 * efi_set_bootdev() calls this routine indirectly before the UEFI
-	 * subsystem is initialized. So we cannot assume unaligned access to be
-	 * enabled.
-	 */
-	allow_unaligned();
+	if (!IS_ENABLED(CONFIG_EFI_APP)) {
+		/*
+		 * efi_set_bootdev() calls this routine indirectly before the
+		 * UEFI subsystem is initialized. So we cannot assume unaligned
+		 * access to be enabled.
+		 */
+		allow_unaligned();
+	}
 
 	while (*src) {
 		s32 code = utf8_get(&src);