cache.c 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /*
  2. * (C) Copyright 2011
  3. * Ilya Yanok, EmCraft Systems
  4. *
  5. * See file CREDITS for list of people who contributed to this
  6. * project.
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License as
  10. * published by the Free Software Foundation; either version 2 of
  11. * the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc.
  21. */
  22. #include <linux/types.h>
  23. #include <common.h>
  24. #ifndef CONFIG_SYS_DCACHE_OFF
  25. static inline void dcache_noop(void)
  26. {
  27. if (dcache_status()) {
  28. puts("WARNING: cache operations are not implemented!\n"
  29. "WARNING: disabling D-Cache now, you can re-enable it"
  30. "later with 'dcache on' command\n");
  31. dcache_disable();
  32. }
  33. }
  34. void invalidate_dcache_all(void)
  35. {
  36. dcache_noop();
  37. }
  38. void invalidate_dcache_range(unsigned long start, unsigned long stop)
  39. {
  40. dcache_noop();
  41. }
  42. void flush_dcache_range(unsigned long start, unsigned long stop)
  43. {
  44. dcache_noop();
  45. }
  46. #else /* #ifndef CONFIG_SYS_DCACHE_OFF */
  47. void invalidate_dcache_all(void)
  48. {
  49. }
  50. void flush_dcache_all(void)
  51. {
  52. }
  53. void invalidate_dcache_range(unsigned long start, unsigned long stop)
  54. {
  55. }
  56. void flush_dcache_range(unsigned long start, unsigned long stop)
  57. {
  58. }
  59. void flush_cache(unsigned long start, unsigned long size)
  60. {
  61. }
  62. #endif /* #ifndef CONFIG_SYS_DCACHE_OFF */
  63. /*
  64. * Stub implementations for l2 cache operations
  65. */
  66. void __l2_cache_disable(void)
  67. {
  68. }
  69. void l2_cache_disable(void)
  70. __attribute__((weak, alias("__l2_cache_disable")));