cp15.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. #ifndef __ASM_ARM_CP15_H
  2. #define __ASM_ARM_CP15_H
  3. #include <asm/barrier.h>
  4. /*
  5. * CR1 bits (CP#15 CR1)
  6. */
  7. #define CR_M (1 << 0) /* MMU enable */
  8. #define CR_A (1 << 1) /* Alignment abort enable */
  9. #define CR_C (1 << 2) /* Dcache enable */
  10. #define CR_W (1 << 3) /* Write buffer enable */
  11. #define CR_P (1 << 4) /* 32-bit exception handler */
  12. #define CR_D (1 << 5) /* 32-bit data address range */
  13. #define CR_L (1 << 6) /* Implementation defined */
  14. #define CR_B (1 << 7) /* Big endian */
  15. #define CR_S (1 << 8) /* System MMU protection */
  16. #define CR_R (1 << 9) /* ROM MMU protection */
  17. #define CR_F (1 << 10) /* Implementation defined */
  18. #define CR_Z (1 << 11) /* Implementation defined */
  19. #define CR_I (1 << 12) /* Icache enable */
  20. #define CR_V (1 << 13) /* Vectors relocated to 0xffff0000 */
  21. #define CR_RR (1 << 14) /* Round Robin cache replacement */
  22. #define CR_L4 (1 << 15) /* LDR pc can set T bit */
  23. #define CR_DT (1 << 16)
  24. #define CR_IT (1 << 18)
  25. #define CR_ST (1 << 19)
  26. #define CR_FI (1 << 21) /* Fast interrupt (lower latency mode) */
  27. #define CR_U (1 << 22) /* Unaligned access operation */
  28. #define CR_XP (1 << 23) /* Extended page tables */
  29. #define CR_VE (1 << 24) /* Vectored interrupts */
  30. #define CR_EE (1 << 25) /* Exception (Big) Endian */
  31. #define CR_TRE (1 << 28) /* TEX remap enable */
  32. #define CR_AFE (1 << 29) /* Access flag enable */
  33. #define CR_TE (1 << 30) /* Thumb exception enable */
  34. #ifndef __ASSEMBLY__
  35. #if __LINUX_ARM_ARCH__ >= 4
  36. #define vectors_high() (cr_alignment & CR_V)
  37. #else
  38. #define vectors_high() (0)
  39. #endif
  40. extern unsigned long cr_no_alignment; /* defined in entry-armv.S */
  41. extern unsigned long cr_alignment; /* defined in entry-armv.S */
  42. static inline unsigned int get_cr(void)
  43. {
  44. unsigned int val;
  45. asm("mrc p15, 0, %0, c1, c0, 0 @ get CR" : "=r" (val) : : "cc");
  46. return val;
  47. }
  48. static inline void set_cr(unsigned int val)
  49. {
  50. asm volatile("mcr p15, 0, %0, c1, c0, 0 @ set CR"
  51. : : "r" (val) : "cc");
  52. isb();
  53. }
  54. #ifndef CONFIG_SMP
  55. extern void adjust_cr(unsigned long mask, unsigned long set);
  56. #endif
  57. #define CPACC_FULL(n) (3 << (n * 2))
  58. #define CPACC_SVC(n) (1 << (n * 2))
  59. #define CPACC_DISABLE(n) (0 << (n * 2))
  60. static inline unsigned int get_copro_access(void)
  61. {
  62. unsigned int val;
  63. asm("mrc p15, 0, %0, c1, c0, 2 @ get copro access"
  64. : "=r" (val) : : "cc");
  65. return val;
  66. }
  67. static inline void set_copro_access(unsigned int val)
  68. {
  69. asm volatile("mcr p15, 0, %0, c1, c0, 2 @ set copro access"
  70. : : "r" (val) : "cc");
  71. isb();
  72. }
  73. #endif
  74. #endif