cache.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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. #define CACHE_LINE_MASK (~(L1_CACHE_BYTES - 1))
  18. /*
  19. * ARC700 doesn't cache any access in top 1G (0xc000_0000 to 0xFFFF_FFFF)
  20. * Ideal for wiring memory mapped peripherals as we don't need to do
  21. * explicit uncached accesses (LD.di/ST.di) hence more portable drivers
  22. */
  23. #define ARC_UNCACHED_ADDR_SPACE 0xc0000000
  24. #ifndef __ASSEMBLY__
  25. /* Uncached access macros */
  26. #define arc_read_uncached_32(ptr) \
  27. ({ \
  28. unsigned int __ret; \
  29. __asm__ __volatile__( \
  30. " ld.di %0, [%1] \n" \
  31. : "=r"(__ret) \
  32. : "r"(ptr)); \
  33. __ret; \
  34. })
  35. #define arc_write_uncached_32(ptr, data)\
  36. ({ \
  37. __asm__ __volatile__( \
  38. " st.di %0, [%1] \n" \
  39. : \
  40. : "r"(data), "r"(ptr)); \
  41. })
  42. #define ARCH_DMA_MINALIGN L1_CACHE_BYTES
  43. extern void arc_cache_init(void);
  44. extern char *arc_cache_mumbojumbo(int cpu_id, char *buf, int len);
  45. extern void read_decode_cache_bcr(void);
  46. extern int ioc_exists;
  47. #endif /* !__ASSEMBLY__ */
  48. /* Instruction cache related Auxiliary registers */
  49. #define ARC_REG_IC_BCR 0x77 /* Build Config reg */
  50. #define ARC_REG_IC_IVIC 0x10
  51. #define ARC_REG_IC_CTRL 0x11
  52. #define ARC_REG_IC_IVIL 0x19
  53. #define ARC_REG_IC_PTAG 0x1E
  54. #define ARC_REG_IC_PTAG_HI 0x1F
  55. /* Bit val in IC_CTRL */
  56. #define IC_CTRL_CACHE_DISABLE 0x1
  57. /* Data cache related Auxiliary registers */
  58. #define ARC_REG_DC_BCR 0x72 /* Build Config reg */
  59. #define ARC_REG_DC_IVDC 0x47
  60. #define ARC_REG_DC_CTRL 0x48
  61. #define ARC_REG_DC_IVDL 0x4A
  62. #define ARC_REG_DC_FLSH 0x4B
  63. #define ARC_REG_DC_FLDL 0x4C
  64. #define ARC_REG_DC_PTAG 0x5C
  65. #define ARC_REG_DC_PTAG_HI 0x5F
  66. /* Bit val in DC_CTRL */
  67. #define DC_CTRL_INV_MODE_FLUSH 0x40
  68. #define DC_CTRL_FLUSH_STATUS 0x100
  69. /*System-level cache (L2 cache) related Auxiliary registers */
  70. #define ARC_REG_SLC_CFG 0x901
  71. #define ARC_REG_SLC_CTRL 0x903
  72. #define ARC_REG_SLC_FLUSH 0x904
  73. #define ARC_REG_SLC_INVALIDATE 0x905
  74. #define ARC_REG_SLC_RGN_START 0x914
  75. #define ARC_REG_SLC_RGN_START1 0x915
  76. #define ARC_REG_SLC_RGN_END 0x916
  77. #define ARC_REG_SLC_RGN_END1 0x917
  78. /* Bit val in SLC_CONTROL */
  79. #define SLC_CTRL_IM 0x040
  80. #define SLC_CTRL_DISABLE 0x001
  81. #define SLC_CTRL_BUSY 0x100
  82. #define SLC_CTRL_RGN_OP_INV 0x200
  83. /* IO coherency related Auxiliary registers */
  84. #define ARC_REG_IO_COH_ENABLE 0x500
  85. #define ARC_REG_IO_COH_PARTIAL 0x501
  86. #define ARC_REG_IO_COH_AP0_BASE 0x508
  87. #define ARC_REG_IO_COH_AP0_SIZE 0x509
  88. #endif /* _ASM_CACHE_H */