mpu.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. #ifndef __ARM_MPU_H
  2. #define __ARM_MPU_H
  3. #ifdef CONFIG_ARM_MPU
  4. /* MPUIR layout */
  5. #define MPUIR_nU 1
  6. #define MPUIR_DREGION 8
  7. #define MPUIR_IREGION 16
  8. #define MPUIR_DREGION_SZMASK (0xFF << MPUIR_DREGION)
  9. #define MPUIR_IREGION_SZMASK (0xFF << MPUIR_IREGION)
  10. /* ID_MMFR0 data relevant to MPU */
  11. #define MMFR0_PMSA (0xF << 4)
  12. #define MMFR0_PMSAv7 (3 << 4)
  13. /* MPU D/I Size Register fields */
  14. #define MPU_RSR_SZ 1
  15. #define MPU_RSR_EN 0
  16. /* The D/I RSR value for an enabled region spanning the whole of memory */
  17. #define MPU_RSR_ALL_MEM 63
  18. /* Individual bits in the DR/IR ACR */
  19. #define MPU_ACR_XN (1 << 12)
  20. #define MPU_ACR_SHARED (1 << 2)
  21. /* C, B and TEX[2:0] bits only have semantic meanings when grouped */
  22. #define MPU_RGN_CACHEABLE 0xB
  23. #define MPU_RGN_SHARED_CACHEABLE (MPU_RGN_CACHEABLE | MPU_ACR_SHARED)
  24. #define MPU_RGN_STRONGLY_ORDERED 0
  25. /* Main region should only be shared for SMP */
  26. #ifdef CONFIG_SMP
  27. #define MPU_RGN_NORMAL (MPU_RGN_CACHEABLE | MPU_ACR_SHARED)
  28. #else
  29. #define MPU_RGN_NORMAL MPU_RGN_CACHEABLE
  30. #endif
  31. /* Access permission bits of ACR (only define those that we use)*/
  32. #define MPU_AP_PL1RW_PL0RW (0x3 << 8)
  33. #define MPU_AP_PL1RW_PL0R0 (0x2 << 8)
  34. #define MPU_AP_PL1RW_PL0NA (0x1 << 8)
  35. /* For minimal static MPU region configurations */
  36. #define MPU_PROBE_REGION 0
  37. #define MPU_BG_REGION 1
  38. #define MPU_RAM_REGION 2
  39. #define MPU_VECTORS_REGION 3
  40. /* Maximum number of regions Linux is interested in */
  41. #define MPU_MAX_REGIONS 16
  42. #define MPU_DATA_SIDE 0
  43. #define MPU_INSTR_SIDE 1
  44. #ifndef __ASSEMBLY__
  45. struct mpu_rgn {
  46. /* Assume same attributes for d/i-side */
  47. u32 drbar;
  48. u32 drsr;
  49. u32 dracr;
  50. };
  51. struct mpu_rgn_info {
  52. u32 mpuir;
  53. struct mpu_rgn rgns[MPU_MAX_REGIONS];
  54. };
  55. extern struct mpu_rgn_info mpu_rgn_info;
  56. #endif /* __ASSEMBLY__ */
  57. #endif /* CONFIG_ARM_MPU */
  58. #endif