cache.h 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. #ifndef __ASM_SH64_CACHE_H
  2. #define __ASM_SH64_CACHE_H
  3. /*
  4. * This file is subject to the terms and conditions of the GNU General Public
  5. * License. See the file "COPYING" in the main directory of this archive
  6. * for more details.
  7. *
  8. * include/asm-sh64/cache.h
  9. *
  10. * Copyright (C) 2000, 2001 Paolo Alberelli
  11. * Copyright (C) 2003, 2004 Paul Mundt
  12. *
  13. */
  14. #define L1_CACHE_SHIFT 5
  15. /* Valid and Dirty bits */
  16. #define SH_CACHE_VALID (1LL<<0)
  17. #define SH_CACHE_UPDATED (1LL<<57)
  18. /* Unimplemented compat bits.. */
  19. #define SH_CACHE_COMBINED 0
  20. #define SH_CACHE_ASSOC 0
  21. /* Cache flags */
  22. #define SH_CACHE_MODE_WT (1LL<<0)
  23. #define SH_CACHE_MODE_WB (1LL<<1)
  24. /*
  25. * Control Registers.
  26. */
  27. #define ICCR_BASE 0x01600000 /* Instruction Cache Control Register */
  28. #define ICCR_REG0 0 /* Register 0 offset */
  29. #define ICCR_REG1 1 /* Register 1 offset */
  30. #define ICCR0 ICCR_BASE+ICCR_REG0
  31. #define ICCR1 ICCR_BASE+ICCR_REG1
  32. #define ICCR0_OFF 0x0 /* Set ICACHE off */
  33. #define ICCR0_ON 0x1 /* Set ICACHE on */
  34. #define ICCR0_ICI 0x2 /* Invalidate all in IC */
  35. #define ICCR1_NOLOCK 0x0 /* Set No Locking */
  36. #define OCCR_BASE 0x01E00000 /* Operand Cache Control Register */
  37. #define OCCR_REG0 0 /* Register 0 offset */
  38. #define OCCR_REG1 1 /* Register 1 offset */
  39. #define OCCR0 OCCR_BASE+OCCR_REG0
  40. #define OCCR1 OCCR_BASE+OCCR_REG1
  41. #define OCCR0_OFF 0x0 /* Set OCACHE off */
  42. #define OCCR0_ON 0x1 /* Set OCACHE on */
  43. #define OCCR0_OCI 0x2 /* Invalidate all in OC */
  44. #define OCCR0_WT 0x4 /* Set OCACHE in WT Mode */
  45. #define OCCR0_WB 0x0 /* Set OCACHE in WB Mode */
  46. #define OCCR1_NOLOCK 0x0 /* Set No Locking */
  47. /*
  48. * SH-5
  49. * A bit of description here, for neff=32.
  50. *
  51. * |<--- tag (19 bits) --->|
  52. * +-----------------------------+-----------------+------+----------+------+
  53. * | | | ways |set index |offset|
  54. * +-----------------------------+-----------------+------+----------+------+
  55. * ^ 2 bits 8 bits 5 bits
  56. * +- Bit 31
  57. *
  58. * Cacheline size is based on offset: 5 bits = 32 bytes per line
  59. * A cache line is identified by a tag + set but OCACHETAG/ICACHETAG
  60. * have a broader space for registers. These are outlined by
  61. * CACHE_?C_*_STEP below.
  62. *
  63. */
  64. /* Instruction cache */
  65. #define CACHE_IC_ADDRESS_ARRAY 0x01000000
  66. /* Operand Cache */
  67. #define CACHE_OC_ADDRESS_ARRAY 0x01800000
  68. /* These declarations relate to cache 'synonyms' in the operand cache. A
  69. 'synonym' occurs where effective address bits overlap between those used for
  70. indexing the cache sets and those passed to the MMU for translation. In the
  71. case of SH5-101 & SH5-103, only bit 12 is affected for 4k pages. */
  72. #define CACHE_OC_N_SYNBITS 1 /* Number of synonym bits */
  73. #define CACHE_OC_SYN_SHIFT 12
  74. /* Mask to select synonym bit(s) */
  75. #define CACHE_OC_SYN_MASK (((1UL<<CACHE_OC_N_SYNBITS)-1)<<CACHE_OC_SYN_SHIFT)
  76. /*
  77. * Instruction cache can't be invalidated based on physical addresses.
  78. * No Instruction Cache defines required, then.
  79. */
  80. #endif /* __ASM_SH64_CACHE_H */