cache.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658
  1. /*
  2. * Cache control for MicroBlaze cache memories
  3. *
  4. * Copyright (C) 2007-2009 Michal Simek <monstr@monstr.eu>
  5. * Copyright (C) 2007-2009 PetaLogix
  6. * Copyright (C) 2007-2009 John Williams <john.williams@petalogix.com>
  7. *
  8. * This file is subject to the terms and conditions of the GNU General
  9. * Public License. See the file COPYING in the main directory of this
  10. * archive for more details.
  11. */
  12. #include <asm/cacheflush.h>
  13. #include <linux/cache.h>
  14. #include <asm/cpuinfo.h>
  15. #include <asm/pvr.h>
  16. static inline void __enable_icache_msr(void)
  17. {
  18. __asm__ __volatile__ (" msrset r0, %0; \
  19. nop; " \
  20. : : "i" (MSR_ICE) : "memory");
  21. }
  22. static inline void __disable_icache_msr(void)
  23. {
  24. __asm__ __volatile__ (" msrclr r0, %0; \
  25. nop; " \
  26. : : "i" (MSR_ICE) : "memory");
  27. }
  28. static inline void __enable_dcache_msr(void)
  29. {
  30. __asm__ __volatile__ (" msrset r0, %0; \
  31. nop; " \
  32. : \
  33. : "i" (MSR_DCE) \
  34. : "memory");
  35. }
  36. static inline void __disable_dcache_msr(void)
  37. {
  38. __asm__ __volatile__ (" msrclr r0, %0; \
  39. nop; " \
  40. : \
  41. : "i" (MSR_DCE) \
  42. : "memory");
  43. }
  44. static inline void __enable_icache_nomsr(void)
  45. {
  46. __asm__ __volatile__ (" mfs r12, rmsr; \
  47. nop; \
  48. ori r12, r12, %0; \
  49. mts rmsr, r12; \
  50. nop; " \
  51. : \
  52. : "i" (MSR_ICE) \
  53. : "memory", "r12");
  54. }
  55. static inline void __disable_icache_nomsr(void)
  56. {
  57. __asm__ __volatile__ (" mfs r12, rmsr; \
  58. nop; \
  59. andi r12, r12, ~%0; \
  60. mts rmsr, r12; \
  61. nop; " \
  62. : \
  63. : "i" (MSR_ICE) \
  64. : "memory", "r12");
  65. }
  66. static inline void __enable_dcache_nomsr(void)
  67. {
  68. __asm__ __volatile__ (" mfs r12, rmsr; \
  69. nop; \
  70. ori r12, r12, %0; \
  71. mts rmsr, r12; \
  72. nop; " \
  73. : \
  74. : "i" (MSR_DCE) \
  75. : "memory", "r12");
  76. }
  77. static inline void __disable_dcache_nomsr(void)
  78. {
  79. __asm__ __volatile__ (" mfs r12, rmsr; \
  80. nop; \
  81. andi r12, r12, ~%0; \
  82. mts rmsr, r12; \
  83. nop; " \
  84. : \
  85. : "i" (MSR_DCE) \
  86. : "memory", "r12");
  87. }
  88. /* Helper macro for computing the limits of cache range loops */
  89. #define CACHE_LOOP_LIMITS(start, end, cache_line_length, cache_size) \
  90. do { \
  91. int align = ~(cache_line_length - 1); \
  92. end = min(start + cache_size, end); \
  93. start &= align; \
  94. end = ((end & align) + cache_line_length); \
  95. } while (0);
  96. /*
  97. * Helper macro to loop over the specified cache_size/line_length and
  98. * execute 'op' on that cacheline
  99. */
  100. #define CACHE_ALL_LOOP(cache_size, line_length, op) \
  101. do { \
  102. unsigned int len = cache_size; \
  103. int step = -line_length; \
  104. BUG_ON(step >= 0); \
  105. \
  106. __asm__ __volatile__ (" 1: " #op " %0, r0; \
  107. bgtid %0, 1b; \
  108. addk %0, %0, %1; \
  109. " : : "r" (len), "r" (step) \
  110. : "memory"); \
  111. } while (0);
  112. #define CACHE_ALL_LOOP2(cache_size, line_length, op) \
  113. do { \
  114. unsigned int len = cache_size; \
  115. int step = -line_length; \
  116. BUG_ON(step >= 0); \
  117. \
  118. __asm__ __volatile__ (" 1: " #op " r0, %0; \
  119. bgtid %0, 1b; \
  120. addk %0, %0, %1; \
  121. " : : "r" (len), "r" (step) \
  122. : "memory"); \
  123. } while (0);
  124. /* for wdc.flush/clear */
  125. #define CACHE_RANGE_LOOP_2(start, end, line_length, op) \
  126. do { \
  127. int step = -line_length; \
  128. int count = end - start; \
  129. BUG_ON(count <= 0); \
  130. \
  131. __asm__ __volatile__ (" 1: " #op " %0, %1; \
  132. bgtid %1, 1b; \
  133. addk %1, %1, %2; \
  134. " : : "r" (start), "r" (count), \
  135. "r" (step) : "memory"); \
  136. } while (0);
  137. /* It is used only first parameter for OP - for wic, wdc */
  138. #define CACHE_RANGE_LOOP_1(start, end, line_length, op) \
  139. do { \
  140. int volatile temp; \
  141. BUG_ON(end - start <= 0); \
  142. \
  143. __asm__ __volatile__ (" 1: " #op " %1, r0; \
  144. cmpu %0, %1, %2; \
  145. bgtid %0, 1b; \
  146. addk %1, %1, %3; \
  147. " : : "r" (temp), "r" (start), "r" (end),\
  148. "r" (line_length) : "memory"); \
  149. } while (0);
  150. #define ASM_LOOP
  151. static void __flush_icache_range_msr_irq(unsigned long start, unsigned long end)
  152. {
  153. unsigned long flags;
  154. #ifndef ASM_LOOP
  155. int i;
  156. #endif
  157. pr_debug("%s: start 0x%x, end 0x%x\n", __func__,
  158. (unsigned int)start, (unsigned int) end);
  159. CACHE_LOOP_LIMITS(start, end,
  160. cpuinfo.icache_line_length, cpuinfo.icache_size);
  161. local_irq_save(flags);
  162. __disable_icache_msr();
  163. #ifdef ASM_LOOP
  164. CACHE_RANGE_LOOP_1(start, end, cpuinfo.icache_line_length, wic);
  165. #else
  166. for (i = start; i < end; i += cpuinfo.icache_line_length)
  167. __asm__ __volatile__ ("wic %0, r0;" \
  168. : : "r" (i));
  169. #endif
  170. __enable_icache_msr();
  171. local_irq_restore(flags);
  172. }
  173. static void __flush_icache_range_nomsr_irq(unsigned long start,
  174. unsigned long end)
  175. {
  176. unsigned long flags;
  177. #ifndef ASM_LOOP
  178. int i;
  179. #endif
  180. pr_debug("%s: start 0x%x, end 0x%x\n", __func__,
  181. (unsigned int)start, (unsigned int) end);
  182. CACHE_LOOP_LIMITS(start, end,
  183. cpuinfo.icache_line_length, cpuinfo.icache_size);
  184. local_irq_save(flags);
  185. __disable_icache_nomsr();
  186. #ifdef ASM_LOOP
  187. CACHE_RANGE_LOOP_1(start, end, cpuinfo.icache_line_length, wic);
  188. #else
  189. for (i = start; i < end; i += cpuinfo.icache_line_length)
  190. __asm__ __volatile__ ("wic %0, r0;" \
  191. : : "r" (i));
  192. #endif
  193. __enable_icache_nomsr();
  194. local_irq_restore(flags);
  195. }
  196. static void __flush_icache_range_noirq(unsigned long start,
  197. unsigned long end)
  198. {
  199. #ifndef ASM_LOOP
  200. int i;
  201. #endif
  202. pr_debug("%s: start 0x%x, end 0x%x\n", __func__,
  203. (unsigned int)start, (unsigned int) end);
  204. CACHE_LOOP_LIMITS(start, end,
  205. cpuinfo.icache_line_length, cpuinfo.icache_size);
  206. #ifdef ASM_LOOP
  207. CACHE_RANGE_LOOP_1(start, end, cpuinfo.icache_line_length, wic);
  208. #else
  209. for (i = start; i < end; i += cpuinfo.icache_line_length)
  210. __asm__ __volatile__ ("wic %0, r0;" \
  211. : : "r" (i));
  212. #endif
  213. }
  214. static void __flush_icache_all_msr_irq(void)
  215. {
  216. unsigned long flags;
  217. #ifndef ASM_LOOP
  218. int i;
  219. #endif
  220. pr_debug("%s\n", __func__);
  221. local_irq_save(flags);
  222. __disable_icache_msr();
  223. #ifdef ASM_LOOP
  224. CACHE_ALL_LOOP(cpuinfo.icache_size, cpuinfo.icache_line_length, wic);
  225. #else
  226. for (i = 0; i < cpuinfo.icache_size;
  227. i += cpuinfo.icache_line_length)
  228. __asm__ __volatile__ ("wic %0, r0;" \
  229. : : "r" (i));
  230. #endif
  231. __enable_icache_msr();
  232. local_irq_restore(flags);
  233. }
  234. static void __flush_icache_all_nomsr_irq(void)
  235. {
  236. unsigned long flags;
  237. #ifndef ASM_LOOP
  238. int i;
  239. #endif
  240. pr_debug("%s\n", __func__);
  241. local_irq_save(flags);
  242. __disable_icache_nomsr();
  243. #ifdef ASM_LOOP
  244. CACHE_ALL_LOOP(cpuinfo.icache_size, cpuinfo.icache_line_length, wic);
  245. #else
  246. for (i = 0; i < cpuinfo.icache_size;
  247. i += cpuinfo.icache_line_length)
  248. __asm__ __volatile__ ("wic %0, r0;" \
  249. : : "r" (i));
  250. #endif
  251. __enable_icache_nomsr();
  252. local_irq_restore(flags);
  253. }
  254. static void __flush_icache_all_noirq(void)
  255. {
  256. #ifndef ASM_LOOP
  257. int i;
  258. #endif
  259. pr_debug("%s\n", __func__);
  260. #ifdef ASM_LOOP
  261. CACHE_ALL_LOOP(cpuinfo.icache_size, cpuinfo.icache_line_length, wic);
  262. #else
  263. for (i = 0; i < cpuinfo.icache_size;
  264. i += cpuinfo.icache_line_length)
  265. __asm__ __volatile__ ("wic %0, r0;" \
  266. : : "r" (i));
  267. #endif
  268. }
  269. static void __invalidate_dcache_all_msr_irq(void)
  270. {
  271. unsigned long flags;
  272. #ifndef ASM_LOOP
  273. int i;
  274. #endif
  275. pr_debug("%s\n", __func__);
  276. local_irq_save(flags);
  277. __disable_dcache_msr();
  278. #ifdef ASM_LOOP
  279. CACHE_ALL_LOOP(cpuinfo.dcache_size, cpuinfo.dcache_line_length, wdc);
  280. #else
  281. for (i = 0; i < cpuinfo.dcache_size;
  282. i += cpuinfo.dcache_line_length)
  283. __asm__ __volatile__ ("wdc %0, r0;" \
  284. : : "r" (i));
  285. #endif
  286. __enable_dcache_msr();
  287. local_irq_restore(flags);
  288. }
  289. static void __invalidate_dcache_all_nomsr_irq(void)
  290. {
  291. unsigned long flags;
  292. #ifndef ASM_LOOP
  293. int i;
  294. #endif
  295. pr_debug("%s\n", __func__);
  296. local_irq_save(flags);
  297. __disable_dcache_nomsr();
  298. #ifdef ASM_LOOP
  299. CACHE_ALL_LOOP(cpuinfo.dcache_size, cpuinfo.dcache_line_length, wdc);
  300. #else
  301. for (i = 0; i < cpuinfo.dcache_size;
  302. i += cpuinfo.dcache_line_length)
  303. __asm__ __volatile__ ("wdc %0, r0;" \
  304. : : "r" (i));
  305. #endif
  306. __enable_dcache_nomsr();
  307. local_irq_restore(flags);
  308. }
  309. static void __invalidate_dcache_all_noirq_wt(void)
  310. {
  311. #ifndef ASM_LOOP
  312. int i;
  313. #endif
  314. pr_debug("%s\n", __func__);
  315. #ifdef ASM_LOOP
  316. CACHE_ALL_LOOP(cpuinfo.dcache_size, cpuinfo.dcache_line_length, wdc)
  317. #else
  318. for (i = 0; i < cpuinfo.dcache_size;
  319. i += cpuinfo.dcache_line_length)
  320. __asm__ __volatile__ ("wdc %0, r0;" \
  321. : : "r" (i));
  322. #endif
  323. }
  324. /* FIXME this is weird - should be only wdc but not work
  325. * MS: I am getting bus errors and other weird things */
  326. static void __invalidate_dcache_all_wb(void)
  327. {
  328. #ifndef ASM_LOOP
  329. int i;
  330. #endif
  331. pr_debug("%s\n", __func__);
  332. #ifdef ASM_LOOP
  333. CACHE_ALL_LOOP2(cpuinfo.dcache_size, cpuinfo.dcache_line_length,
  334. wdc.clear)
  335. #else
  336. for (i = 0; i < cpuinfo.dcache_size;
  337. i += cpuinfo.dcache_line_length)
  338. __asm__ __volatile__ ("wdc.clear %0, r0;" \
  339. : : "r" (i));
  340. #endif
  341. }
  342. static void __invalidate_dcache_range_wb(unsigned long start,
  343. unsigned long end)
  344. {
  345. #ifndef ASM_LOOP
  346. int i;
  347. #endif
  348. pr_debug("%s: start 0x%x, end 0x%x\n", __func__,
  349. (unsigned int)start, (unsigned int) end);
  350. CACHE_LOOP_LIMITS(start, end,
  351. cpuinfo.dcache_line_length, cpuinfo.dcache_size);
  352. #ifdef ASM_LOOP
  353. CACHE_RANGE_LOOP_2(start, end, cpuinfo.dcache_line_length, wdc.clear);
  354. #else
  355. for (i = start; i < end; i += cpuinfo.icache_line_length)
  356. __asm__ __volatile__ ("wdc.clear %0, r0;" \
  357. : : "r" (i));
  358. #endif
  359. }
  360. static void __invalidate_dcache_range_nomsr_wt(unsigned long start,
  361. unsigned long end)
  362. {
  363. #ifndef ASM_LOOP
  364. int i;
  365. #endif
  366. pr_debug("%s: start 0x%x, end 0x%x\n", __func__,
  367. (unsigned int)start, (unsigned int) end);
  368. CACHE_LOOP_LIMITS(start, end,
  369. cpuinfo.dcache_line_length, cpuinfo.dcache_size);
  370. #ifdef ASM_LOOP
  371. CACHE_RANGE_LOOP_1(start, end, cpuinfo.dcache_line_length, wdc);
  372. #else
  373. for (i = start; i < end; i += cpuinfo.icache_line_length)
  374. __asm__ __volatile__ ("wdc %0, r0;" \
  375. : : "r" (i));
  376. #endif
  377. }
  378. static void __invalidate_dcache_range_msr_irq_wt(unsigned long start,
  379. unsigned long end)
  380. {
  381. unsigned long flags;
  382. #ifndef ASM_LOOP
  383. int i;
  384. #endif
  385. pr_debug("%s: start 0x%x, end 0x%x\n", __func__,
  386. (unsigned int)start, (unsigned int) end);
  387. CACHE_LOOP_LIMITS(start, end,
  388. cpuinfo.dcache_line_length, cpuinfo.dcache_size);
  389. local_irq_save(flags);
  390. __disable_dcache_msr();
  391. #ifdef ASM_LOOP
  392. CACHE_RANGE_LOOP_1(start, end, cpuinfo.dcache_line_length, wdc);
  393. #else
  394. for (i = start; i < end; i += cpuinfo.icache_line_length)
  395. __asm__ __volatile__ ("wdc %0, r0;" \
  396. : : "r" (i));
  397. #endif
  398. __enable_dcache_msr();
  399. local_irq_restore(flags);
  400. }
  401. static void __invalidate_dcache_range_nomsr_irq(unsigned long start,
  402. unsigned long end)
  403. {
  404. unsigned long flags;
  405. #ifndef ASM_LOOP
  406. int i;
  407. #endif
  408. pr_debug("%s: start 0x%x, end 0x%x\n", __func__,
  409. (unsigned int)start, (unsigned int) end);
  410. CACHE_LOOP_LIMITS(start, end,
  411. cpuinfo.dcache_line_length, cpuinfo.dcache_size);
  412. local_irq_save(flags);
  413. __disable_dcache_nomsr();
  414. #ifdef ASM_LOOP
  415. CACHE_RANGE_LOOP_1(start, end, cpuinfo.dcache_line_length, wdc);
  416. #else
  417. for (i = start; i < end; i += cpuinfo.icache_line_length)
  418. __asm__ __volatile__ ("wdc %0, r0;" \
  419. : : "r" (i));
  420. #endif
  421. __enable_dcache_nomsr();
  422. local_irq_restore(flags);
  423. }
  424. static void __flush_dcache_all_wb(void)
  425. {
  426. #ifndef ASM_LOOP
  427. int i;
  428. #endif
  429. pr_debug("%s\n", __func__);
  430. #ifdef ASM_LOOP
  431. CACHE_ALL_LOOP(cpuinfo.dcache_size, cpuinfo.dcache_line_length,
  432. wdc.flush);
  433. #else
  434. for (i = 0; i < cpuinfo.dcache_size;
  435. i += cpuinfo.dcache_line_length)
  436. __asm__ __volatile__ ("wdc.flush %0, r0;" \
  437. : : "r" (i));
  438. #endif
  439. }
  440. static void __flush_dcache_range_wb(unsigned long start, unsigned long end)
  441. {
  442. #ifndef ASM_LOOP
  443. int i;
  444. #endif
  445. pr_debug("%s: start 0x%x, end 0x%x\n", __func__,
  446. (unsigned int)start, (unsigned int) end);
  447. CACHE_LOOP_LIMITS(start, end,
  448. cpuinfo.dcache_line_length, cpuinfo.dcache_size);
  449. #ifdef ASM_LOOP
  450. CACHE_RANGE_LOOP_2(start, end, cpuinfo.dcache_line_length, wdc.flush);
  451. #else
  452. for (i = start; i < end; i += cpuinfo.icache_line_length)
  453. __asm__ __volatile__ ("wdc.flush %0, r0;" \
  454. : : "r" (i));
  455. #endif
  456. }
  457. /* struct for wb caches and for wt caches */
  458. struct scache *mbc;
  459. /* new wb cache model */
  460. const struct scache wb_msr = {
  461. .ie = __enable_icache_msr,
  462. .id = __disable_icache_msr,
  463. .ifl = __flush_icache_all_noirq,
  464. .iflr = __flush_icache_range_noirq,
  465. .iin = __flush_icache_all_noirq,
  466. .iinr = __flush_icache_range_noirq,
  467. .de = __enable_dcache_msr,
  468. .dd = __disable_dcache_msr,
  469. .dfl = __flush_dcache_all_wb,
  470. .dflr = __flush_dcache_range_wb,
  471. .din = __invalidate_dcache_all_wb,
  472. .dinr = __invalidate_dcache_range_wb,
  473. };
  474. /* There is only difference in ie, id, de, dd functions */
  475. const struct scache wb_nomsr = {
  476. .ie = __enable_icache_nomsr,
  477. .id = __disable_icache_nomsr,
  478. .ifl = __flush_icache_all_noirq,
  479. .iflr = __flush_icache_range_noirq,
  480. .iin = __flush_icache_all_noirq,
  481. .iinr = __flush_icache_range_noirq,
  482. .de = __enable_dcache_nomsr,
  483. .dd = __disable_dcache_nomsr,
  484. .dfl = __flush_dcache_all_wb,
  485. .dflr = __flush_dcache_range_wb,
  486. .din = __invalidate_dcache_all_wb,
  487. .dinr = __invalidate_dcache_range_wb,
  488. };
  489. /* Old wt cache model with disabling irq and turn off cache */
  490. const struct scache wt_msr = {
  491. .ie = __enable_icache_msr,
  492. .id = __disable_icache_msr,
  493. .ifl = __flush_icache_all_msr_irq,
  494. .iflr = __flush_icache_range_msr_irq,
  495. .iin = __flush_icache_all_msr_irq,
  496. .iinr = __flush_icache_range_msr_irq,
  497. .de = __enable_dcache_msr,
  498. .dd = __disable_dcache_msr,
  499. .dfl = __invalidate_dcache_all_msr_irq,
  500. .dflr = __invalidate_dcache_range_msr_irq_wt,
  501. .din = __invalidate_dcache_all_msr_irq,
  502. .dinr = __invalidate_dcache_range_msr_irq_wt,
  503. };
  504. const struct scache wt_nomsr = {
  505. .ie = __enable_icache_nomsr,
  506. .id = __disable_icache_nomsr,
  507. .ifl = __flush_icache_all_nomsr_irq,
  508. .iflr = __flush_icache_range_nomsr_irq,
  509. .iin = __flush_icache_all_nomsr_irq,
  510. .iinr = __flush_icache_range_nomsr_irq,
  511. .de = __enable_dcache_nomsr,
  512. .dd = __disable_dcache_nomsr,
  513. .dfl = __invalidate_dcache_all_nomsr_irq,
  514. .dflr = __invalidate_dcache_range_nomsr_irq,
  515. .din = __invalidate_dcache_all_nomsr_irq,
  516. .dinr = __invalidate_dcache_range_nomsr_irq,
  517. };
  518. /* New wt cache model for newer Microblaze versions */
  519. const struct scache wt_msr_noirq = {
  520. .ie = __enable_icache_msr,
  521. .id = __disable_icache_msr,
  522. .ifl = __flush_icache_all_noirq,
  523. .iflr = __flush_icache_range_noirq,
  524. .iin = __flush_icache_all_noirq,
  525. .iinr = __flush_icache_range_noirq,
  526. .de = __enable_dcache_msr,
  527. .dd = __disable_dcache_msr,
  528. .dfl = __invalidate_dcache_all_noirq_wt,
  529. .dflr = __invalidate_dcache_range_nomsr_wt,
  530. .din = __invalidate_dcache_all_noirq_wt,
  531. .dinr = __invalidate_dcache_range_nomsr_wt,
  532. };
  533. const struct scache wt_nomsr_noirq = {
  534. .ie = __enable_icache_nomsr,
  535. .id = __disable_icache_nomsr,
  536. .ifl = __flush_icache_all_noirq,
  537. .iflr = __flush_icache_range_noirq,
  538. .iin = __flush_icache_all_noirq,
  539. .iinr = __flush_icache_range_noirq,
  540. .de = __enable_dcache_nomsr,
  541. .dd = __disable_dcache_nomsr,
  542. .dfl = __invalidate_dcache_all_noirq_wt,
  543. .dflr = __invalidate_dcache_range_nomsr_wt,
  544. .din = __invalidate_dcache_all_noirq_wt,
  545. .dinr = __invalidate_dcache_range_nomsr_wt,
  546. };
  547. /* CPU version code for 7.20.c - see arch/microblaze/kernel/cpu/cpuinfo.c */
  548. #define CPUVER_7_20_A 0x0c
  549. #define CPUVER_7_20_D 0x0f
  550. #define INFO(s) printk(KERN_INFO "cache: " s "\n");
  551. void microblaze_cache_init(void)
  552. {
  553. if (cpuinfo.use_instr & PVR2_USE_MSR_INSTR) {
  554. if (cpuinfo.dcache_wb) {
  555. INFO("wb_msr");
  556. mbc = (struct scache *)&wb_msr;
  557. if (cpuinfo.ver_code < CPUVER_7_20_D) {
  558. /* MS: problem with signal handling - hw bug */
  559. INFO("WB won't work properly");
  560. }
  561. } else {
  562. if (cpuinfo.ver_code >= CPUVER_7_20_A) {
  563. INFO("wt_msr_noirq");
  564. mbc = (struct scache *)&wt_msr_noirq;
  565. } else {
  566. INFO("wt_msr");
  567. mbc = (struct scache *)&wt_msr;
  568. }
  569. }
  570. } else {
  571. if (cpuinfo.dcache_wb) {
  572. INFO("wb_nomsr");
  573. mbc = (struct scache *)&wb_nomsr;
  574. if (cpuinfo.ver_code < CPUVER_7_20_D) {
  575. /* MS: problem with signal handling - hw bug */
  576. INFO("WB won't work properly");
  577. }
  578. } else {
  579. if (cpuinfo.ver_code >= CPUVER_7_20_A) {
  580. INFO("wt_nomsr_noirq");
  581. mbc = (struct scache *)&wt_nomsr_noirq;
  582. } else {
  583. INFO("wt_nomsr");
  584. mbc = (struct scache *)&wt_nomsr;
  585. }
  586. }
  587. }
  588. invalidate_dcache();
  589. enable_dcache();
  590. invalidate_icache();
  591. enable_icache();
  592. }