File 0029-efi_loader-allow-unaligned-memory-a.patch of Package u-boot.25181
From 058f32aebcf5832f9733f9042788ea1e7d3ff68f Mon Sep 17 00:00:00 2001
From: Heinrich Schuchardt <xypron.glpk@gmx.de>
Date: Tue, 3 Apr 2018 21:59:32 +0200
Subject: [PATCH] efi_loader: allow unaligned memory access
The UEFI spec mandates that unaligned memory access should be enabled if
supported by the CPU architecture.
This patch adds an empty weak function unaligned_access() that can be
overridden by an architecture specific routine.
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
---
cmd/bootefi.c | 13 +++++++++++++
include/asm-generic/unaligned.h | 3 +++
2 files changed, 16 insertions(+)
diff --git a/cmd/bootefi.c b/cmd/bootefi.c
index 6546272348..b4cb116a0b 100644
--- a/cmd/bootefi.c
+++ b/cmd/bootefi.c
@@ -18,6 +18,7 @@
#include <memalign.h>
#include <asm/global_data.h>
#include <asm-generic/sections.h>
+#include <asm-generic/unaligned.h>
#include <linux/linkage.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -55,6 +56,15 @@ static void efi_init_obj_list(void)
efi_get_time_init();
}
+/*
+ * Allow unaligned memory access.
+ *
+ * This routine is overridden by architectures providing this feature.
+ */
+void __weak allow_unaligned(void)
+{
+}
+
/*
* Set the load options of an image from an environment variable.
*
@@ -315,6 +325,9 @@ static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
unsigned long addr, fdt_addr = 0;
efi_status_t r;
+ /* Allow unaligned memory access */
+ allow_unaligned();
+
if (argc < 2)
return CMD_RET_USAGE;
#ifdef CONFIG_CMD_BOOTEFI_HELLO
diff --git a/include/asm-generic/unaligned.h b/include/asm-generic/unaligned.h
index fd0255099a..3d33a5a063 100644
--- a/include/asm-generic/unaligned.h
+++ b/include/asm-generic/unaligned.h
@@ -20,4 +20,7 @@
#error invalid endian
#endif
+/* Allow unaligned memory access */
+void allow_unaligned(void);
+
#endif