cache.h 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /*
  2. * Port on Texas Instruments TMS320C6x architecture
  3. *
  4. * Copyright (C) 2005, 2006, 2009, 2010 Texas Instruments Incorporated
  5. * Author: Aurelien Jacquiot (aurelien.jacquiot@jaluna.com)
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License version 2 as
  9. * published by the Free Software Foundation.
  10. */
  11. #ifndef _ASM_C6X_CACHE_H
  12. #define _ASM_C6X_CACHE_H
  13. #include <linux/irqflags.h>
  14. /*
  15. * Cache line size
  16. */
  17. #define L1D_CACHE_BYTES 64
  18. #define L1P_CACHE_BYTES 32
  19. #define L2_CACHE_BYTES 128
  20. /*
  21. * L2 used as cache
  22. */
  23. #define L2MODE_SIZE L2MODE_256K_CACHE
  24. /*
  25. * For practical reasons the L1_CACHE_BYTES defines should not be smaller than
  26. * the L2 line size
  27. */
  28. #define L1_CACHE_BYTES L2_CACHE_BYTES
  29. #define L2_CACHE_ALIGN_LOW(x) \
  30. (((x) & ~(L2_CACHE_BYTES - 1)))
  31. #define L2_CACHE_ALIGN_UP(x) \
  32. (((x) + (L2_CACHE_BYTES - 1)) & ~(L2_CACHE_BYTES - 1))
  33. #define L2_CACHE_ALIGN_CNT(x) \
  34. (((x) + (sizeof(int) - 1)) & ~(sizeof(int) - 1))
  35. #define ARCH_DMA_MINALIGN L1_CACHE_BYTES
  36. #define ARCH_SLAB_MINALIGN L1_CACHE_BYTES
  37. /*
  38. * This is the granularity of hardware cacheability control.
  39. */
  40. #define CACHEABILITY_ALIGN 0x01000000
  41. /*
  42. * Align a physical address to MAR regions
  43. */
  44. #define CACHE_REGION_START(v) \
  45. (((u32) (v)) & ~(CACHEABILITY_ALIGN - 1))
  46. #define CACHE_REGION_END(v) \
  47. (((u32) (v) + (CACHEABILITY_ALIGN - 1)) & ~(CACHEABILITY_ALIGN - 1))
  48. extern void __init c6x_cache_init(void);
  49. extern void enable_caching(unsigned long start, unsigned long end);
  50. extern void disable_caching(unsigned long start, unsigned long end);
  51. extern void L1_cache_off(void);
  52. extern void L1_cache_on(void);
  53. extern void L1P_cache_global_invalidate(void);
  54. extern void L1D_cache_global_invalidate(void);
  55. extern void L1D_cache_global_writeback(void);
  56. extern void L1D_cache_global_writeback_invalidate(void);
  57. extern void L2_cache_set_mode(unsigned int mode);
  58. extern void L2_cache_global_writeback_invalidate(void);
  59. extern void L2_cache_global_writeback(void);
  60. extern void L1P_cache_block_invalidate(unsigned int start, unsigned int end);
  61. extern void L1D_cache_block_invalidate(unsigned int start, unsigned int end);
  62. extern void L1D_cache_block_writeback_invalidate(unsigned int start,
  63. unsigned int end);
  64. extern void L1D_cache_block_writeback(unsigned int start, unsigned int end);
  65. extern void L2_cache_block_invalidate(unsigned int start, unsigned int end);
  66. extern void L2_cache_block_writeback(unsigned int start, unsigned int end);
  67. extern void L2_cache_block_writeback_invalidate(unsigned int start,
  68. unsigned int end);
  69. extern void L2_cache_block_invalidate_nowait(unsigned int start,
  70. unsigned int end);
  71. extern void L2_cache_block_writeback_nowait(unsigned int start,
  72. unsigned int end);
  73. extern void L2_cache_block_writeback_invalidate_nowait(unsigned int start,
  74. unsigned int end);
  75. #endif /* _ASM_C6X_CACHE_H */