summaryrefslogtreecommitdiff
path: root/include/mmu.h
blob: 2e23853df353cd352ce56be91e298a7663940677 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/* SPDX-License-Identifier: GPL-2.0-only */
#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