15#ifndef __L4SYS__INCLUDE__ARCH_ARM__CACHE_H__
16#define __L4SYS__INCLUDE__ARCH_ARM__CACHE_H__
20L4_INLINE unsigned long __attribute__((pure, always_inline))
21l4_cache_arm_ctr(
void);
23L4_INLINE unsigned long __attribute__((pure, always_inline))
27 asm (
"mrs %0, CTR_EL0" :
"=r"(v));
31L4_INLINE unsigned __attribute__((pure, always_inline))
32l4_cache_dmin_line(
void);
34L4_INLINE unsigned __attribute__((pure, always_inline))
35l4_cache_dmin_line(
void)
37 return 4U << ((l4_cache_arm_ctr() >> 16) & 0xf);
40#define L4_ARM_CACHE_LOOP(op) \
44 __builtin_unreachable(); \
46 step = l4_cache_dmin_line(); \
47 start &= ~(step - 1); \
48 end = (end + step - 1) & ~(step - 1); \
49 for (; start != end; start += step) \
50 asm volatile (op ", %0" : : "r"(start) : "memory"); \
51 asm volatile ("dsb ish");
58 L4_ARM_CACHE_LOOP(
"dc cvac");
66 L4_ARM_CACHE_LOOP(
"dc civac");
75 L4_ARM_CACHE_LOOP(
"dc civac");
83 L4_ARM_CACHE_LOOP(
"dc cvau, %0; ic ivau");
92 L4_ARM_CACHE_LOOP(
"dc civac");
96#undef L4_ARM_CACHE_LOOP
L4 compiler related defines.
int l4_cache_dma_coherent(unsigned long start, unsigned long end) L4_NOTHROW
Make memory coherent for use with external memory; writes back to PoC.
int l4_cache_flush_data(unsigned long start, unsigned long end) L4_NOTHROW
Cache flush a range; writes back to PoC.
int l4_cache_coherent(unsigned long start, unsigned long end) L4_NOTHROW
Make memory coherent between I-cache and D-cache; writes back to PoU.
int l4_cache_clean_data(unsigned long start, unsigned long end) L4_NOTHROW
Cache clean a range in D-cache; writes back to PoC.
int l4_cache_inv_data(unsigned long start, unsigned long end) L4_NOTHROW
Cache invalidate a range; might write back to PoC.
#define L4_NOTHROW
Mark a function declaration and definition as never throwing an exception.
#define L4_INLINE
L4 Inline function attribute.