]>
Commit | Line | Data |
---|---|---|
b2441318 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
6bc9a396 CL |
2 | #ifndef _ASM_SCORE_FIXMAP_H |
3 | #define _ASM_SCORE_FIXMAP_H | |
4 | ||
5 | #include <asm/page.h> | |
6 | ||
7 | #define PHY_RAM_BASE 0x00000000 | |
8 | #define PHY_IO_BASE 0x10000000 | |
9 | ||
10 | #define VIRTUAL_RAM_BASE 0xa0000000 | |
11 | #define VIRTUAL_IO_BASE 0xb0000000 | |
12 | ||
13 | #define RAM_SPACE_SIZE 0x10000000 | |
14 | #define IO_SPACE_SIZE 0x10000000 | |
15 | ||
16 | /* Kernel unmapped, cached 512MB */ | |
17 | #define KSEG1 0xa0000000 | |
18 | ||
19 | /* | |
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. | |
28 | * | |
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. | |
33 | * | |
34 | * TLB entries of such buffers will not be flushed across | |
35 | * task switches. | |
36 | */ | |
37 | ||
38 | /* | |
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? | |
43 | */ | |
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 | |
49 | }; | |
50 | ||
51 | /* | |
52 | * used by vmalloc.c. | |
53 | * | |
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.. | |
57 | */ | |
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) | |
61 | ||
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) | |
65 | ||
66 | extern void __this_fixmap_does_not_exist(void); | |
67 | ||
68 | /* | |
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. | |
72 | */ | |
73 | static inline unsigned long fix_to_virt(const unsigned int idx) | |
74 | { | |
75 | return __fix_to_virt(idx); | |
76 | } | |
77 | ||
78 | static inline unsigned long virt_to_fix(const unsigned long vaddr) | |
79 | { | |
80 | return __virt_to_fix(vaddr); | |
81 | } | |
82 | ||
83 | #endif /* _ASM_SCORE_FIXMAP_H */ |