13 #define SCTLR_M (1 << 0)
14 #define SCTLR_A (1 << 1)
15 #define SCTLR_C (1 << 2)
17 #define SCTLR_CP15BEN (1 << 5)
19 #define SCTLR_B (1 << 7)
21 #define SCTLR_SW (1 << 10)
22 #define SCTLR_Z (1 << 11)
23 #define SCTLR_I (1 << 12)
24 #define SCTLR_V (1 << 13)
25 #define SCTLR_RR (1 << 14)
27 #define SCTLR_HA (1 << 17)
30 #define SCTLR_WXN (1 << 19)
31 #define SCTLR_UWXN (1 << 20)
33 #define SCTLR_FI (1 << 21)
34 #define SCTLR_U (1 << 22)
35 #define SCTLR_VE (1 << 24)
36 #define SCTLR_EE (1 << 25)
38 #define SCTLR_NMFI (1 << 27)
39 #define SCTLR_TRE (1 << 28)
40 #define SCTLR_AFE (1 << 29)
41 #define SCTLR_TE (1 << 30)
49 static inline void dmb(
void)
51 asm volatile (
"dmb" : : :
"memory");
55 static inline void dsb(
void)
57 asm volatile (
"dsb" : : :
"memory");
61 static inline void isb(
void)
63 asm volatile (
"isb" : : :
"memory");
71 static inline void tlbiall(
void)
73 asm volatile (
"mcr p15, 0, %0, c8, c7, 0" : :
"r" (0) :
"memory");
77 static inline void tlbimva(
unsigned long mva)
79 asm volatile (
"mcr p15, 0, %0, c8, c7, 1" : :
"r" (mva) :
"memory");
85 asm volatile (
"mcr p15, 0, %0, c3, c0, 0" : :
"r" (
val));
92 asm volatile (
"mrc p15, 0, %0, c0, c1, 4" :
"=r" (mmfr));
99 asm volatile (
"mrc p15, 0, %0, c10, c2, 0" :
"=r" (mair));
105 asm volatile (
"mcr p15, 0, %0, c10, c2, 0" : :
"r" (
val));
111 asm volatile (
"mcrr p15, 0, %[val], %[zero], c2" : :
112 [
val]
"r" (
val), [zero]
"r" (0));
114 asm volatile (
"mcr p15, 0, %0, c2, c0, 0" : :
"r" (
val) :
"memory");
121 asm volatile (
"mrc p15, 0, %0, c2, c0, 2" :
"=r" (
val));
128 asm volatile (
"mcr p15, 0, %0, c2, c0, 2" : :
"r" (
val) :
"memory");
136 static inline void bpiall(
void)
138 asm volatile (
"mcr p15, 0, %0, c7, c5, 6" : :
"r" (0));
142 static inline void dccimvac(
unsigned long mva)
144 asm volatile (
"mcr p15, 0, %0, c7, c14, 1" : :
"r" (mva) :
"memory");
150 asm volatile (
"mcr p15, 0, %0, c7, c14, 2" : :
"r" (
val) :
"memory");
154 static inline void dccmvac(
unsigned long mva)
156 asm volatile (
"mcr p15, 0, %0, c7, c10, 1" : :
"r" (mva) :
"memory");
162 asm volatile (
"mcr p15, 0, %0, c7, c10, 2" : :
"r" (
val) :
"memory");
166 static inline void dcimvac(
unsigned long mva)
168 asm volatile (
"mcr p15, 0, %0, c7, c6, 1" : :
"r" (mva) :
"memory");
174 asm volatile (
"mcr p15, 0, %0, c7, c6, 2" : :
"r" (
val) :
"memory");
178 static inline void iciallu(
void)
180 asm volatile (
"mcr p15, 0, %0, c7, c5, 0" : :
"r" (0));
191 asm volatile (
"mrc p15, 1, %0, c0, c0, 1" :
"=r" (
val));
199 asm volatile (
"mrc p15, 1, %0, c0, c0, 0" :
"=r" (
val));
207 asm volatile (
"mrc p15, 2, %0, c0, c0, 0" :
"=r" (
val));
218 asm volatile (
"mcr p15, 2, %0, c0, c0, 0" : :
"r" (
val));
226 asm volatile (
"mrc p15, 1, %0, c9, c0, 2" :
"=r" (
val));
237 asm volatile(
"mcr p15, 1, %0, c9, c0, 2" : :
"r" (
val) :
"memory" );
245 asm volatile (
"mrc p15, 1, %0, c15, c0, 0" :
"=r" (
val));
252 asm volatile (
"mcr p15, 1, %0, c15, c0, 0" : :
"r" (
val) :
"memory" );
260 asm volatile (
"mrc p15, 0, %0, c1, c0, 0" :
"=r" (
val));
267 asm volatile (
"mcr p15, 0, %0, c1, c0, 0" : :
"r" (
val) :
"cc");
275 asm volatile (
"mrc p15, 0, %0, c6, c0, 0" :
"=r" (
val));
283 asm volatile (
"mrc p15, 0, %0, c5, c0, 0" :
"=r" (
val));
291 asm volatile (
"mrc p15, 0, %0, c6, c0, 2" :
"=r" (
val));
299 asm volatile (
"mrc p15, 0, %0, c5, c0, 1" :
"=r" (
val));
307 asm volatile (
"mrc p15, 0, %0, c5, c1, 0" :
"=r" (
val));
315 asm volatile (
"mrc p15, 0, %0, c5, c1, 1" :
"=r" (
val));
void cache_sync_instructions(void)
void dcache_invalidate_all(void)
void dcache_invalidate_by_mva(void const *addr, size_t len)
void dcache_clean_all(void)
void dcache_clean_by_mva(void const *addr, size_t len)
void dcache_mmu_enable(void)
void dcache_clean_invalidate_by_mva(void const *addr, size_t len)
unsigned int dcache_line_bytes(void)
void dcache_mmu_disable(void)
void dcache_clean_invalidate_all(void)
void tlb_invalidate_all(void)
static void dccsw(uint32_t val)
static uint32_t read_clidr(void)
static uint32_t read_mmfr0(void)
static uint32_t read_ttbcr(void)
static void write_mair0(uint32_t val)
static uint32_t read_mair0(void)
static void tlbiall(void)
void mmu_disable_range_kb(u32 start_kb, u32 size_kb)
static uint32_t read_dfar(void)
static void dccimvac(unsigned long mva)
static void write_ttbr0(uint32_t val)
static uint32_t read_ifsr(void)
void mmu_config_range(u32 start_mb, u32 size_mb, enum dcache_policy policy)
static uint32_t read_l2actlr(void)
static uint32_t read_adfsr(void)
static uint32_t read_ccsidr(void)
static void write_dacr(uint32_t val)
static uint32_t read_dfsr(void)
static void write_sctlr(uint32_t val)
static void write_l2ctlr(uint32_t val)
static void write_csselr(uint32_t val)
static void dccmvac(unsigned long mva)
static uint32_t read_csselr(void)
static void write_ttbcr(uint32_t val)
static void dccisw(uint32_t val)
void mmu_config_range_kb(u32 start_kb, u32 size_kb, enum dcache_policy policy)
static void iciallu(void)
static uint32_t read_ifar(void)
static void dcisw(uint32_t val)
static void dcimvac(unsigned long mva)
static uint32_t read_sctlr(void)
static void tlbimva(unsigned long mva)
void mmu_disable_range(u32 start_mb, u32 size_mb)
static uint32_t read_aifsr(void)
static uint32_t read_l2ctlr(void)
static void write_l2actlr(uint32_t val)