blob: 7080e2c8fa6209e0445b59a7b33ba8bd825797af [file] [log] [blame]
Nicolas Pitred73cd422008-09-15 16:44:55 -04001#ifndef _ASM_HIGHMEM_H
2#define _ASM_HIGHMEM_H
3
4#include <asm/kmap_types.h>
5
6#define PKMAP_BASE (PAGE_OFFSET - PMD_SIZE)
7#define LAST_PKMAP PTRS_PER_PTE
8#define LAST_PKMAP_MASK (LAST_PKMAP - 1)
9#define PKMAP_NR(virt) (((virt) - PKMAP_BASE) >> PAGE_SHIFT)
10#define PKMAP_ADDR(nr) (PKMAP_BASE + ((nr) << PAGE_SHIFT))
11
12#define kmap_prot PAGE_KERNEL
13
Nicolas Pitre7e5a69e2010-03-29 21:46:02 +010014#define flush_cache_kmaps() \
15 do { \
16 if (cache_is_vivt()) \
17 flush_cache_all(); \
18 } while (0)
Nicolas Pitred73cd422008-09-15 16:44:55 -040019
20extern pte_t *pkmap_page_table;
21
Nicolas Pitre43377452009-03-12 22:52:09 -040022#define ARCH_NEEDS_KMAP_HIGH_GET
23
Nicolas Pitred73cd422008-09-15 16:44:55 -040024extern void *kmap_high(struct page *page);
Nicolas Pitre43377452009-03-12 22:52:09 -040025extern void *kmap_high_get(struct page *page);
Nicolas Pitred73cd422008-09-15 16:44:55 -040026extern void kunmap_high(struct page *page);
27
Nicolas Pitre7e5a69e2010-03-29 21:46:02 +010028/*
29 * The following functions are already defined by <linux/highmem.h>
30 * when CONFIG_HIGHMEM is not set.
31 */
32#ifdef CONFIG_HIGHMEM
Nicolas Pitred73cd422008-09-15 16:44:55 -040033extern void *kmap(struct page *page);
34extern void kunmap(struct page *page);
Peter Zijlstra3e4d3af2010-10-26 14:21:51 -070035extern void *__kmap_atomic(struct page *page);
36extern void __kunmap_atomic(void *kvaddr);
37extern void *kmap_atomic_pfn(unsigned long pfn);
Nicolas Pitred73cd422008-09-15 16:44:55 -040038extern struct page *kmap_atomic_to_page(const void *ptr);
Nicolas Pitre7e5a69e2010-03-29 21:46:02 +010039#endif
Nicolas Pitred73cd422008-09-15 16:44:55 -040040
41#endif