David Gibson | 3ddfbcf | 2005-11-10 12:56:55 +1100 | [diff] [blame] | 1 | #ifndef _ASM_POWERPC_ASM_COMPAT_H |
| 2 | #define _ASM_POWERPC_ASM_COMPAT_H |
| 3 | |
David Gibson | 3ddfbcf | 2005-11-10 12:56:55 +1100 | [diff] [blame] | 4 | #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 Herrenschmidt | 0909c8c | 2006-10-20 11:47:18 +1000 | [diff] [blame] | 17 | |
David Gibson | 3ddfbcf | 2005-11-10 12:56:55 +1100 | [diff] [blame] | 18 | #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 Ellerman | 6a2a24b | 2008-07-17 17:17:51 +1000 | [diff] [blame] | 25 | #define PPC_LONG_ALIGN stringify_in_c(.balign 8) |
David Gibson | 3ddfbcf | 2005-11-10 12:56:55 +1100 | [diff] [blame] | 26 | #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 Johansson | 3467bfd | 2007-03-22 09:34:13 -0500 | [diff] [blame] | 31 | /* 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 Gibson | 3ddfbcf | 2005-11-10 12:56:55 +1100 | [diff] [blame] | 40 | #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 Ellerman | 6a2a24b | 2008-07-17 17:17:51 +1000 | [diff] [blame] | 47 | #define PPC_LONG_ALIGN stringify_in_c(.balign 4) |
David Gibson | 3ddfbcf | 2005-11-10 12:56:55 +1100 | [diff] [blame] | 48 | #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 Johansson | 3467bfd | 2007-03-22 09:34:13 -0500 | [diff] [blame] | 52 | #define PPC_MTOCRF stringify_in_c(mtcrf) |
David Gibson | 3ddfbcf | 2005-11-10 12:56:55 +1100 | [diff] [blame] | 53 | |
| 54 | #endif |
| 55 | |
Arnd Bergmann | 88ced03 | 2005-12-16 22:43:46 +0100 | [diff] [blame] | 56 | #ifdef __KERNEL__ |
David Gibson | 3ddfbcf | 2005-11-10 12:56:55 +1100 | [diff] [blame] | 57 | #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 Bergmann | 88ced03 | 2005-12-16 22:43:46 +0100 | [diff] [blame] | 67 | #endif |
David Gibson | 3ddfbcf | 2005-11-10 12:56:55 +1100 | [diff] [blame] | 68 | |
| 69 | #endif /* _ASM_POWERPC_ASM_COMPAT_H */ |