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/fixmap.h> 9 10/* 11 * Right now we initialize only a single pte table. It can be extended 12 * easily, subsequent pte tables have to be allocated in one physical 13 * chunk of RAM. 14 */ 15/* 16 * Ordering is (from lower to higher memory addresses): 17 * 18 * high_memory 19 * Persistent kmap area 20 * PKMAP_BASE 21 * fixed_addresses 22 * FIXADDR_START 23 * FIXADDR_TOP 24 * Vmalloc area 25 * VMALLOC_START 26 * VMALLOC_END 27 */ 28#define PKMAP_BASE ((FIXADDR_START - PGDIR_SIZE) & (PGDIR_MASK)) 29#define LAST_PKMAP PTRS_PER_PTE 30#define LAST_PKMAP_MASK (LAST_PKMAP - 1) 31#define PKMAP_NR(virt) (((virt) - (PKMAP_BASE)) >> PAGE_SHIFT) 32#define PKMAP_ADDR(nr) (PKMAP_BASE + ((nr) << PAGE_SHIFT)) 33 34static inline void flush_cache_kmaps(void) 35{ 36 cpu_dcache_wbinval_all(); 37} 38 39/* declarations for highmem.c */ 40extern unsigned long highstart_pfn, highend_pfn; 41 42extern pte_t *pkmap_page_table; 43 44extern void kmap_init(void); 45 46/* 47 * FIXME: The below looks broken vs. a kmap_atomic() in task context which 48 * is interupted and another kmap_atomic() happens in interrupt context. 49 * But what do I know about nds32. -- tglx 50 */ 51#define arch_kmap_local_post_map(vaddr, pteval) \ 52 do { \ 53 __nds32__tlbop_inv(vaddr); \ 54 __nds32__mtsr_dsb(vaddr, NDS32_SR_TLB_VPN); \ 55 __nds32__tlbop_rwr(pteval); \ 56 __nds32__isb(); \ 57 } while (0) 58 59#define arch_kmap_local_pre_unmap(vaddr) \ 60 do { \ 61 __nds32__tlbop_inv(vaddr); \ 62 __nds32__isb(); \ 63 } while (0) 64 65#endif 66