/src/barebox/include/mmu.h
Line | Count | Source |
1 | | /* SPDX-License-Identifier: GPL-2.0-only */ |
2 | | #ifndef __MMU_H |
3 | | #define __MMU_H |
4 | | |
5 | | #include <linux/types.h> |
6 | | #include <errno.h> |
7 | | |
8 | 0 | #define MAP_UNCACHED 0 |
9 | 0 | #define MAP_CACHED 1 |
10 | | #define MAP_FAULT 2 |
11 | 0 | #define MAP_CODE 3 |
12 | | #define MAP_CACHED_RO 4 |
13 | | #define MAP_CACHED_RWX 6 |
14 | | |
15 | | #ifdef CONFIG_ARCH_HAS_DMA_WRITE_COMBINE |
16 | | #define MAP_WRITECOMBINE 5 |
17 | | #else |
18 | | #define MAP_WRITECOMBINE MAP_UNCACHED |
19 | | #endif |
20 | | |
21 | 0 | #define MAP_TYPE_MASK 0xFFFF |
22 | | #define MAP_ARCH(x) ((u16)~(x)) |
23 | | |
24 | | /* |
25 | | * Depending on the architecture the default mapping can be |
26 | | * cached or uncached. Without ARCH_HAS_REMAP being set this |
27 | | * is mapping type is the only one supported. |
28 | | */ |
29 | 0 | #define MAP_DEFAULT MAP_ARCH_DEFAULT |
30 | | |
31 | | #include <asm/mmu.h> |
32 | | #include <asm/io.h> |
33 | | |
34 | | static inline bool maptype_is_compatible(maptype_t active, maptype_t check) |
35 | 0 | { |
36 | 0 | active &= MAP_TYPE_MASK; |
37 | 0 | check &= MAP_TYPE_MASK; |
38 | |
|
39 | 0 | if (active == check) |
40 | 0 | return true; |
41 | 0 | if (active == MAP_CODE && check == MAP_CACHED) |
42 | 0 | return true; |
43 | | |
44 | 0 | return false; |
45 | 0 | } Unexecuted instantiation: memory.c:maptype_is_compatible Unexecuted instantiation: memtest.c:maptype_is_compatible Unexecuted instantiation: spi.c:maptype_is_compatible Unexecuted instantiation: at24.c:maptype_is_compatible Unexecuted instantiation: core.c:maptype_is_compatible Unexecuted instantiation: regmap.c:maptype_is_compatible Unexecuted instantiation: partition.c:maptype_is_compatible Unexecuted instantiation: layouts.c:maptype_is_compatible Unexecuted instantiation: rmem.c:maptype_is_compatible Unexecuted instantiation: platform.c:maptype_is_compatible Unexecuted instantiation: rtc-lib.c:maptype_is_compatible Unexecuted instantiation: class.c:maptype_is_compatible Unexecuted instantiation: nvmem.c:maptype_is_compatible Unexecuted instantiation: rtc-ds1307.c:maptype_is_compatible Unexecuted instantiation: bfetch.c:maptype_is_compatible Unexecuted instantiation: hwclock.c:maptype_is_compatible |
46 | | |
47 | | #ifndef ARCH_HAS_REMAP |
48 | | static inline int arch_remap_range(void *virt_addr, phys_addr_t phys_addr, |
49 | | size_t size, maptype_t map_type) |
50 | 0 | { |
51 | 0 | if (maptype_is_compatible(map_type, MAP_ARCH_DEFAULT) && |
52 | 0 | phys_addr == virt_to_phys(virt_addr)) |
53 | 0 | return 0; |
54 | | |
55 | 0 | return -EINVAL; |
56 | 0 | } Unexecuted instantiation: memory.c:arch_remap_range Unexecuted instantiation: memtest.c:arch_remap_range Unexecuted instantiation: spi.c:arch_remap_range Unexecuted instantiation: at24.c:arch_remap_range Unexecuted instantiation: core.c:arch_remap_range Unexecuted instantiation: regmap.c:arch_remap_range Unexecuted instantiation: partition.c:arch_remap_range Unexecuted instantiation: layouts.c:arch_remap_range Unexecuted instantiation: rmem.c:arch_remap_range Unexecuted instantiation: platform.c:arch_remap_range Unexecuted instantiation: rtc-lib.c:arch_remap_range Unexecuted instantiation: class.c:arch_remap_range Unexecuted instantiation: nvmem.c:arch_remap_range Unexecuted instantiation: rtc-ds1307.c:arch_remap_range Unexecuted instantiation: bfetch.c:arch_remap_range Unexecuted instantiation: hwclock.c:arch_remap_range |
57 | | |
58 | | static inline bool arch_can_remap(void) |
59 | 0 | { |
60 | 0 | return false; |
61 | 0 | } Unexecuted instantiation: memory.c:arch_can_remap Unexecuted instantiation: memtest.c:arch_can_remap Unexecuted instantiation: spi.c:arch_can_remap Unexecuted instantiation: at24.c:arch_can_remap Unexecuted instantiation: core.c:arch_can_remap Unexecuted instantiation: regmap.c:arch_can_remap Unexecuted instantiation: partition.c:arch_can_remap Unexecuted instantiation: layouts.c:arch_can_remap Unexecuted instantiation: rmem.c:arch_can_remap Unexecuted instantiation: platform.c:arch_can_remap Unexecuted instantiation: rtc-lib.c:arch_can_remap Unexecuted instantiation: class.c:arch_can_remap Unexecuted instantiation: nvmem.c:arch_can_remap Unexecuted instantiation: rtc-ds1307.c:arch_can_remap Unexecuted instantiation: bfetch.c:arch_can_remap Unexecuted instantiation: hwclock.c:arch_can_remap |
62 | | #else |
63 | | static inline bool arch_can_remap(void) |
64 | | { |
65 | | return true; |
66 | | } |
67 | | #endif |
68 | | |
69 | | static inline int remap_range(void *start, size_t size, maptype_t map_type) |
70 | 0 | { |
71 | 0 | return arch_remap_range(start, virt_to_phys(start), size, map_type); |
72 | 0 | } Unexecuted instantiation: memory.c:remap_range Unexecuted instantiation: memtest.c:remap_range Unexecuted instantiation: spi.c:remap_range Unexecuted instantiation: at24.c:remap_range Unexecuted instantiation: core.c:remap_range Unexecuted instantiation: regmap.c:remap_range Unexecuted instantiation: partition.c:remap_range Unexecuted instantiation: layouts.c:remap_range Unexecuted instantiation: rmem.c:remap_range Unexecuted instantiation: platform.c:remap_range Unexecuted instantiation: rtc-lib.c:remap_range Unexecuted instantiation: class.c:remap_range Unexecuted instantiation: nvmem.c:remap_range Unexecuted instantiation: rtc-ds1307.c:remap_range Unexecuted instantiation: bfetch.c:remap_range Unexecuted instantiation: hwclock.c:remap_range |
73 | | |
74 | | #ifdef CONFIG_MMUINFO |
75 | | int mmuinfo(void *addr); |
76 | | #else |
77 | | static inline int mmuinfo(void *addr) |
78 | 0 | { |
79 | 0 | return -ENOSYS; |
80 | 0 | } Unexecuted instantiation: memory.c:mmuinfo Unexecuted instantiation: memtest.c:mmuinfo Unexecuted instantiation: spi.c:mmuinfo Unexecuted instantiation: at24.c:mmuinfo Unexecuted instantiation: core.c:mmuinfo Unexecuted instantiation: regmap.c:mmuinfo Unexecuted instantiation: partition.c:mmuinfo Unexecuted instantiation: layouts.c:mmuinfo Unexecuted instantiation: rmem.c:mmuinfo Unexecuted instantiation: platform.c:mmuinfo Unexecuted instantiation: rtc-lib.c:mmuinfo Unexecuted instantiation: class.c:mmuinfo Unexecuted instantiation: nvmem.c:mmuinfo Unexecuted instantiation: rtc-ds1307.c:mmuinfo Unexecuted instantiation: bfetch.c:mmuinfo Unexecuted instantiation: hwclock.c:mmuinfo |
81 | | #endif |
82 | | |
83 | | #endif |