Go to the documentation of this file.
27 #define CCSIDR_LINE_SIZE_OFFSET 0
28 #define CCSIDR_LINE_SIZE_MASK 0x7
29 #define CCSIDR_ASSOCIATIVITY_OFFSET 3
30 #define CCSIDR_ASSOCIATIVITY_MASK (0x3FF << 3)
31 #define CCSIDR_NUM_SETS_OFFSET 13
32 #define CCSIDR_NUM_SETS_MASK (0x7FFF << 13)
61 mcr(p15, 0, 0, c7, c5, 0);
92 mcr(p15, 0, 1, c7, c5, pageAddr + i);
96 mcr(p15, 0, 1, c7, c14, pageAddr + i);
120 mcr(p15, 0, 1, c7, c5, pageAddr + i);
124 mcr(p15, 0, 1, c7, c10, pageAddr + i);
151 mcr(p15, 0, 1, c7, c6, pageAddr + i);
166 asm volatile (
"mrc p15,1,%0,c0,c0,1" :
"=r" (levelId));
172 u32 ccsidr, line_len;
175 asm volatile (
"mrc p15, 1, %0, c0, c0, 0" :
"=r" (ccsidr));
184 line_len = 1 << line_len;
194 asm volatile (
"mcr p15, 2, %0, c0, c0, 0" : :
"r" (sel));
197 asm volatile (
"mrc p15, 1, %0, c0, c0, 0" :
"=r" (ids));
221 int way, set, setway;
237 u32 way_shift = (32 - log2_num_ways);
240 for (way = num_ways - 1; way >= 0 ; way--)
242 for (set = num_sets - 1; set >= 0; set--)
244 setway = (level << 1) | (set << log2_line_len) |
252 asm volatile (
" mcr p15, 0, %0, c7, c14, 2"
257 asm volatile (
" mcr p15, 0, %0, c7, c6, 2"
270 u32 cacheType, startBit = 0;
272 for (
u32 level = 0; level < 7; level++)
274 cacheType = (levelId >> startBit) & 7;
void isb()
Instruction Synchronisation Barrier (ARMv7 and above)
u32 readCacheSize(u32 level, u32 type) const
Get cache size.
#define mcr(coproc, opcode1, opcode2, reg, subReg, value)
Move to CoProcessor from ARM (MCR).
void dsb()
Data Synchronisation Barrier.
Result dataFlush(bool clean)
Flush the entire data cache.
#define PAGEMASK
Mask to find the page.
u32 getCacheLevelId() const
Get cache level identifier.
#define CCSIDR_ASSOCIATIVITY_MASK
#define PAGESIZE
ARM uses 4K pages.
#define CCSIDR_LINE_SIZE_OFFSET
unsigned long Address
A memory address.
virtual Result invalidate(Type type)
Invalidate the entire cache.
virtual Result cleanAddress(Type type, Address addr)
Clean one memory page.
Result flushLevel(u32 level, bool clean)
Clean and Invalidate by cache level.
#define CCSIDR_NUM_SETS_MASK
static s32 log_2_n_round_up(u32 n)
unsigned int u32
Unsigned 32-bit number.
signed int s32
Signed 32-bit number.
u32 getCacheLineSize() const
Get cache line size in bytes.
#define CCSIDR_NUM_SETS_OFFSET
virtual Result cleanInvalidateAddress(Type type, Address addr)
Clean and invalidate one memory page.
#define CCSIDR_LINE_SIZE_MASK
virtual Result invalidateAddress(Type type, Address addr)
Invalidate one memory page.
virtual Result cleanInvalidate(Type type)
Clean and invalidate entire cache.
#define CCSIDR_ASSOCIATIVITY_OFFSET
void flushBranchPrediction()
Flush branch prediction.