cache.S 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. #define ASSEMBLY
  2. #include <asm/linkage.h>
  3. #include <asm/cpu/def_LPBlackfin.h>
  4. .text
  5. .align 2
  6. ENTRY(blackfin_icache_flush_range)
  7. R2 = -32;
  8. R2 = R0 & R2;
  9. P0 = R2;
  10. P1 = R1;
  11. CSYNC;
  12. 1:
  13. IFLUSH[P0++];
  14. CC = P0 < P1(iu);
  15. IF CC JUMP 1b(bp);
  16. IFLUSH[P0];
  17. SSYNC;
  18. RTS;
  19. ENTRY(blackfin_dcache_flush_range)
  20. R2 = -32;
  21. R2 = R0 & R2;
  22. P0 = R2;
  23. P1 = R1;
  24. CSYNC;
  25. 1:
  26. FLUSH[P0++];
  27. CC = P0 < P1(iu);
  28. IF CC JUMP 1b(bp);
  29. FLUSH[P0];
  30. SSYNC;
  31. RTS;
  32. ENTRY(_icache_invalidate)
  33. ENTRY(invalidate_entire_icache)
  34. [--SP] = ( R7:5);
  35. P0.L = (IMEM_CONTROL & 0xFFFF);
  36. P0.H = (IMEM_CONTROL >> 16);
  37. R7 = [P0];
  38. /* Clear the IMC bit , All valid bits in the instruction
  39. * cache are set to the invalid state
  40. */
  41. BITCLR(R7,IMC_P);
  42. CLI R6;
  43. SSYNC; /* SSYNC required before invalidating cache. */
  44. .align 8;
  45. [P0] = R7;
  46. SSYNC;
  47. STI R6;
  48. /* Configures the instruction cache agian */
  49. R6 = (IMC | ENICPLB);
  50. R7 = R7 | R6;
  51. CLI R6;
  52. SSYNC; /* SSYNC required before writing to IMEM_CONTROL. */
  53. .align 8;
  54. [P0] = R7;
  55. SSYNC;
  56. STI R6;
  57. ( R7:5) = [SP++];
  58. RTS;
  59. /* Invalidate the Entire Data cache by
  60. * clearing DMC[1:0] bits
  61. */
  62. ENTRY(invalidate_entire_dcache)
  63. ENTRY(_dcache_invalidate)
  64. [--SP] = ( R7:6);
  65. P0.L = (DMEM_CONTROL & 0xFFFF);
  66. P0.H = (DMEM_CONTROL >> 16);
  67. R7 = [P0];
  68. /* Clear the DMC[1:0] bits, All valid bits in the data
  69. * cache are set to the invalid state
  70. */
  71. BITCLR(R7,DMC0_P);
  72. BITCLR(R7,DMC1_P);
  73. CLI R6;
  74. SSYNC; /* SSYNC required before writing to DMEM_CONTROL. */
  75. .align 8;
  76. [P0] = R7;
  77. SSYNC;
  78. STI R6;
  79. /* Configures the data cache again */
  80. R6 = (ACACHE_BCACHE | ENDCPLB | PORT_PREF0);
  81. R7 = R7 | R6;
  82. CLI R6;
  83. SSYNC; /* SSYNC required before writing to DMEM_CONTROL. */
  84. .align 8;
  85. [P0] = R7;
  86. SSYNC;
  87. STI R6;
  88. ( R7:6) = [SP++];
  89. RTS;
  90. ENTRY(blackfin_dcache_invalidate_range)
  91. R2 = -32;
  92. R2 = R0 & R2;
  93. P0 = R2;
  94. P1 = R1;
  95. CSYNC;
  96. 1:
  97. FLUSHINV[P0++];
  98. CC = P0 < P1 (iu);
  99. IF CC JUMP 1b (bp);
  100. /* If the data crosses a cache line, then we'll be pointing to
  101. ** the last cache line, but won't have flushed/invalidated it yet, so do
  102. ** one more.
  103. */
  104. FLUSHINV[P0];
  105. SSYNC;
  106. RTS;