From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mail-lb0-x22a.google.com ([2a00:1450:4010:c04::22a]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WN7qw-00068H-LW for barebox@lists.infradead.org; Mon, 10 Mar 2014 21:35:19 +0000 Received: by mail-lb0-f170.google.com with SMTP id s7so5148565lbd.29 for ; Mon, 10 Mar 2014 14:34:58 -0700 (PDT) From: Antony Pavlov Date: Tue, 11 Mar 2014 01:34:35 +0400 Message-Id: <1394487281-10462-3-git-send-email-antonynpavlov@gmail.com> In-Reply-To: <1394487281-10462-1-git-send-email-antonynpavlov@gmail.com> References: <1394487281-10462-1-git-send-email-antonynpavlov@gmail.com> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "barebox" Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: [PATCH 2/8] import _AC and UL macros from linux kernel To: barebox@lists.infradead.org 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 --- 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 +#include +/* + * 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