asm-compat.h 1.9 KB

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