Skip to content

Commit

Permalink
Define kmap_atomic_pfn() for MIPS.
Browse files Browse the repository at this point in the history
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
  • Loading branch information
Ralf Baechle committed Oct 29, 2005
1 parent 129bc8f commit 6008026
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
19 changes: 19 additions & 0 deletions arch/mips/mm/highmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,25 @@ void __kunmap_atomic(void *kvaddr, enum km_type type)
preempt_check_resched();
}

/*
* This is the same as kmap_atomic() but can map memory that doesn't
* have a struct page associated with it.
*/
void *kmap_atomic_pfn(unsigned long pfn, enum km_type type)
{
enum fixed_addresses idx;
unsigned long vaddr;

inc_preempt_count();

idx = type + KM_TYPE_NR*smp_processor_id();
vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx);
set_pte(kmap_pte-idx, pfn_pte(pfn, kmap_prot));
flush_tlb_one(vaddr);

return (void*) vaddr;
}

struct page *__kmap_atomic_to_page(void *ptr)
{
unsigned long idx, vaddr = (unsigned long)ptr;
Expand Down
2 changes: 2 additions & 0 deletions include/asm-mips/highmem.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ static inline void *kmap_atomic(struct page *page, enum km_type type)
}

static inline void kunmap_atomic(void *kvaddr, enum km_type type) { }
#define kmap_atomic_pfn(pfn, idx) page_address(pfn_to_page(pfn))

#define kmap_atomic_to_page(ptr) virt_to_page(ptr)

Expand All @@ -86,6 +87,7 @@ extern void *__kmap(struct page *page);
extern void __kunmap(struct page *page);
extern void *__kmap_atomic(struct page *page, enum km_type type);
extern void __kunmap_atomic(void *kvaddr, enum km_type type);
extern void *kmap_atomic_pfn(unsigned long pfn, enum km_type type);
extern struct page *__kmap_atomic_to_page(void *ptr);

#define kmap __kmap
Expand Down

0 comments on commit 6008026

Please sign in to comment.