blob: 8f0fe797194992829dd5926ef2d80605415e5059 [file] [log] [blame]
David Gibson3ddfbcf2005-11-10 12:56:55 +11001#ifndef _ASM_POWERPC_ASM_COMPAT_H
2#define _ASM_POWERPC_ASM_COMPAT_H
3
David Gibson3ddfbcf2005-11-10 12:56:55 +11004#include <asm/types.h>
5
6#ifdef __ASSEMBLY__
7# define stringify_in_c(...) __VA_ARGS__
8# define ASM_CONST(x) x
9#else
10/* This version of stringify will deal with commas... */
11# define __stringify_in_c(...) #__VA_ARGS__
12# define stringify_in_c(...) __stringify_in_c(__VA_ARGS__) " "
13# define __ASM_CONST(x) x##UL
14# define ASM_CONST(x) __ASM_CONST(x)
15#endif
16
Benjamin Herrenschmidt0909c8c2006-10-20 11:47:18 +100017
David Gibson3ddfbcf2005-11-10 12:56:55 +110018#ifdef __powerpc64__
19
20/* operations for longs and pointers */
21#define PPC_LL stringify_in_c(ld)
22#define PPC_STL stringify_in_c(std)
23#define PPC_LCMPI stringify_in_c(cmpdi)
24#define PPC_LONG stringify_in_c(.llong)
Michael Ellerman6a2a24b2008-07-17 17:17:51 +100025#define PPC_LONG_ALIGN stringify_in_c(.balign 8)
David Gibson3ddfbcf2005-11-10 12:56:55 +110026#define PPC_TLNEI stringify_in_c(tdnei)
27#define PPC_LLARX stringify_in_c(ldarx)
28#define PPC_STLCX stringify_in_c(stdcx.)
29#define PPC_CNTLZL stringify_in_c(cntlzd)
30
Olof Johansson3467bfd2007-03-22 09:34:13 -050031/* Move to CR, single-entry optimized version. Only available
32 * on POWER4 and later.
33 */
34#ifdef CONFIG_POWER4_ONLY
35#define PPC_MTOCRF stringify_in_c(mtocrf)
36#else
37#define PPC_MTOCRF stringify_in_c(mtcrf)
38#endif
39
David Gibson3ddfbcf2005-11-10 12:56:55 +110040#else /* 32-bit */
41
42/* operations for longs and pointers */
43#define PPC_LL stringify_in_c(lwz)
44#define PPC_STL stringify_in_c(stw)
45#define PPC_LCMPI stringify_in_c(cmpwi)
46#define PPC_LONG stringify_in_c(.long)
Michael Ellerman6a2a24b2008-07-17 17:17:51 +100047#define PPC_LONG_ALIGN stringify_in_c(.balign 4)
David Gibson3ddfbcf2005-11-10 12:56:55 +110048#define PPC_TLNEI stringify_in_c(twnei)
49#define PPC_LLARX stringify_in_c(lwarx)
50#define PPC_STLCX stringify_in_c(stwcx.)
51#define PPC_CNTLZL stringify_in_c(cntlzw)
Olof Johansson3467bfd2007-03-22 09:34:13 -050052#define PPC_MTOCRF stringify_in_c(mtcrf)
David Gibson3ddfbcf2005-11-10 12:56:55 +110053
54#endif
55
Arnd Bergmann88ced032005-12-16 22:43:46 +010056#ifdef __KERNEL__
David Gibson3ddfbcf2005-11-10 12:56:55 +110057#ifdef CONFIG_IBM405_ERR77
58/* Erratum #77 on the 405 means we need a sync or dcbt before every
59 * stwcx. The old ATOMIC_SYNC_FIX covered some but not all of this.
60 */
61#define PPC405_ERR77(ra,rb) stringify_in_c(dcbt ra, rb;)
62#define PPC405_ERR77_SYNC stringify_in_c(sync;)
63#else
64#define PPC405_ERR77(ra,rb)
65#define PPC405_ERR77_SYNC
66#endif
Arnd Bergmann88ced032005-12-16 22:43:46 +010067#endif
David Gibson3ddfbcf2005-11-10 12:56:55 +110068
69#endif /* _ASM_POWERPC_ASM_COMPAT_H */