diff options
author | Jeremy Fitzhardinge <jeremy@goop.org> | 2008-06-17 14:41:49 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-06-20 09:09:49 -0400 |
commit | 944256e00a5466ae6b7a11fdb3a47d092f2f62c1 (patch) | |
tree | 194a04e1e5a51a646aaed197cb8514e857c7049f /include/asm-x86 | |
parent | 9bedbcb207ed9a571b239231d99c8fd4a34ae24d (diff) |
x86: unify asm-x86/fixmap*.h
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include/asm-x86')
-rw-r--r-- | include/asm-x86/fixmap.h | 43 | ||||
-rw-r--r-- | include/asm-x86/fixmap_32.h | 42 | ||||
-rw-r--r-- | include/asm-x86/fixmap_64.h | 37 |
3 files changed, 43 insertions, 79 deletions
diff --git a/include/asm-x86/fixmap.h b/include/asm-x86/fixmap.h index 5bd206973dca..01b0f98f9929 100644 --- a/include/asm-x86/fixmap.h +++ b/include/asm-x86/fixmap.h | |||
@@ -7,7 +7,50 @@ | |||
7 | # include "fixmap_64.h" | 7 | # include "fixmap_64.h" |
8 | #endif | 8 | #endif |
9 | 9 | ||
10 | extern void __set_fixmap(enum fixed_addresses idx, | ||
11 | unsigned long phys, pgprot_t flags); | ||
12 | #define set_fixmap(idx, phys) \ | ||
13 | __set_fixmap(idx, phys, PAGE_KERNEL) | ||
14 | |||
15 | /* | ||
16 | * Some hardware wants to get fixmapped without caching. | ||
17 | */ | ||
18 | #define set_fixmap_nocache(idx, phys) \ | ||
19 | __set_fixmap(idx, phys, PAGE_KERNEL_NOCACHE) | ||
20 | |||
10 | #define clear_fixmap(idx) \ | 21 | #define clear_fixmap(idx) \ |
11 | __set_fixmap(idx, 0, __pgprot(0)) | 22 | __set_fixmap(idx, 0, __pgprot(0)) |
12 | 23 | ||
24 | #define __fix_to_virt(x) (FIXADDR_TOP - ((x) << PAGE_SHIFT)) | ||
25 | #define __virt_to_fix(x) ((FIXADDR_TOP - ((x)&PAGE_MASK)) >> PAGE_SHIFT) | ||
26 | |||
27 | extern void __this_fixmap_does_not_exist(void); | ||
28 | |||
29 | /* | ||
30 | * 'index to address' translation. If anyone tries to use the idx | ||
31 | * directly without translation, we catch the bug with a NULL-deference | ||
32 | * kernel oops. Illegal ranges of incoming indices are caught too. | ||
33 | */ | ||
34 | static __always_inline unsigned long fix_to_virt(const unsigned int idx) | ||
35 | { | ||
36 | /* | ||
37 | * this branch gets completely eliminated after inlining, | ||
38 | * except when someone tries to use fixaddr indices in an | ||
39 | * illegal way. (such as mixing up address types or using | ||
40 | * out-of-range indices). | ||
41 | * | ||
42 | * If it doesn't get removed, the linker will complain | ||
43 | * loudly with a reasonably clear error message.. | ||
44 | */ | ||
45 | if (idx >= __end_of_fixed_addresses) | ||
46 | __this_fixmap_does_not_exist(); | ||
47 | |||
48 | return __fix_to_virt(idx); | ||
49 | } | ||
50 | |||
51 | static inline unsigned long virt_to_fix(const unsigned long vaddr) | ||
52 | { | ||
53 | BUG_ON(vaddr >= FIXADDR_TOP || vaddr < FIXADDR_START); | ||
54 | return __virt_to_fix(vaddr); | ||
55 | } | ||
13 | #endif | 56 | #endif |
diff --git a/include/asm-x86/fixmap_32.h b/include/asm-x86/fixmap_32.h index 4b96148e90c1..3a94115952ff 100644 --- a/include/asm-x86/fixmap_32.h +++ b/include/asm-x86/fixmap_32.h | |||
@@ -109,17 +109,8 @@ enum fixed_addresses { | |||
109 | __end_of_fixed_addresses | 109 | __end_of_fixed_addresses |
110 | }; | 110 | }; |
111 | 111 | ||
112 | extern void __set_fixmap(enum fixed_addresses idx, | ||
113 | unsigned long phys, pgprot_t flags); | ||
114 | extern void reserve_top_address(unsigned long reserve); | 112 | extern void reserve_top_address(unsigned long reserve); |
115 | 113 | ||
116 | #define set_fixmap(idx, phys) \ | ||
117 | __set_fixmap(idx, phys, PAGE_KERNEL) | ||
118 | /* | ||
119 | * Some hardware wants to get fixmapped without caching. | ||
120 | */ | ||
121 | #define set_fixmap_nocache(idx, phys) \ | ||
122 | __set_fixmap(idx, phys, PAGE_KERNEL_NOCACHE) | ||
123 | 114 | ||
124 | #define FIXADDR_TOP ((unsigned long)__FIXADDR_TOP) | 115 | #define FIXADDR_TOP ((unsigned long)__FIXADDR_TOP) |
125 | 116 | ||
@@ -128,38 +119,5 @@ extern void reserve_top_address(unsigned long reserve); | |||
128 | #define FIXADDR_START (FIXADDR_TOP - __FIXADDR_SIZE) | 119 | #define FIXADDR_START (FIXADDR_TOP - __FIXADDR_SIZE) |
129 | #define FIXADDR_BOOT_START (FIXADDR_TOP - __FIXADDR_BOOT_SIZE) | 120 | #define FIXADDR_BOOT_START (FIXADDR_TOP - __FIXADDR_BOOT_SIZE) |
130 | 121 | ||
131 | #define __fix_to_virt(x) (FIXADDR_TOP - ((x) << PAGE_SHIFT)) | ||
132 | #define __virt_to_fix(x) ((FIXADDR_TOP - ((x)&PAGE_MASK)) >> PAGE_SHIFT) | ||
133 | |||
134 | extern void __this_fixmap_does_not_exist(void); | ||
135 | |||
136 | /* | ||
137 | * 'index to address' translation. If anyone tries to use the idx | ||
138 | * directly without tranlation, we catch the bug with a NULL-deference | ||
139 | * kernel oops. Illegal ranges of incoming indices are caught too. | ||
140 | */ | ||
141 | static __always_inline unsigned long fix_to_virt(const unsigned int idx) | ||
142 | { | ||
143 | /* | ||
144 | * this branch gets completely eliminated after inlining, | ||
145 | * except when someone tries to use fixaddr indices in an | ||
146 | * illegal way. (such as mixing up address types or using | ||
147 | * out-of-range indices). | ||
148 | * | ||
149 | * If it doesn't get removed, the linker will complain | ||
150 | * loudly with a reasonably clear error message.. | ||
151 | */ | ||
152 | if (idx >= __end_of_fixed_addresses) | ||
153 | __this_fixmap_does_not_exist(); | ||
154 | |||
155 | return __fix_to_virt(idx); | ||
156 | } | ||
157 | |||
158 | static inline unsigned long virt_to_fix(const unsigned long vaddr) | ||
159 | { | ||
160 | BUG_ON(vaddr >= FIXADDR_TOP || vaddr < FIXADDR_START); | ||
161 | return __virt_to_fix(vaddr); | ||
162 | } | ||
163 | |||
164 | #endif /* !__ASSEMBLY__ */ | 122 | #endif /* !__ASSEMBLY__ */ |
165 | #endif | 123 | #endif |
diff --git a/include/asm-x86/fixmap_64.h b/include/asm-x86/fixmap_64.h index 355d26a75a82..626098823a0c 100644 --- a/include/asm-x86/fixmap_64.h +++ b/include/asm-x86/fixmap_64.h | |||
@@ -52,17 +52,6 @@ enum fixed_addresses { | |||
52 | __end_of_fixed_addresses | 52 | __end_of_fixed_addresses |
53 | }; | 53 | }; |
54 | 54 | ||
55 | extern void __set_fixmap(enum fixed_addresses idx, | ||
56 | unsigned long phys, pgprot_t flags); | ||
57 | |||
58 | #define set_fixmap(idx, phys) \ | ||
59 | __set_fixmap(idx, phys, PAGE_KERNEL) | ||
60 | /* | ||
61 | * Some hardware wants to get fixmapped without caching. | ||
62 | */ | ||
63 | #define set_fixmap_nocache(idx, phys) \ | ||
64 | __set_fixmap(idx, phys, PAGE_KERNEL_NOCACHE) | ||
65 | |||
66 | #define FIXADDR_TOP (VSYSCALL_END-PAGE_SIZE) | 55 | #define FIXADDR_TOP (VSYSCALL_END-PAGE_SIZE) |
67 | #define FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT) | 56 | #define FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT) |
68 | #define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE) | 57 | #define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE) |
@@ -71,30 +60,4 @@ extern void __set_fixmap(enum fixed_addresses idx, | |||
71 | #define FIXADDR_USER_START ((unsigned long)VSYSCALL32_VSYSCALL) | 60 | #define FIXADDR_USER_START ((unsigned long)VSYSCALL32_VSYSCALL) |
72 | #define FIXADDR_USER_END (FIXADDR_USER_START + PAGE_SIZE) | 61 | #define FIXADDR_USER_END (FIXADDR_USER_START + PAGE_SIZE) |
73 | 62 | ||
74 | #define __fix_to_virt(x) (FIXADDR_TOP - ((x) << PAGE_SHIFT)) | ||
75 | |||
76 | extern void __this_fixmap_does_not_exist(void); | ||
77 | |||
78 | /* | ||
79 | * 'index to address' translation. If anyone tries to use the idx | ||
80 | * directly without translation, we catch the bug with a NULL-deference | ||
81 | * kernel oops. Illegal ranges of incoming indices are caught too. | ||
82 | */ | ||
83 | static __always_inline unsigned long fix_to_virt(const unsigned int idx) | ||
84 | { | ||
85 | /* | ||
86 | * this branch gets completely eliminated after inlining, | ||
87 | * except when someone tries to use fixaddr indices in an | ||
88 | * illegal way. (such as mixing up address types or using | ||
89 | * out-of-range indices). | ||
90 | * | ||
91 | * If it doesn't get removed, the linker will complain | ||
92 | * loudly with a reasonably clear error message.. | ||
93 | */ | ||
94 | if (idx >= __end_of_fixed_addresses) | ||
95 | __this_fixmap_does_not_exist(); | ||
96 | |||
97 | return __fix_to_virt(idx); | ||
98 | } | ||
99 | |||
100 | #endif | 63 | #endif |