• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0 */
2 // Copyright (C) 2005-2017 Andes Technology Corporation
3 
4 #ifndef _ASM_HIGHMEM_H
5 #define _ASM_HIGHMEM_H
6 
7 #include <asm/proc-fns.h>
8 #include <asm/kmap_types.h>
9 #include <asm/fixmap.h>
10 
11 /*
12  * Right now we initialize only a single pte table. It can be extended
13  * easily, subsequent pte tables have to be allocated in one physical
14  * chunk of RAM.
15  */
16 /*
17  * Ordering is (from lower to higher memory addresses):
18  *
19  * high_memory
20  *			Persistent kmap area
21  * PKMAP_BASE
22  *			fixed_addresses
23  * FIXADDR_START
24  * FIXADDR_TOP
25  *			Vmalloc area
26  * VMALLOC_START
27  * VMALLOC_END
28  */
29 #define PKMAP_BASE		((FIXADDR_START - PGDIR_SIZE) & (PGDIR_MASK))
30 #define LAST_PKMAP		PTRS_PER_PTE
31 #define LAST_PKMAP_MASK		(LAST_PKMAP - 1)
32 #define PKMAP_NR(virt)		(((virt) - (PKMAP_BASE)) >> PAGE_SHIFT)
33 #define PKMAP_ADDR(nr)		(PKMAP_BASE + ((nr) << PAGE_SHIFT))
34 
flush_cache_kmaps(void)35 static inline void flush_cache_kmaps(void)
36 {
37 	cpu_dcache_wbinval_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_init(void);
46 
47 /*
48  * The following functions are already defined by <linux/highmem.h>
49  * when CONFIG_HIGHMEM is not set.
50  */
51 #ifdef CONFIG_HIGHMEM
52 extern void *kmap_atomic_pfn(unsigned long pfn);
53 #endif
54 
55 #endif
56