1 // SPDX-License-Identifier: GPL-2.0
2 // Copyright (C) 2005-2017 Andes Technology Corporation
7 #include <asm/proc-fns.h>
8 #include <asm/kmap_types.h>
9 #include <asm/fixmap.h>
10 #include <asm/pgtable.h>
13 * Right now we initialize only a single pte table. It can be extended
14 * easily, subsequent pte tables have to be allocated in one physical
18 * Ordering is (from lower to higher memory addresses):
21 * Persistent kmap area
30 #define PKMAP_BASE ((FIXADDR_START - PGDIR_SIZE) & (PGDIR_MASK))
31 #define LAST_PKMAP PTRS_PER_PTE
32 #define LAST_PKMAP_MASK (LAST_PKMAP - 1)
33 #define PKMAP_NR(virt) (((virt) - (PKMAP_BASE)) >> PAGE_SHIFT)
34 #define PKMAP_ADDR(nr) (PKMAP_BASE + ((nr) << PAGE_SHIFT))
35 #define kmap_prot PAGE_KERNEL
37 static inline void flush_cache_kmaps(void)
39 cpu_dcache_wbinval_all();
42 /* declarations for highmem.c */
43 extern unsigned long highstart_pfn
, highend_pfn
;
45 extern pte_t
*pkmap_page_table
;
47 extern void *kmap_high(struct page
*page
);
48 extern void kunmap_high(struct page
*page
);
50 extern void kmap_init(void);
53 * The following functions are already defined by <linux/highmem.h>
54 * when CONFIG_HIGHMEM is not set.
57 extern void *kmap(struct page
*page
);
58 extern void kunmap(struct page
*page
);
59 extern void *kmap_atomic(struct page
*page
);
60 extern void __kunmap_atomic(void *kvaddr
);
61 extern void *kmap_atomic_pfn(unsigned long pfn
);
62 extern struct page
*kmap_atomic_to_page(void *ptr
);