diff options
author | Mark Salter <msalter@redhat.com> | 2014-01-23 18:53:55 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-01-23 19:36:54 -0500 |
commit | 9494a1e8428ea8e60ae77b221b9d32a5edc21ef4 (patch) | |
tree | 65f8f0daddb39e78dc115324dd4e975f20e8dd35 /arch/powerpc/include/asm/fixmap.h | |
parent | 19fd9629a72e6e9f35b7f4d7f5bb2d794a8ab4c7 (diff) |
powerpc: use generic fixmap.h
Signed-off-by: Mark Salter <msalter@redhat.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/powerpc/include/asm/fixmap.h')
-rw-r--r-- | arch/powerpc/include/asm/fixmap.h | 44 |
1 files changed, 2 insertions, 42 deletions
diff --git a/arch/powerpc/include/asm/fixmap.h b/arch/powerpc/include/asm/fixmap.h index 5c2c0233175e..90f604bbcd19 100644 --- a/arch/powerpc/include/asm/fixmap.h +++ b/arch/powerpc/include/asm/fixmap.h | |||
@@ -58,52 +58,12 @@ enum fixed_addresses { | |||
58 | extern void __set_fixmap (enum fixed_addresses idx, | 58 | extern void __set_fixmap (enum fixed_addresses idx, |
59 | phys_addr_t phys, pgprot_t flags); | 59 | phys_addr_t phys, pgprot_t flags); |
60 | 60 | ||
61 | #define set_fixmap(idx, phys) \ | ||
62 | __set_fixmap(idx, phys, PAGE_KERNEL) | ||
63 | /* | ||
64 | * Some hardware wants to get fixmapped without caching. | ||
65 | */ | ||
66 | #define set_fixmap_nocache(idx, phys) \ | ||
67 | __set_fixmap(idx, phys, PAGE_KERNEL_NCG) | ||
68 | |||
69 | #define clear_fixmap(idx) \ | ||
70 | __set_fixmap(idx, 0, __pgprot(0)) | ||
71 | |||
72 | #define __FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT) | 61 | #define __FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT) |
73 | #define FIXADDR_START (FIXADDR_TOP - __FIXADDR_SIZE) | 62 | #define FIXADDR_START (FIXADDR_TOP - __FIXADDR_SIZE) |
74 | 63 | ||
75 | #define __fix_to_virt(x) (FIXADDR_TOP - ((x) << PAGE_SHIFT)) | 64 | #define FIXMAP_PAGE_NOCACHE PAGE_KERNEL_NCG |
76 | #define __virt_to_fix(x) ((FIXADDR_TOP - ((x)&PAGE_MASK)) >> PAGE_SHIFT) | ||
77 | |||
78 | extern void __this_fixmap_does_not_exist(void); | ||
79 | |||
80 | /* | ||
81 | * 'index to address' translation. If anyone tries to use the idx | ||
82 | * directly without tranlation, we catch the bug with a NULL-deference | ||
83 | * kernel oops. Illegal ranges of incoming indices are caught too. | ||
84 | */ | ||
85 | static __always_inline unsigned long fix_to_virt(const unsigned int idx) | ||
86 | { | ||
87 | /* | ||
88 | * this branch gets completely eliminated after inlining, | ||
89 | * except when someone tries to use fixaddr indices in an | ||
90 | * illegal way. (such as mixing up address types or using | ||
91 | * out-of-range indices). | ||
92 | * | ||
93 | * If it doesn't get removed, the linker will complain | ||
94 | * loudly with a reasonably clear error message.. | ||
95 | */ | ||
96 | if (idx >= __end_of_fixed_addresses) | ||
97 | __this_fixmap_does_not_exist(); | ||
98 | |||
99 | return __fix_to_virt(idx); | ||
100 | } | ||
101 | 65 | ||
102 | static inline unsigned long virt_to_fix(const unsigned long vaddr) | 66 | #include <asm-generic/fixmap.h> |
103 | { | ||
104 | BUG_ON(vaddr >= FIXADDR_TOP || vaddr < FIXADDR_START); | ||
105 | return __virt_to_fix(vaddr); | ||
106 | } | ||
107 | 67 | ||
108 | #endif /* !__ASSEMBLY__ */ | 68 | #endif /* !__ASSEMBLY__ */ |
109 | #endif | 69 | #endif |