diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2005-07-11 16:45:51 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2005-10-29 14:31:42 -0400 |
commit | 60080265a13ea43f0ebdcd25671dcab05ed01308 (patch) | |
tree | 5172178f73d65bb8cbb129ad3e49a04af7e0b7ce | |
parent | 129bc8f78b468df6824dd1584829f10aa3a69c27 (diff) |
Define kmap_atomic_pfn() for MIPS.
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
-rw-r--r-- | arch/mips/mm/highmem.c | 19 | ||||
-rw-r--r-- | include/asm-mips/highmem.h | 2 |
2 files changed, 21 insertions, 0 deletions
diff --git a/arch/mips/mm/highmem.c b/arch/mips/mm/highmem.c index dd5e2e31885b..1f7b37b38f5c 100644 --- a/arch/mips/mm/highmem.c +++ b/arch/mips/mm/highmem.c | |||
@@ -83,6 +83,25 @@ void __kunmap_atomic(void *kvaddr, enum km_type type) | |||
83 | preempt_check_resched(); | 83 | preempt_check_resched(); |
84 | } | 84 | } |
85 | 85 | ||
86 | /* | ||
87 | * This is the same as kmap_atomic() but can map memory that doesn't | ||
88 | * have a struct page associated with it. | ||
89 | */ | ||
90 | void *kmap_atomic_pfn(unsigned long pfn, enum km_type type) | ||
91 | { | ||
92 | enum fixed_addresses idx; | ||
93 | unsigned long vaddr; | ||
94 | |||
95 | inc_preempt_count(); | ||
96 | |||
97 | idx = type + KM_TYPE_NR*smp_processor_id(); | ||
98 | vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx); | ||
99 | set_pte(kmap_pte-idx, pfn_pte(pfn, kmap_prot)); | ||
100 | flush_tlb_one(vaddr); | ||
101 | |||
102 | return (void*) vaddr; | ||
103 | } | ||
104 | |||
86 | struct page *__kmap_atomic_to_page(void *ptr) | 105 | struct page *__kmap_atomic_to_page(void *ptr) |
87 | { | 106 | { |
88 | unsigned long idx, vaddr = (unsigned long)ptr; | 107 | unsigned long idx, vaddr = (unsigned long)ptr; |
diff --git a/include/asm-mips/highmem.h b/include/asm-mips/highmem.h index f49930d947d4..8cf598402492 100644 --- a/include/asm-mips/highmem.h +++ b/include/asm-mips/highmem.h | |||
@@ -75,6 +75,7 @@ static inline void *kmap_atomic(struct page *page, enum km_type type) | |||
75 | } | 75 | } |
76 | 76 | ||
77 | static inline void kunmap_atomic(void *kvaddr, enum km_type type) { } | 77 | static inline void kunmap_atomic(void *kvaddr, enum km_type type) { } |
78 | #define kmap_atomic_pfn(pfn, idx) page_address(pfn_to_page(pfn)) | ||
78 | 79 | ||
79 | #define kmap_atomic_to_page(ptr) virt_to_page(ptr) | 80 | #define kmap_atomic_to_page(ptr) virt_to_page(ptr) |
80 | 81 | ||
@@ -86,6 +87,7 @@ extern void *__kmap(struct page *page); | |||
86 | extern void __kunmap(struct page *page); | 87 | extern void __kunmap(struct page *page); |
87 | extern void *__kmap_atomic(struct page *page, enum km_type type); | 88 | extern void *__kmap_atomic(struct page *page, enum km_type type); |
88 | extern void __kunmap_atomic(void *kvaddr, enum km_type type); | 89 | extern void __kunmap_atomic(void *kvaddr, enum km_type type); |
90 | extern void *kmap_atomic_pfn(unsigned long pfn, enum km_type type); | ||
89 | extern struct page *__kmap_atomic_to_page(void *ptr); | 91 | extern struct page *__kmap_atomic_to_page(void *ptr); |
90 | 92 | ||
91 | #define kmap __kmap | 93 | #define kmap __kmap |