2018-09-05 14:25:12 +08:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
|
|
|
// Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd.
|
|
|
|
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/highmem.h>
|
|
|
|
#include <linux/smp.h>
|
2018-10-31 06:07:44 +08:00
|
|
|
#include <linux/memblock.h>
|
2018-09-05 14:25:12 +08:00
|
|
|
#include <asm/fixmap.h>
|
|
|
|
#include <asm/tlbflush.h>
|
|
|
|
#include <asm/cacheflush.h>
|
|
|
|
|
|
|
|
unsigned long highstart_pfn, highend_pfn;
|
|
|
|
|
2020-06-05 07:47:30 +08:00
|
|
|
void kmap_flush_tlb(unsigned long addr)
|
2018-09-05 14:25:12 +08:00
|
|
|
{
|
2020-06-05 07:47:30 +08:00
|
|
|
flush_tlb_one(addr);
|
2018-09-05 14:25:12 +08:00
|
|
|
}
|
2020-06-05 07:47:30 +08:00
|
|
|
EXPORT_SYMBOL(kmap_flush_tlb);
|
|
|
|
|
2020-11-03 17:27:23 +08:00
|
|
|
void __init kmap_init(void)
|
2018-09-05 14:25:12 +08:00
|
|
|
{
|
|
|
|
unsigned long vaddr;
|
|
|
|
pgd_t *pgd;
|
|
|
|
pmd_t *pmd;
|
|
|
|
pud_t *pud;
|
|
|
|
pte_t *pte;
|
2019-12-01 22:34:19 +08:00
|
|
|
|
2018-09-05 14:25:12 +08:00
|
|
|
vaddr = PKMAP_BASE;
|
2019-12-01 22:34:19 +08:00
|
|
|
fixrange_init(vaddr, vaddr + PAGE_SIZE*LAST_PKMAP, swapper_pg_dir);
|
2018-09-05 14:25:12 +08:00
|
|
|
|
2020-06-09 12:32:47 +08:00
|
|
|
pgd = swapper_pg_dir + pgd_index(vaddr);
|
2018-09-05 14:25:12 +08:00
|
|
|
pud = (pud_t *)pgd;
|
|
|
|
pmd = pmd_offset(pud, vaddr);
|
|
|
|
pte = pte_offset_kernel(pmd, vaddr);
|
|
|
|
pkmap_page_table = pte;
|
|
|
|
}
|