blackfin.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. /*
  2. * Common header file for blackfin family of processors.
  3. *
  4. */
  5. #ifndef _BLACKFIN_H_
  6. #define _BLACKFIN_H_
  7. #define LO(con32) ((con32) & 0xFFFF)
  8. #define lo(con32) ((con32) & 0xFFFF)
  9. #define HI(con32) (((con32) >> 16) & 0xFFFF)
  10. #define hi(con32) (((con32) >> 16) & 0xFFFF)
  11. #include <asm/mach/anomaly.h>
  12. #ifndef __ASSEMBLY__
  13. /* SSYNC implementation for C file */
  14. static inline void SSYNC(void)
  15. {
  16. int _tmp;
  17. if (ANOMALY_05000312 && ANOMALY_05000244)
  18. __asm__ __volatile__(
  19. "cli %0;"
  20. "nop;"
  21. "nop;"
  22. "ssync;"
  23. "sti %0;"
  24. : "=d" (_tmp)
  25. );
  26. else if (ANOMALY_05000312 && !ANOMALY_05000244)
  27. __asm__ __volatile__(
  28. "cli %0;"
  29. "ssync;"
  30. "sti %0;"
  31. : "=d" (_tmp)
  32. );
  33. else if (!ANOMALY_05000312 && ANOMALY_05000244)
  34. __asm__ __volatile__(
  35. "nop;"
  36. "nop;"
  37. "nop;"
  38. "ssync;"
  39. );
  40. else
  41. __asm__ __volatile__("ssync;");
  42. }
  43. /* CSYNC implementation for C file */
  44. static inline void CSYNC(void)
  45. {
  46. int _tmp;
  47. if (ANOMALY_05000312 && ANOMALY_05000244)
  48. __asm__ __volatile__(
  49. "cli %0;"
  50. "nop;"
  51. "nop;"
  52. "csync;"
  53. "sti %0;"
  54. : "=d" (_tmp)
  55. );
  56. else if (ANOMALY_05000312 && !ANOMALY_05000244)
  57. __asm__ __volatile__(
  58. "cli %0;"
  59. "csync;"
  60. "sti %0;"
  61. : "=d" (_tmp)
  62. );
  63. else if (!ANOMALY_05000312 && ANOMALY_05000244)
  64. __asm__ __volatile__(
  65. "nop;"
  66. "nop;"
  67. "nop;"
  68. "csync;"
  69. );
  70. else
  71. __asm__ __volatile__("csync;");
  72. }
  73. #else /* __ASSEMBLY__ */
  74. /* SSYNC & CSYNC implementations for assembly files */
  75. #define ssync(x) SSYNC(x)
  76. #define csync(x) CSYNC(x)
  77. #if ANOMALY_05000312 && ANOMALY_05000244
  78. #define SSYNC(scratch) cli scratch; nop; nop; SSYNC; sti scratch;
  79. #define CSYNC(scratch) cli scratch; nop; nop; CSYNC; sti scratch;
  80. #elif ANOMALY_05000312 && !ANOMALY_05000244
  81. #define SSYNC(scratch) cli scratch; nop; nop; SSYNC; sti scratch;
  82. #define CSYNC(scratch) cli scratch; nop; nop; CSYNC; sti scratch;
  83. #elif !ANOMALY_05000312 && ANOMALY_05000244
  84. #define SSYNC(scratch) nop; nop; nop; SSYNC;
  85. #define CSYNC(scratch) nop; nop; nop; CSYNC;
  86. #elif !ANOMALY_05000312 && !ANOMALY_05000244
  87. #define SSYNC(scratch) SSYNC;
  88. #define CSYNC(scratch) CSYNC;
  89. #endif /* ANOMALY_05000312 & ANOMALY_05000244 handling */
  90. #endif /* __ASSEMBLY__ */
  91. #include <asm/mach/blackfin.h>
  92. #include <asm/bfin-global.h>
  93. #endif /* _BLACKFIN_H_ */