cache.S 1.9 KB

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