1 // SPDX-License-Identifier: GPL-2.0
2 // Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd.
3 
4 #include <linux/module.h>
5 #include <linux/highmem.h>
6 #include <linux/smp.h>
7 #include <linux/memblock.h>
8 #include <asm/fixmap.h>
9 #include <asm/tlbflush.h>
10 #include <asm/cacheflush.h>
11 
12 unsigned long highstart_pfn, highend_pfn;
13 
kmap_flush_tlb(unsigned long addr)14 void kmap_flush_tlb(unsigned long addr)
15 {
16 	flush_tlb_one(addr);
17 }
18 EXPORT_SYMBOL(kmap_flush_tlb);
19 
kmap_init(void)20 void __init kmap_init(void)
21 {
22 	unsigned long vaddr;
23 	pgd_t *pgd;
24 	pmd_t *pmd;
25 	pud_t *pud;
26 	pte_t *pte;
27 
28 	vaddr = PKMAP_BASE;
29 	fixrange_init(vaddr, vaddr + PAGE_SIZE*LAST_PKMAP, swapper_pg_dir);
30 
31 	pgd = swapper_pg_dir + pgd_index(vaddr);
32 	pud = (pud_t *)pgd;
33 	pmd = pmd_offset(pud, vaddr);
34 	pte = pte_offset_kernel(pmd, vaddr);
35 	pkmap_page_table = pte;
36 }
37