summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2018-11-20 12:36:47 -0500
committerTom Rini <trini@konsulko.com>2018-11-20 12:39:16 -0500
commita3e1653ddeb02f39481eba572275016171e9670c (patch)
treeab620de093377355ef863ecfe4e1bfda9a9129c8 /include/linux
parente070dc422d98cd232a928ceba87ac448854b8f25 (diff)
parent5bbf36af7ff6f4ff77d903320e95e5628c68884d (diff)
Merge git://git.denx.de/u-boot-marvell
- Clearfog GT-8K support added by Baruch / Raheeb - const and sizes cleanup (also in MIPS) from Baruch - Minor cleanup to db-88f6820 from Chris
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/const.h34
-rw-r--r--include/linux/sizes.h4
2 files changed, 38 insertions, 0 deletions
diff --git a/include/linux/const.h b/include/linux/const.h
new file mode 100644
index 0000000000..379c889232
--- /dev/null
+++ b/include/linux/const.h
@@ -0,0 +1,34 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+#ifndef _LINUX_CONST_H
+#define _LINUX_CONST_H
+
+/* const.h: Macros for dealing with constants. */
+
+/* Some constant macros are used in both assembler and
+ * C code. Therefore we cannot annotate them always with
+ * 'UL' and other type specifiers unilaterally. We
+ * use the following macros to deal with this.
+ *
+ * Similarly, _AT() will cast an expression with a type in C, but
+ * leave it unchanged in asm.
+ */
+
+#ifdef __ASSEMBLY__
+#define _AC(X,Y) X
+#define _AT(T,X) X
+#else
+#define __AC(X,Y) (X##Y)
+#define _AC(X,Y) __AC(X,Y)
+#define _AT(T,X) ((T)(X))
+#endif
+
+#define _UL(x) (_AC(x, UL))
+#define _ULL(x) (_AC(x, ULL))
+
+#define _BITUL(x) (_UL(1) << (x))
+#define _BITULL(x) (_ULL(1) << (x))
+
+#define UL(x) (_UL(x))
+#define ULL(x) (_ULL(x))
+
+#endif /* _LINUX_CONST_H */
diff --git a/include/linux/sizes.h b/include/linux/sizes.h
index ce3e8150c1..fbde0bc7e8 100644
--- a/include/linux/sizes.h
+++ b/include/linux/sizes.h
@@ -8,6 +8,8 @@
#ifndef __LINUX_SIZES_H__
#define __LINUX_SIZES_H__
+#include <linux/const.h>
+
#define SZ_1 0x00000001
#define SZ_2 0x00000002
#define SZ_4 0x00000004
@@ -44,4 +46,6 @@
#define SZ_1G 0x40000000
#define SZ_2G 0x80000000
+#define SZ_4G _AC(0x100000000, ULL)
+
#endif /* __LINUX_SIZES_H__ */