aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/mm/highmem.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/mm/highmem.c')
-rw-r--r--arch/mips/mm/highmem.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/arch/mips/mm/highmem.c b/arch/mips/mm/highmem.c
index 4481656d1065..2b1309b2580a 100644
--- a/arch/mips/mm/highmem.c
+++ b/arch/mips/mm/highmem.c
@@ -1,7 +1,12 @@
1#include <linux/module.h> 1#include <linux/module.h>
2#include <linux/highmem.h> 2#include <linux/highmem.h>
3#include <asm/fixmap.h>
3#include <asm/tlbflush.h> 4#include <asm/tlbflush.h>
4 5
6static pte_t *kmap_pte;
7
8unsigned long highstart_pfn, highend_pfn;
9
5void *__kmap(struct page *page) 10void *__kmap(struct page *page)
6{ 11{
7 void *addr; 12 void *addr;
@@ -14,6 +19,7 @@ void *__kmap(struct page *page)
14 19
15 return addr; 20 return addr;
16} 21}
22EXPORT_SYMBOL(__kmap);
17 23
18void __kunmap(struct page *page) 24void __kunmap(struct page *page)
19{ 25{
@@ -22,6 +28,7 @@ void __kunmap(struct page *page)
22 return; 28 return;
23 kunmap_high(page); 29 kunmap_high(page);
24} 30}
31EXPORT_SYMBOL(__kunmap);
25 32
26/* 33/*
27 * kmap_atomic/kunmap_atomic is significantly faster than kmap/kunmap because 34 * kmap_atomic/kunmap_atomic is significantly faster than kmap/kunmap because
@@ -48,11 +55,12 @@ void *__kmap_atomic(struct page *page, enum km_type type)
48#ifdef CONFIG_DEBUG_HIGHMEM 55#ifdef CONFIG_DEBUG_HIGHMEM
49 BUG_ON(!pte_none(*(kmap_pte - idx))); 56 BUG_ON(!pte_none(*(kmap_pte - idx)));
50#endif 57#endif
51 set_pte(kmap_pte-idx, mk_pte(page, kmap_prot)); 58 set_pte(kmap_pte-idx, mk_pte(page, PAGE_KERNEL));
52 local_flush_tlb_one((unsigned long)vaddr); 59 local_flush_tlb_one((unsigned long)vaddr);
53 60
54 return (void*) vaddr; 61 return (void*) vaddr;
55} 62}
63EXPORT_SYMBOL(__kmap_atomic);
56 64
57void __kunmap_atomic(void *kvaddr, enum km_type type) 65void __kunmap_atomic(void *kvaddr, enum km_type type)
58{ 66{
@@ -77,6 +85,7 @@ void __kunmap_atomic(void *kvaddr, enum km_type type)
77 85
78 pagefault_enable(); 86 pagefault_enable();
79} 87}
88EXPORT_SYMBOL(__kunmap_atomic);
80 89
81/* 90/*
82 * This is the same as kmap_atomic() but can map memory that doesn't 91 * This is the same as kmap_atomic() but can map memory that doesn't
@@ -92,7 +101,7 @@ void *kmap_atomic_pfn(unsigned long pfn, enum km_type type)
92 debug_kmap_atomic(type); 101 debug_kmap_atomic(type);
93 idx = type + KM_TYPE_NR*smp_processor_id(); 102 idx = type + KM_TYPE_NR*smp_processor_id();
94 vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx); 103 vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx);
95 set_pte(kmap_pte-idx, pfn_pte(pfn, kmap_prot)); 104 set_pte(kmap_pte-idx, pfn_pte(pfn, PAGE_KERNEL));
96 flush_tlb_one(vaddr); 105 flush_tlb_one(vaddr);
97 106
98 return (void*) vaddr; 107 return (void*) vaddr;
@@ -111,7 +120,11 @@ struct page *__kmap_atomic_to_page(void *ptr)
111 return pte_page(*pte); 120 return pte_page(*pte);
112} 121}
113 122
114EXPORT_SYMBOL(__kmap); 123void __init kmap_init(void)
115EXPORT_SYMBOL(__kunmap); 124{
116EXPORT_SYMBOL(__kmap_atomic); 125 unsigned long kmap_vstart;
117EXPORT_SYMBOL(__kunmap_atomic); 126
127 /* cache the first kmap pte */
128 kmap_vstart = __fix_to_virt(FIX_KMAP_BEGIN);
129 kmap_pte = kmap_get_fixmap_pte(kmap_vstart);
130}