GNU Linux-libre 4.14.251-gnu1
[releases.git] / arch / metag / include / asm / highmem.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_HIGHMEM_H
3 #define _ASM_HIGHMEM_H
4
5 #include <asm/cacheflush.h>
6 #include <asm/kmap_types.h>
7 #include <asm/fixmap.h>
8
9 /*
10  * Right now we initialize only a single pte table. It can be extended
11  * easily, subsequent pte tables have to be allocated in one physical
12  * chunk of RAM.
13  */
14 /*
15  * Ordering is (from lower to higher memory addresses):
16  *
17  * high_memory
18  *                      Persistent kmap area
19  * PKMAP_BASE
20  *                      fixed_addresses
21  * FIXADDR_START
22  * FIXADDR_TOP
23  *                      Vmalloc area
24  * VMALLOC_START
25  * VMALLOC_END
26  */
27 #define PKMAP_BASE              (FIXADDR_START - PMD_SIZE)
28 #define LAST_PKMAP              PTRS_PER_PTE
29 #define LAST_PKMAP_MASK         (LAST_PKMAP - 1)
30 #define PKMAP_NR(virt)          (((virt) - PKMAP_BASE) >> PAGE_SHIFT)
31 #define PKMAP_ADDR(nr)          (PKMAP_BASE + ((nr) << PAGE_SHIFT))
32
33 #define kmap_prot               PAGE_KERNEL
34
35 static inline void flush_cache_kmaps(void)
36 {
37         flush_cache_all();
38 }
39
40 /* declarations for highmem.c */
41 extern unsigned long highstart_pfn, highend_pfn;
42
43 extern pte_t *pkmap_page_table;
44
45 extern void *kmap_high(struct page *page);
46 extern void kunmap_high(struct page *page);
47
48 extern void kmap_init(void);
49
50 /*
51  * The following functions are already defined by <linux/highmem.h>
52  * when CONFIG_HIGHMEM is not set.
53  */
54 #ifdef CONFIG_HIGHMEM
55 extern void *kmap(struct page *page);
56 extern void kunmap(struct page *page);
57 extern void *kmap_atomic(struct page *page);
58 extern void __kunmap_atomic(void *kvaddr);
59 extern void *kmap_atomic_pfn(unsigned long pfn);
60 #endif
61
62 #endif