diff options
Diffstat (limited to 'arch/sh/mm/pg-sh4.c')
-rw-r--r-- | arch/sh/mm/pg-sh4.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/arch/sh/mm/pg-sh4.c b/arch/sh/mm/pg-sh4.c index 38870e0fc182..2fe14da1f839 100644 --- a/arch/sh/mm/pg-sh4.c +++ b/arch/sh/mm/pg-sh4.c | |||
@@ -7,6 +7,7 @@ | |||
7 | * Released under the terms of the GNU GPL v2.0. | 7 | * Released under the terms of the GNU GPL v2.0. |
8 | */ | 8 | */ |
9 | #include <linux/mm.h> | 9 | #include <linux/mm.h> |
10 | #include <linux/init.h> | ||
10 | #include <linux/mutex.h> | 11 | #include <linux/mutex.h> |
11 | #include <linux/fs.h> | 12 | #include <linux/fs.h> |
12 | #include <linux/highmem.h> | 13 | #include <linux/highmem.h> |
@@ -16,6 +17,20 @@ | |||
16 | 17 | ||
17 | #define CACHE_ALIAS (current_cpu_data.dcache.alias_mask) | 18 | #define CACHE_ALIAS (current_cpu_data.dcache.alias_mask) |
18 | 19 | ||
20 | #define kmap_get_fixmap_pte(vaddr) \ | ||
21 | pte_offset_kernel(pmd_offset(pud_offset(pgd_offset_k(vaddr), (vaddr)), (vaddr)), (vaddr)) | ||
22 | |||
23 | static pte_t *kmap_coherent_pte; | ||
24 | |||
25 | void __init kmap_coherent_init(void) | ||
26 | { | ||
27 | unsigned long vaddr; | ||
28 | |||
29 | /* cache the first coherent kmap pte */ | ||
30 | vaddr = __fix_to_virt(FIX_CMAP_BEGIN); | ||
31 | kmap_coherent_pte = kmap_get_fixmap_pte(vaddr); | ||
32 | } | ||
33 | |||
19 | static inline void *kmap_coherent(struct page *page, unsigned long addr) | 34 | static inline void *kmap_coherent(struct page *page, unsigned long addr) |
20 | { | 35 | { |
21 | enum fixed_addresses idx; | 36 | enum fixed_addresses idx; |
@@ -34,6 +49,8 @@ static inline void *kmap_coherent(struct page *page, unsigned long addr) | |||
34 | 49 | ||
35 | update_mmu_cache(NULL, vaddr, pte); | 50 | update_mmu_cache(NULL, vaddr, pte); |
36 | 51 | ||
52 | set_pte(kmap_coherent_pte - (FIX_CMAP_END - idx), pte); | ||
53 | |||
37 | return (void *)vaddr; | 54 | return (void *)vaddr; |
38 | } | 55 | } |
39 | 56 | ||