blob: 8ec2e1da68bf7573f99cf68697b3bf0d54cf2b73 [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)
25#define PPC_TLNEI stringify_in_c(tdnei)
26#define PPC_LLARX stringify_in_c(ldarx)
27#define PPC_STLCX stringify_in_c(stdcx.)
28#define PPC_CNTLZL stringify_in_c(cntlzd)
29
Olof Johansson3467bfd2007-03-22 09:34:13 -050030/* Move to CR, single-entry optimized version. Only available
31 * on POWER4 and later.
32 */
33#ifdef CONFIG_POWER4_ONLY
34#define PPC_MTOCRF stringify_in_c(mtocrf)
35#else
36#define PPC_MTOCRF stringify_in_c(mtcrf)
37#endif
38
David Gibson3ddfbcf2005-11-10 12:56:55 +110039#else /* 32-bit */
40
41/* operations for longs and pointers */
42#define PPC_LL stringify_in_c(lwz)
43#define PPC_STL stringify_in_c(stw)
44#define PPC_LCMPI stringify_in_c(cmpwi)
45#define PPC_LONG stringify_in_c(.long)
46#define PPC_TLNEI stringify_in_c(twnei)
47#define PPC_LLARX stringify_in_c(lwarx)
48#define PPC_STLCX stringify_in_c(stwcx.)
49#define PPC_CNTLZL stringify_in_c(cntlzw)
Olof Johansson3467bfd2007-03-22 09:34:13 -050050#define PPC_MTOCRF stringify_in_c(mtcrf)
David Gibson3ddfbcf2005-11-10 12:56:55 +110051
52#endif
53
Arnd Bergmann88ced032005-12-16 22:43:46 +010054#ifdef __KERNEL__
David Gibson3ddfbcf2005-11-10 12:56:55 +110055#ifdef CONFIG_IBM405_ERR77
56/* Erratum #77 on the 405 means we need a sync or dcbt before every
57 * stwcx. The old ATOMIC_SYNC_FIX covered some but not all of this.
58 */
59#define PPC405_ERR77(ra,rb) stringify_in_c(dcbt ra, rb;)
60#define PPC405_ERR77_SYNC stringify_in_c(sync;)
61#else
62#define PPC405_ERR77(ra,rb)
63#define PPC405_ERR77_SYNC
64#endif
Arnd Bergmann88ced032005-12-16 22:43:46 +010065#endif
David Gibson3ddfbcf2005-11-10 12:56:55 +110066
67#endif /* _ASM_POWERPC_ASM_COMPAT_H */