[PATCH 04/13] arm: Introduce CPU_LE/CPU_BE macros

Jiaxun Yang jiaxun.yang at flygoat.com
Sun May 19 14:56:49 CEST 2024


They come from the same header in Linux.
They are used to conditional select code on different endianness.

Signed-off-by: Jiaxun Yang <jiaxun.yang at flygoat.com>
---
 arch/arm/include/asm/assembler.h | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/arch/arm/include/asm/assembler.h b/arch/arm/include/asm/assembler.h
index c3b8f34dd0af..2a3858d15d4e 100644
--- a/arch/arm/include/asm/assembler.h
+++ b/arch/arm/include/asm/assembler.h
@@ -93,4 +93,22 @@
 #define CALGN(code...) code
 #endif
 
+/*
+ * Select code when configured for BE.
+ */
+#if CONFIG_IS_ENABLED(SYS_BIG_ENDIAN)
+#define CPU_BE(code...) code
+#else
+#define CPU_BE(code...)
+#endif
+
+/*
+ * Select code when configured for LE.
+ */
+#if CONFIG_IS_ENABLED(SYS_BIG_ENDIAN)
+#define CPU_LE(code...)
+#else
+#define CPU_LE(code...) code
+#endif
+
 #endif

-- 
2.43.0



More information about the U-Boot mailing list