FreeNOS
|
ARMv7 cache management implementation. More...
#include <ARMCacheV7.h>
Public Member Functions | |
virtual Result | invalidate (Type type) |
Invalidate the entire cache. More... | |
virtual Result | cleanInvalidate (Type type) |
Clean and invalidate entire cache. More... | |
virtual Result | cleanInvalidateAddress (Type type, Address addr) |
Clean and invalidate one memory page. More... | |
virtual Result | cleanAddress (Type type, Address addr) |
Clean one memory page. More... | |
virtual Result | invalidateAddress (Type type, Address addr) |
Invalidate one memory page. More... | |
Public Member Functions inherited from Cache | |
virtual Result | cleanData (Address addr) |
Clean one data page. More... | |
virtual Result | cleanData (void *ptr) |
Clean one data page. More... | |
Private Types | |
enum | CacheLevelType { CacheLevelInstruction = 1, CacheLevelData = 2, CacheLevelInstructionData = 3, CacheLevelUnified = 4 } |
Defines the cache level type bits. More... | |
Private Member Functions | |
Result | dataFlush (bool clean) |
Flush the entire data cache. More... | |
u32 | getCacheLevelId () const |
Get cache level identifier. More... | |
u32 | getCacheLineSize () const |
Get cache line size in bytes. More... | |
u32 | readCacheSize (u32 level, u32 type) const |
Get cache size. More... | |
Result | flushLevel (u32 level, bool clean) |
Clean and Invalidate by cache level. More... | |
Private Attributes | |
ARMControl | m_control |
ARM system control processor object. More... | |
Additional Inherited Members | |
Public Types inherited from Cache | |
enum | Result { Success, InvalidArgument, IOError, NotSupported } |
Result codes. More... | |
enum | Type { Instruction, Data, Unified } |
Cache types. More... | |
ARMv7 cache management implementation.
Definition at line 42 of file ARMCacheV7.h.
|
private |
Defines the cache level type bits.
Enumerator | |
---|---|
CacheLevelInstruction | |
CacheLevelData | |
CacheLevelInstructionData | |
CacheLevelUnified |
Definition at line 49 of file ARMCacheV7.h.
|
virtual |
Clean one memory page.
type | Cache type to clean |
addr | Virtual memory address of the page to clean and invalidate |
Implements Cache.
Definition at line 110 of file ARMCacheV7.cpp.
References Cache::Data, dsb(), getCacheLineSize(), Cache::Instruction, Cache::IOError, isb(), mcr, PAGEMASK, PAGESIZE, Cache::Success, type, and Cache::Unified.
|
virtual |
Clean and invalidate entire cache.
This operation will clean and invalidate the entire given cache.
type | Cache type to clean and invalidate. |
Implements Cache.
Definition at line 52 of file ARMCacheV7.cpp.
References Cache::Data, dataFlush(), dsb(), flushBranchPrediction(), Cache::Instruction, isb(), mcr, Cache::Success, type, and Cache::Unified.
Referenced by invalidate().
|
virtual |
Clean and invalidate one memory page.
type | Cache type to clean and invalidate. |
addr | Virtual memory address of the page to clean and invalidate |
Implements Cache.
Definition at line 82 of file ARMCacheV7.cpp.
References Cache::Data, dsb(), getCacheLineSize(), Cache::Instruction, Cache::IOError, isb(), mcr, PAGEMASK, PAGESIZE, Cache::Success, type, and Cache::Unified.
|
private |
Flush the entire data cache.
clean | True to clean cache before invalidation. |
Definition at line 267 of file ARMCacheV7.cpp.
References CacheLevelData, CacheLevelInstruction, CacheLevelUnified, flushLevel(), getCacheLevelId(), and Cache::Success.
Referenced by cleanInvalidate(), and invalidate().
|
private |
Clean and Invalidate by cache level.
level | Cache level |
clean | True to clean cache before invalidation. |
Definition at line 218 of file ARMCacheV7.cpp.
References CCSIDR_ASSOCIATIVITY_MASK, CCSIDR_ASSOCIATIVITY_OFFSET, CCSIDR_LINE_SIZE_MASK, CCSIDR_LINE_SIZE_OFFSET, CCSIDR_NUM_SETS_MASK, CCSIDR_NUM_SETS_OFFSET, dsb(), log_2_n_round_up(), readCacheSize(), and Cache::Success.
Referenced by dataFlush().
|
private |
Get cache level identifier.
Definition at line 163 of file ARMCacheV7.cpp.
Referenced by dataFlush().
|
private |
Get cache line size in bytes.
Definition at line 170 of file ARMCacheV7.cpp.
References CCSIDR_LINE_SIZE_MASK, and CCSIDR_LINE_SIZE_OFFSET.
Referenced by cleanAddress(), cleanInvalidateAddress(), and invalidateAddress().
|
virtual |
Invalidate the entire cache.
type | Cache type to invalidate. |
Implements Cache.
Definition at line 34 of file ARMCacheV7.cpp.
References cleanInvalidate(), Cache::Data, dataFlush(), Cache::Instruction, Cache::Success, type, and Cache::Unified.
|
virtual |
Invalidate one memory page.
type | Cache type to invalidate |
addr | Virtual memory address of the page to invalidate |
Implements Cache.
Definition at line 138 of file ARMCacheV7.cpp.
References Cache::Data, dsb(), getCacheLineSize(), Cache::Instruction, Cache::IOError, mcr, PAGEMASK, PAGESIZE, Cache::Success, type, and Cache::Unified.
Get cache size.
Definition at line 188 of file ARMCacheV7.cpp.
References type.
Referenced by flushLevel().
|
private |
ARM system control processor object.
Definition at line 158 of file ARMCacheV7.h.