asm-compat.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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_TLNEI stringify_in_c(tdnei)
  21. #define PPC_LLARX stringify_in_c(ldarx)
  22. #define PPC_STLCX stringify_in_c(stdcx.)
  23. #define PPC_CNTLZL stringify_in_c(cntlzd)
  24. /* Move to CR, single-entry optimized version. Only available
  25. * on POWER4 and later.
  26. */
  27. #ifdef CONFIG_POWER4_ONLY
  28. #define PPC_MTOCRF stringify_in_c(mtocrf)
  29. #else
  30. #define PPC_MTOCRF stringify_in_c(mtcrf)
  31. #endif
  32. #else /* 32-bit */
  33. /* operations for longs and pointers */
  34. #define PPC_LL stringify_in_c(lwz)
  35. #define PPC_STL stringify_in_c(stw)
  36. #define PPC_LCMPI stringify_in_c(cmpwi)
  37. #define PPC_LONG stringify_in_c(.long)
  38. #define PPC_TLNEI stringify_in_c(twnei)
  39. #define PPC_LLARX stringify_in_c(lwarx)
  40. #define PPC_STLCX stringify_in_c(stwcx.)
  41. #define PPC_CNTLZL stringify_in_c(cntlzw)
  42. #define PPC_MTOCRF stringify_in_c(mtcrf)
  43. #endif
  44. #ifdef __KERNEL__
  45. #ifdef CONFIG_IBM405_ERR77
  46. /* Erratum #77 on the 405 means we need a sync or dcbt before every
  47. * stwcx. The old ATOMIC_SYNC_FIX covered some but not all of this.
  48. */
  49. #define PPC405_ERR77(ra,rb) stringify_in_c(dcbt ra, rb;)
  50. #define PPC405_ERR77_SYNC stringify_in_c(sync;)
  51. #else
  52. #define PPC405_ERR77(ra,rb)
  53. #define PPC405_ERR77_SYNC
  54. #endif
  55. #endif
  56. #endif /* _ASM_POWERPC_ASM_COMPAT_H */