Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
[cris-mirror.git] / arch / score / include / asm / fixmap.h
blob68ca314830c97cf603814845a739ac9605bacdca
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_SCORE_FIXMAP_H
3 #define _ASM_SCORE_FIXMAP_H
5 #include <asm/page.h>
7 #define PHY_RAM_BASE 0x00000000
8 #define PHY_IO_BASE 0x10000000
10 #define VIRTUAL_RAM_BASE 0xa0000000
11 #define VIRTUAL_IO_BASE 0xb0000000
13 #define RAM_SPACE_SIZE 0x10000000
14 #define IO_SPACE_SIZE 0x10000000
16 /* Kernel unmapped, cached 512MB */
17 #define KSEG1 0xa0000000
20 * Here we define all the compile-time 'special' virtual
21 * addresses. The point is to have a constant address at
22 * compile time, but to set the physical address only
23 * in the boot process. We allocate these special addresses
24 * from the end of virtual memory (0xfffff000) backwards.
25 * Also this lets us do fail-safe vmalloc(), we
26 * can guarantee that these special addresses and
27 * vmalloc()-ed addresses never overlap.
29 * these 'compile-time allocated' memory buffers are
30 * fixed-size 4k pages. (or larger if used with an increment
31 * highger than 1) use fixmap_set(idx,phys) to associate
32 * physical memory with fixmap indices.
34 * TLB entries of such buffers will not be flushed across
35 * task switches.
39 * on UP currently we will have no trace of the fixmap mechanizm,
40 * no page table allocations, etc. This might change in the
41 * future, say framebuffers for the console driver(s) could be
42 * fix-mapped?
44 enum fixed_addresses {
45 #define FIX_N_COLOURS 8
46 FIX_CMAP_BEGIN,
47 FIX_CMAP_END = FIX_CMAP_BEGIN + FIX_N_COLOURS,
48 __end_of_fixed_addresses
52 * used by vmalloc.c.
54 * Leave one empty page between vmalloc'ed areas and
55 * the start of the fixmap, and leave one page empty
56 * at the top of mem..
58 #define FIXADDR_TOP ((unsigned long)(long)(int)0xfefe0000)
59 #define FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT)
60 #define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE)
62 #define __fix_to_virt(x) (FIXADDR_TOP - ((x) << PAGE_SHIFT))
63 #define __virt_to_fix(x) \
64 ((FIXADDR_TOP - ((x) & PAGE_MASK)) >> PAGE_SHIFT)
66 extern void __this_fixmap_does_not_exist(void);
69 * 'index to address' translation. If anyone tries to use the idx
70 * directly without tranlation, we catch the bug with a NULL-deference
71 * kernel oops. Illegal ranges of incoming indices are caught too.
73 static inline unsigned long fix_to_virt(const unsigned int idx)
75 return __fix_to_virt(idx);
78 static inline unsigned long virt_to_fix(const unsigned long vaddr)
80 return __virt_to_fix(vaddr);
83 #endif /* _ASM_SCORE_FIXMAP_H */