blob: 8e64be0cc47d3d0f7579445af6726a661f50a17b [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
17#ifdef __powerpc64__
18
19/* operations for longs and pointers */
20#define PPC_LL stringify_in_c(ld)
21#define PPC_STL stringify_in_c(std)
22#define PPC_LCMPI stringify_in_c(cmpdi)
23#define PPC_LONG stringify_in_c(.llong)
24#define PPC_TLNEI stringify_in_c(tdnei)
25#define PPC_LLARX stringify_in_c(ldarx)
26#define PPC_STLCX stringify_in_c(stdcx.)
27#define PPC_CNTLZL stringify_in_c(cntlzd)
28
29#else /* 32-bit */
30
31/* operations for longs and pointers */
32#define PPC_LL stringify_in_c(lwz)
33#define PPC_STL stringify_in_c(stw)
34#define PPC_LCMPI stringify_in_c(cmpwi)
35#define PPC_LONG stringify_in_c(.long)
36#define PPC_TLNEI stringify_in_c(twnei)
37#define PPC_LLARX stringify_in_c(lwarx)
38#define PPC_STLCX stringify_in_c(stwcx.)
39#define PPC_CNTLZL stringify_in_c(cntlzw)
40
41#endif
42
Arnd Bergmann88ced032005-12-16 22:43:46 +010043#ifdef __KERNEL__
David Gibson3ddfbcf2005-11-10 12:56:55 +110044#ifdef CONFIG_IBM405_ERR77
45/* Erratum #77 on the 405 means we need a sync or dcbt before every
46 * stwcx. The old ATOMIC_SYNC_FIX covered some but not all of this.
47 */
48#define PPC405_ERR77(ra,rb) stringify_in_c(dcbt ra, rb;)
49#define PPC405_ERR77_SYNC stringify_in_c(sync;)
50#else
51#define PPC405_ERR77(ra,rb)
52#define PPC405_ERR77_SYNC
53#endif
Arnd Bergmann88ced032005-12-16 22:43:46 +010054#endif
David Gibson3ddfbcf2005-11-10 12:56:55 +110055
56#endif /* _ASM_POWERPC_ASM_COMPAT_H */