remap_range is for remapping regions with different cache attributes. It is implemented for ARM and PowerPC only, the other architectures only provide stubs. Currently the new cache attributes are passed in an architecture specific way and the attributes have to be retrieved by calls to mmu_get_pte_cached_flags() and mmu_get_pte_uncached_flags(). Make this simpler by providing architecture independent flags which can be directly passed to remap_range() Also provide a MAP_ARCH_DEFAULT flag and a arch_can_remap() function. The MAP_ARCH_DEFAULT defaults to whatever caching type the architecture has as default. the arch_can_remap() function returns true if the architecture can change the cache attributes, false otherwise. This allows the memtest code to better find out what it has to do. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
42 lines
740 B
C
42 lines
740 B
C
#ifndef __MMU_H
|
|
#define __MMU_H
|
|
|
|
#define MAP_UNCACHED 0
|
|
#define MAP_CACHED 1
|
|
|
|
/*
|
|
* Depending on the architecture the default mapping can be
|
|
* cached or uncached. Without ARCH_HAS_REMAP being set this
|
|
* is mapping type is the only one supported.
|
|
*/
|
|
#define MAP_DEFAULT MAP_ARCH_DEFAULT
|
|
|
|
#include <asm/mmu.h>
|
|
|
|
#ifndef ARCH_HAS_REMAP
|
|
static inline int arch_remap_range(void *start, size_t size, unsigned flags)
|
|
{
|
|
if (flags == MAP_ARCH_DEFAULT)
|
|
return 0;
|
|
|
|
return -EINVAL;
|
|
}
|
|
|
|
static inline bool arch_can_remap(void)
|
|
{
|
|
return false;
|
|
}
|
|
#else
|
|
static inline bool arch_can_remap(void)
|
|
{
|
|
return true;
|
|
}
|
|
#endif
|
|
|
|
static inline int remap_range(void *start, size_t size, unsigned flags)
|
|
{
|
|
return arch_remap_range(start, size, flags);
|
|
}
|
|
|
|
#endif
|