FreeNOS
Public Member Functions | Private Types | Private Member Functions | Private Attributes
ARMCacheV7 Class Reference

ARMv7 cache management implementation. More...

#include <ARMCacheV7.h>

Inheritance diagram for ARMCacheV7:
Cache

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...
 

Detailed Description

ARMv7 cache management implementation.

See also
ARM Architecture Reference Manual, page xxx

Definition at line 42 of file ARMCacheV7.h.

Member Enumeration Documentation

◆ CacheLevelType

Defines the cache level type bits.

Enumerator
CacheLevelInstruction 
CacheLevelData 
CacheLevelInstructionData 
CacheLevelUnified 

Definition at line 49 of file ARMCacheV7.h.

Member Function Documentation

◆ cleanAddress()

ARMCacheV7::Result ARMCacheV7::cleanAddress ( ARMCacheV7::Type  type,
Address  addr 
)
virtual

Clean one memory page.

Parameters
typeCache type to clean
addrVirtual memory address of the page to clean and invalidate
Returns
Result code

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.

◆ cleanInvalidate()

ARMCacheV7::Result ARMCacheV7::cleanInvalidate ( ARMCacheV7::Type  type)
virtual

Clean and invalidate entire cache.

This operation will clean and invalidate the entire given cache.

Parameters
typeCache type to clean and invalidate.
Returns
Result code

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().

◆ cleanInvalidateAddress()

ARMCacheV7::Result ARMCacheV7::cleanInvalidateAddress ( Type  type,
Address  addr 
)
virtual

Clean and invalidate one memory page.

Parameters
typeCache type to clean and invalidate.
addrVirtual memory address of the page to clean and invalidate
Returns
Result code

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.

◆ dataFlush()

ARMCacheV7::Result ARMCacheV7::dataFlush ( bool  clean)
private

Flush the entire data cache.

Parameters
cleanTrue to clean cache before invalidation.
Returns
Result code

Definition at line 267 of file ARMCacheV7.cpp.

References CacheLevelData, CacheLevelInstruction, CacheLevelUnified, flushLevel(), getCacheLevelId(), and Cache::Success.

Referenced by cleanInvalidate(), and invalidate().

◆ flushLevel()

ARMCacheV7::Result ARMCacheV7::flushLevel ( u32  level,
bool  clean 
)
private

Clean and Invalidate by cache level.

Parameters
levelCache level
cleanTrue to clean cache before invalidation.
Returns
Result code

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().

◆ getCacheLevelId()

u32 ARMCacheV7::getCacheLevelId ( ) const
private

Get cache level identifier.

Returns
Cache Level Identifier

Definition at line 163 of file ARMCacheV7.cpp.

Referenced by dataFlush().

◆ getCacheLineSize()

u32 ARMCacheV7::getCacheLineSize ( ) const
private

Get cache line size in bytes.

Returns
Cache line 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().

◆ invalidate()

ARMCacheV7::Result ARMCacheV7::invalidate ( ARMCacheV7::Type  type)
virtual

Invalidate the entire cache.

Parameters
typeCache type to invalidate.
Returns
Result code

Implements Cache.

Definition at line 34 of file ARMCacheV7.cpp.

References cleanInvalidate(), Cache::Data, dataFlush(), Cache::Instruction, Cache::Success, type, and Cache::Unified.

◆ invalidateAddress()

ARMCacheV7::Result ARMCacheV7::invalidateAddress ( ARMCacheV7::Type  type,
Address  addr 
)
virtual

Invalidate one memory page.

Parameters
typeCache type to invalidate
addrVirtual memory address of the page to invalidate
Returns
Result code

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.

◆ readCacheSize()

u32 ARMCacheV7::readCacheSize ( u32  level,
u32  type 
) const
private

Get cache size.

Parameters
levelCache level to get size for
typeCache type to get size for
Returns
Cache size in bytes

Definition at line 188 of file ARMCacheV7.cpp.

References type.

Referenced by flushLevel().

Field Documentation

◆ m_control

ARMControl ARMCacheV7::m_control
private

ARM system control processor object.

Definition at line 158 of file ARMCacheV7.h.


The documentation for this class was generated from the following files: