15#ifndef __L4SYS__INCLUDE__ARCH_ARM__CACHE_H__
16#define __L4SYS__INCLUDE__ARCH_ARM__CACHE_H__
20#include_next <l4/sys/cache.h>
22L4_INLINE unsigned long __attribute__((pure, always_inline))
23l4_cache_arm_ctr(
void);
25L4_INLINE unsigned long __attribute__((pure, always_inline))
29 asm (
"mrs %0, CTR_EL0" :
"=r"(v));
33L4_INLINE unsigned __attribute__((pure, always_inline))
34l4_cache_dmin_line(
void);
36L4_INLINE unsigned __attribute__((pure, always_inline))
37l4_cache_dmin_line(
void)
39 return 4U << ((l4_cache_arm_ctr() >> 16) & 0xf);
42#define L4_ARM_CACHE_LOOP(op) \
46 __builtin_unreachable(); \
48 step = l4_cache_dmin_line(); \
49 start &= ~(step - 1); \
50 end = (end + step - 1) & ~(step - 1); \
51 for (; start != end; start += step) \
52 asm volatile (op ", %0" : : "r"(start) : "memory"); \
53 asm volatile ("dsb ish");
60 L4_ARM_CACHE_LOOP(
"dc cvac");
68 L4_ARM_CACHE_LOOP(
"dc civac");
77 L4_ARM_CACHE_LOOP(
"dc civac");
85 L4_ARM_CACHE_LOOP(
"dc cvau, %0; ic ivau");
94 L4_ARM_CACHE_LOOP(
"dc civac");
98#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.