asm-compat.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #ifndef _ASM_POWERPC_ASM_COMPAT_H
  2. #define _ASM_POWERPC_ASM_COMPAT_H
  3. #include <asm/types.h>
  4. #include <asm/ppc-opcode.h>
  5. #ifdef __ASSEMBLY__
  6. # define stringify_in_c(...) __VA_ARGS__
  7. # define ASM_CONST(x) x
  8. #else
  9. /* This version of stringify will deal with commas... */
  10. # define __stringify_in_c(...) #__VA_ARGS__
  11. # define stringify_in_c(...) __stringify_in_c(__VA_ARGS__) " "
  12. # define __ASM_CONST(x) x##UL
  13. # define ASM_CONST(x) __ASM_CONST(x)
  14. #endif
  15. #ifdef __powerpc64__
  16. /* operations for longs and pointers */
  17. #define PPC_LL stringify_in_c(ld)
  18. #define PPC_STL stringify_in_c(std)
  19. #define PPC_LCMPI stringify_in_c(cmpdi)
  20. #define PPC_LONG stringify_in_c(.llong)
  21. #define PPC_LONG_ALIGN stringify_in_c(.balign 8)
  22. #define PPC_TLNEI stringify_in_c(tdnei)
  23. #define PPC_LLARX(t, a, b, eh) PPC_LDARX(t, a, b, eh)
  24. #define PPC_STLCX stringify_in_c(stdcx.)
  25. #define PPC_CNTLZL stringify_in_c(cntlzd)
  26. #define PPC_LR_STKOFF 16
  27. /* Move to CR, single-entry optimized version. Only available
  28. * on POWER4 and later.
  29. */
  30. #ifdef CONFIG_POWER4_ONLY
  31. #define PPC_MTOCRF stringify_in_c(mtocrf)
  32. #else
  33. #define PPC_MTOCRF stringify_in_c(mtcrf)
  34. #endif
  35. #else /* 32-bit */
  36. /* operations for longs and pointers */
  37. #define PPC_LL stringify_in_c(lwz)
  38. #define PPC_STL stringify_in_c(stw)
  39. #define PPC_LCMPI stringify_in_c(cmpwi)
  40. #define PPC_LONG stringify_in_c(.long)
  41. #define PPC_LONG_ALIGN stringify_in_c(.balign 4)
  42. #define PPC_TLNEI stringify_in_c(twnei)
  43. #define PPC_LLARX(t, a, b, eh) PPC_LWARX(t, a, b, eh)
  44. #define PPC_STLCX stringify_in_c(stwcx.)
  45. #define PPC_CNTLZL stringify_in_c(cntlzw)
  46. #define PPC_MTOCRF stringify_in_c(mtcrf)
  47. #define PPC_LR_STKOFF 4
  48. #endif
  49. #ifdef __KERNEL__
  50. #ifdef CONFIG_IBM405_ERR77
  51. /* Erratum #77 on the 405 means we need a sync or dcbt before every
  52. * stwcx. The old ATOMIC_SYNC_FIX covered some but not all of this.
  53. */
  54. #define PPC405_ERR77(ra,rb) stringify_in_c(dcbt ra, rb;)
  55. #define PPC405_ERR77_SYNC stringify_in_c(sync;)
  56. #else
  57. #define PPC405_ERR77(ra,rb)
  58. #define PPC405_ERR77_SYNC
  59. #endif
  60. #endif
  61. #endif /* _ASM_POWERPC_ASM_COMPAT_H */