Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
awilliam
GitHub Repository: awilliam/linux-vfio
Path: blob/master/arch/score/include/asm/fixmap.h
10819 views
1
#ifndef _ASM_SCORE_FIXMAP_H
2
#define _ASM_SCORE_FIXMAP_H
3
4
#include <asm/page.h>
5
6
#define PHY_RAM_BASE 0x00000000
7
#define PHY_IO_BASE 0x10000000
8
9
#define VIRTUAL_RAM_BASE 0xa0000000
10
#define VIRTUAL_IO_BASE 0xb0000000
11
12
#define RAM_SPACE_SIZE 0x10000000
13
#define IO_SPACE_SIZE 0x10000000
14
15
/* Kernel unmapped, cached 512MB */
16
#define KSEG1 0xa0000000
17
18
/*
19
* Here we define all the compile-time 'special' virtual
20
* addresses. The point is to have a constant address at
21
* compile time, but to set the physical address only
22
* in the boot process. We allocate these special addresses
23
* from the end of virtual memory (0xfffff000) backwards.
24
* Also this lets us do fail-safe vmalloc(), we
25
* can guarantee that these special addresses and
26
* vmalloc()-ed addresses never overlap.
27
*
28
* these 'compile-time allocated' memory buffers are
29
* fixed-size 4k pages. (or larger if used with an increment
30
* highger than 1) use fixmap_set(idx,phys) to associate
31
* physical memory with fixmap indices.
32
*
33
* TLB entries of such buffers will not be flushed across
34
* task switches.
35
*/
36
37
/*
38
* on UP currently we will have no trace of the fixmap mechanizm,
39
* no page table allocations, etc. This might change in the
40
* future, say framebuffers for the console driver(s) could be
41
* fix-mapped?
42
*/
43
enum fixed_addresses {
44
#define FIX_N_COLOURS 8
45
FIX_CMAP_BEGIN,
46
FIX_CMAP_END = FIX_CMAP_BEGIN + FIX_N_COLOURS,
47
__end_of_fixed_addresses
48
};
49
50
/*
51
* used by vmalloc.c.
52
*
53
* Leave one empty page between vmalloc'ed areas and
54
* the start of the fixmap, and leave one page empty
55
* at the top of mem..
56
*/
57
#define FIXADDR_TOP ((unsigned long)(long)(int)0xfefe0000)
58
#define FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT)
59
#define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE)
60
61
#define __fix_to_virt(x) (FIXADDR_TOP - ((x) << PAGE_SHIFT))
62
#define __virt_to_fix(x) \
63
((FIXADDR_TOP - ((x) & PAGE_MASK)) >> PAGE_SHIFT)
64
65
extern void __this_fixmap_does_not_exist(void);
66
67
/*
68
* 'index to address' translation. If anyone tries to use the idx
69
* directly without tranlation, we catch the bug with a NULL-deference
70
* kernel oops. Illegal ranges of incoming indices are caught too.
71
*/
72
static inline unsigned long fix_to_virt(const unsigned int idx)
73
{
74
return __fix_to_virt(idx);
75
}
76
77
static inline unsigned long virt_to_fix(const unsigned long vaddr)
78
{
79
return __virt_to_fix(vaddr);
80
}
81
82
#endif /* _ASM_SCORE_FIXMAP_H */
83
84