arch:cache: add lock feature for cache

Some architectures support lock & unlock cache feature.

Signed-off-by: zhuyanlin <zhuyanlin1@xiaomi.com>
This commit is contained in:
zhuyanlin 2021-10-19 12:15:43 +08:00 committed by Gustavo Henrique Nihei
parent 90cfa6f313
commit b4ea11f7b1
2 changed files with 140 additions and 0 deletions

View File

@ -244,10 +244,20 @@ config ARCH_ICACHE
bool
default n
config ARCH_ICACHE_LOCK
bool
depends on ARCH_ICACHE
default n
config ARCH_DCACHE
bool
default n
config ARCH_DCACHE_LOCK
bool
depends on ARCH_DCACHE
default n
config ARCH_L2CACHE
bool
default n

View File

@ -132,6 +132,71 @@ void up_invalidate_icache_all(void);
# define up_invalidate_icache_all()
#endif
/****************************************************************************
* Name: up_lock_icache
*
* Description:
* Prefetch and lock the instruction cache within the specified region.
* If the specified address if not present in the instruction cache,
* some architectures transfer the line from memory, others wait the
* address be read from memory, and then lock.
*
* Input Parameters:
* start - virtual start address of region
* end - virtual end address of region + 1
*
* Returned Value:
* None
*
****************************************************************************/
#ifdef CONFIG_ARCH_ICACHE_LOCK
void up_lock_icache(uintptr_t start, uintptr_t end);
#else
# define up_lock_icache()
#endif
/****************************************************************************
* Name: up_unlock_icache
*
* Description:
* Unlock the instruction cache within the specified region.
*
* Input Parameters:
* start - virtual start address of region
* end - virtual end address of region + 1
*
* Returned Value:
* None
*
****************************************************************************/
#ifdef CONFIG_ARCH_ICACHE_LOCK
void up_unlock_icache(uintptr_t start, uintptr_t end);
#else
# define up_unlock_icache()
#endif
/****************************************************************************
* Name: up_unlock_icache_all
*
* Description:
* Unlock the entire contents of instruction cache.
*
* Input Parameters:
* None
*
* Returned Value:
* None
*
****************************************************************************/
#ifdef CONFIG_ARCH_ICACHE_LOCK
void up_unlock_icache_all(void);
#else
# define up_unlock_icache_all()
#endif
/****************************************************************************
* Name: up_enable_dcache
*
@ -303,6 +368,71 @@ void up_flush_dcache_all(void);
# define up_flush_dcache_all()
#endif
/****************************************************************************
* Name: up_lock_dcache
*
* Description:
* Prefetch and lock the data cache within the specified region.
* If the specified address is not present in the data cache,
* some architectures transfer the line from memory, others wait the
* address be read from memory, and then lock.
*
* Input Parameters:
* start - virtual start address of region
* end - virtual end address of region + 1
*
* Returned Value:
* None
*
****************************************************************************/
#ifdef CONFIG_ARCH_DCACHE_LOCK
void up_lock_dcache(uintptr_t start, uintptr_t end);
#else
# define up_lock_dcache()
#endif
/****************************************************************************
* Name: up_unlock_dcache
*
* Description:
* Unlock the data cache within the specified region.
*
* Input Parameters:
* start - virtual start address of region
* end - virtual end address of region + 1
*
* Returned Value:
* None
*
****************************************************************************/
#ifdef CONFIG_ARCH_DCACHE_LOCK
void up_unlock_dcache(uintptr_t start, uintptr_t end);
#else
# define up_unlock_dcache()
#endif
/****************************************************************************
* Name: up_unlock_dcache_all
*
* Description:
* Unlock the entire contents of data cache.
*
* Input Parameters:
* None
*
* Returned Value:
* None
*
****************************************************************************/
#ifdef CONFIG_ARCH_DCACHE_LOCK
void up_unlock_dcache_all(void);
#else
# define up_unlock_dcache_all()
#endif
/****************************************************************************
* Name: up_coherent_dcache
*