diff options
author | Mark Salter <msalter@redhat.com> | 2014-01-23 18:53:57 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-01-23 19:36:54 -0500 |
commit | 8b49233fd7a733fddd9050c0f67f3c8b9056cc34 (patch) | |
tree | cc243f2a10b3ba5eae289bfea2a832342f58211c /arch/tile/include/asm | |
parent | 083f7ba834c09ed9b3904bf2168c378c5550c970 (diff) |
tile: use generic fixmap.h
Signed-off-by: Mark Salter <msalter@redhat.com>
Acked-by: Chris Metcalf <cmetcalf@tilera.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/tile/include/asm')
-rw-r--r-- | arch/tile/include/asm/fixmap.h | 33 |
1 files changed, 1 insertions, 32 deletions
diff --git a/arch/tile/include/asm/fixmap.h b/arch/tile/include/asm/fixmap.h index c6b9c1b38fd1..ffe2637aeb31 100644 --- a/arch/tile/include/asm/fixmap.h +++ b/arch/tile/include/asm/fixmap.h | |||
@@ -25,9 +25,6 @@ | |||
25 | #include <asm/kmap_types.h> | 25 | #include <asm/kmap_types.h> |
26 | #endif | 26 | #endif |
27 | 27 | ||
28 | #define __fix_to_virt(x) (FIXADDR_TOP - ((x) << PAGE_SHIFT)) | ||
29 | #define __virt_to_fix(x) ((FIXADDR_TOP - ((x)&PAGE_MASK)) >> PAGE_SHIFT) | ||
30 | |||
31 | /* | 28 | /* |
32 | * Here we define all the compile-time 'special' virtual | 29 | * Here we define all the compile-time 'special' virtual |
33 | * addresses. The point is to have a constant address at | 30 | * addresses. The point is to have a constant address at |
@@ -83,35 +80,7 @@ enum fixed_addresses { | |||
83 | #define FIXADDR_START (FIXADDR_TOP + PAGE_SIZE - __FIXADDR_SIZE) | 80 | #define FIXADDR_START (FIXADDR_TOP + PAGE_SIZE - __FIXADDR_SIZE) |
84 | #define FIXADDR_BOOT_START (FIXADDR_TOP + PAGE_SIZE - __FIXADDR_BOOT_SIZE) | 81 | #define FIXADDR_BOOT_START (FIXADDR_TOP + PAGE_SIZE - __FIXADDR_BOOT_SIZE) |
85 | 82 | ||
86 | extern void __this_fixmap_does_not_exist(void); | 83 | #include <asm-generic/fixmap.h> |
87 | |||
88 | /* | ||
89 | * 'index to address' translation. If anyone tries to use the idx | ||
90 | * directly without tranlation, we catch the bug with a NULL-deference | ||
91 | * kernel oops. Illegal ranges of incoming indices are caught too. | ||
92 | */ | ||
93 | static __always_inline unsigned long fix_to_virt(const unsigned int idx) | ||
94 | { | ||
95 | /* | ||
96 | * this branch gets completely eliminated after inlining, | ||
97 | * except when someone tries to use fixaddr indices in an | ||
98 | * illegal way. (such as mixing up address types or using | ||
99 | * out-of-range indices). | ||
100 | * | ||
101 | * If it doesn't get removed, the linker will complain | ||
102 | * loudly with a reasonably clear error message.. | ||
103 | */ | ||
104 | if (idx >= __end_of_fixed_addresses) | ||
105 | __this_fixmap_does_not_exist(); | ||
106 | |||
107 | return __fix_to_virt(idx); | ||
108 | } | ||
109 | |||
110 | static inline unsigned long virt_to_fix(const unsigned long vaddr) | ||
111 | { | ||
112 | BUG_ON(vaddr >= FIXADDR_TOP || vaddr < FIXADDR_START); | ||
113 | return __virt_to_fix(vaddr); | ||
114 | } | ||
115 | 84 | ||
116 | #endif /* !__ASSEMBLY__ */ | 85 | #endif /* !__ASSEMBLY__ */ |
117 | 86 | ||