mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Antony Pavlov <antonynpavlov@gmail.com>
To: barebox@lists.infradead.org
Subject: [PATCH v2 01/10] import _AC and UL macros from linux kernel
Date: Sun, 16 Mar 2014 17:48:12 +0400	[thread overview]
Message-ID: <1394977701-5889-2-git-send-email-antonynpavlov@gmail.com> (raw)
In-Reply-To: <1394977701-5889-1-git-send-email-antonynpavlov@gmail.com>

This macros are used in exported from linux TI DaVinci code.
Also this macros are used in MIPS cache support code.

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
---
 arch/arm/include/asm/memory.h |  7 +++++++
 include/linux/const.h         | 27 +++++++++++++++++++++++++++
 2 files changed, 34 insertions(+)

diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h
index 28afaa3..52114d0 100644
--- a/arch/arm/include/asm/memory.h
+++ b/arch/arm/include/asm/memory.h
@@ -3,6 +3,13 @@
 
 #include <memory.h>
 
+#include <linux/const.h>
+/*
+ * Allow for constants defined here to be used from assembly code
+ * by prepending the UL suffix only with actual C code compilation.
+ */
+#define UL(x) _AC(x, UL)
+
 static inline void arm_add_mem_device(const char* name, resource_size_t start,
 				    resource_size_t size)
 {
diff --git a/include/linux/const.h b/include/linux/const.h
new file mode 100644
index 0000000..c872bfd
--- /dev/null
+++ b/include/linux/const.h
@@ -0,0 +1,27 @@
+/* const.h: Macros for dealing with constants.  */
+
+#ifndef _LINUX_CONST_H
+#define _LINUX_CONST_H
+
+/* 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 _BITUL(x)	(_AC(1,UL) << (x))
+#define _BITULL(x)	(_AC(1,ULL) << (x))
+
+#endif /* !(_LINUX_CONST_H) */
-- 
1.9.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2014-03-16 13:49 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-16 13:48 [PATCH v2 00/10] ARM: initial support for TI DaVinci SoCs and virt2real board Antony Pavlov
2014-03-16 13:48 ` Antony Pavlov [this message]
2014-03-16 13:48 ` [PATCH v2 02/10] ARM: initial support for TI DaVinci SoCs Antony Pavlov
2014-03-16 13:48 ` [PATCH v2 03/10] ARM: davinci: add DEBUG_LL support Antony Pavlov
2014-03-16 13:48 ` [PATCH v2 04/10] ARM: davinci: add clocksource Antony Pavlov
2014-03-16 13:48 ` [PATCH v2 05/10] gpio: add driver for TI DaVinci SoCs Antony Pavlov
2014-03-16 13:48 ` [PATCH v2 06/10] ARM: dts: Add TI TMS320DM365 devicetree file Antony Pavlov
2014-03-18 16:54   ` Sascha Hauer
2014-03-16 13:48 ` [PATCH v2 07/10] ARM: davinci: add documentation Antony Pavlov
2014-03-16 13:48 ` [PATCH v2 08/10] ARM: davinci: add virt2real board support Antony Pavlov
2014-03-18 16:56   ` Sascha Hauer
2014-03-16 13:48 ` [PATCH v2 09/10] ARM: virt2real: add documentation Antony Pavlov
2014-03-16 13:48 ` [PATCH v2 10/10] ARM: davinci: add virt2real_defconfig Antony Pavlov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1394977701-5889-2-git-send-email-antonynpavlov@gmail.com \
    --to=antonynpavlov@gmail.com \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox