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 2/8] import _AC and UL macros from linux kernel
Date: Tue, 11 Mar 2014 01:34:35 +0400	[thread overview]
Message-ID: <1394487281-10462-3-git-send-email-antonynpavlov@gmail.com> (raw)
In-Reply-To: <1394487281-10462-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

  parent reply	other threads:[~2014-03-10 21:35 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-10 21:34 [PATCH 0/8] ARM: initial support for TI DaVinci SoCs and virt2real board Antony Pavlov
2014-03-10 21:34 ` [PATCH 1/8] clocksource: add dummy software-only clocksource Antony Pavlov
2014-03-12 20:50   ` Sascha Hauer
2014-03-13  5:09     ` Antony Pavlov
2014-03-13  6:35       ` Sascha Hauer
2014-03-10 21:34 ` Antony Pavlov [this message]
2014-03-10 21:34 ` [PATCH 3/8] ARM: initial support for TI DaVinci SoCs Antony Pavlov
2014-03-10 21:34 ` [PATCH 4/8] ARM: davinci: add DEBUG_LL support Antony Pavlov
2014-03-10 21:34 ` [PATCH 5/8] ARM: davinci: add documentation Antony Pavlov
2014-03-10 21:34 ` [PATCH 6/8] ARM: davinci: add virt2real board support Antony Pavlov
2014-03-10 21:34 ` [PATCH 7/8] ARM: virt2real: add documentation Antony Pavlov
2014-03-10 21:34 ` [PATCH 8/8] 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=1394487281-10462-3-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