cache.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com)
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License version 2 as
  6. * published by the Free Software Foundation.
  7. */
  8. #ifndef __ARC_ASM_CACHE_H
  9. #define __ARC_ASM_CACHE_H
  10. /* In case $$ not config, setup a dummy number for rest of kernel */
  11. #ifndef CONFIG_ARC_CACHE_LINE_SHIFT
  12. #define L1_CACHE_SHIFT 6
  13. #else
  14. #define L1_CACHE_SHIFT CONFIG_ARC_CACHE_LINE_SHIFT
  15. #endif
  16. #define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
  17. /* For a rare case where customers have differently config I/D */
  18. #define ARC_ICACHE_LINE_LEN L1_CACHE_BYTES
  19. #define ARC_DCACHE_LINE_LEN L1_CACHE_BYTES
  20. #define ICACHE_LINE_MASK (~(ARC_ICACHE_LINE_LEN - 1))
  21. #define DCACHE_LINE_MASK (~(ARC_DCACHE_LINE_LEN - 1))
  22. /*
  23. * ARC700 doesn't cache any access in top 256M.
  24. * Ideal for wiring memory mapped peripherals as we don't need to do
  25. * explicit uncached accesses (LD.di/ST.di) hence more portable drivers
  26. */
  27. #define ARC_UNCACHED_ADDR_SPACE 0xc0000000
  28. #ifndef __ASSEMBLY__
  29. /* Uncached access macros */
  30. #define arc_read_uncached_32(ptr) \
  31. ({ \
  32. unsigned int __ret; \
  33. __asm__ __volatile__( \
  34. " ld.di %0, [%1] \n" \
  35. : "=r"(__ret) \
  36. : "r"(ptr)); \
  37. __ret; \
  38. })
  39. #define arc_write_uncached_32(ptr, data)\
  40. ({ \
  41. __asm__ __volatile__( \
  42. " st.di %0, [%1] \n" \
  43. : \
  44. : "r"(data), "r"(ptr)); \
  45. })
  46. #define ARCH_DMA_MINALIGN L1_CACHE_BYTES
  47. extern void arc_cache_init(void);
  48. extern char *arc_cache_mumbojumbo(int cpu_id, char *buf, int len);
  49. extern void __init read_decode_cache_bcr(void);
  50. #endif /* !__ASSEMBLY__ */
  51. #endif /* _ASM_CACHE_H */