summaryrefslogtreecommitdiff
path: root/include/common.h
diff options
context:
space:
mode:
authorAndre Przywara <andre.przywara@arm.com>2017-01-02 11:48:30 +0000
committerJagan Teki <jagan@openedev.com>2017-01-04 16:37:41 +0100
commit2a6713b09b8da58572338abac276aa764bb6eadd (patch)
treeddaf3da4360dc6530937b22fd7d1526d7b917ea0 /include/common.h
parent1c853629d936f88d7d41bdd01a3bd8c55391e754 (diff)
move UL() macro from armv8/mmu.h into common.h
The UL() macro is pretty useful in sharing constants between assembly and C files while still being able to specify a type for C. Move the macro from an armv8 specific header into a common header file to be able to use it by arm code (for instance) as well. Signed-off-by: Andre Przywara <andre.przywara@arm.com> Reviewed-by: Alexander Graf <agraf@suse.de> Reviewed-by: Jagan Teki <jagan@openedev.com>
Diffstat (limited to 'include/common.h')
-rw-r--r--include/common.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/include/common.h b/include/common.h
index a8d833b989..ee0436bff5 100644
--- a/include/common.h
+++ b/include/common.h
@@ -15,6 +15,9 @@ typedef volatile unsigned long vu_long;
typedef volatile unsigned short vu_short;
typedef volatile unsigned char vu_char;
+/* Allow sharing constants with type modifiers between C and assembly. */
+#define _AC(X, Y) (X##Y)
+
#include <config.h>
#include <errno.h>
#include <asm-offsets.h>
@@ -936,7 +939,12 @@ int cpu_disable(int nr);
int cpu_release(int nr, int argc, char * const argv[]);
#endif
-#endif /* __ASSEMBLY__ */
+#else /* __ASSEMBLY__ */
+
+/* Drop a C type modifier (like in 3UL) for constants used in assembly. */
+#define _AC(X, Y) X
+
+#endif /* __ASSEMBLY__ */
#ifdef CONFIG_PPC
/*
@@ -948,6 +956,9 @@ int cpu_release(int nr, int argc, char * const argv[]);
/* Put only stuff here that the assembler can digest */
+/* Declare an unsigned long constant digestable both by C and an assembler. */
+#define UL(x) _AC(x, UL)
+
#ifdef CONFIG_POST
#define CONFIG_HAS_POST
#ifndef CONFIG_POST_ALT_LIST