blob: fe986d0e6e3fffc6e445999032aaee58ad50be96 [file] [log] [blame]
David Brazdil0f672f62019-12-10 10:32:29 +00001/* SPDX-License-Identifier: GPL-2.0 */
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00002// 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>
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000010
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))
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000034
35static inline void flush_cache_kmaps(void)
36{
37 cpu_dcache_wbinval_all();
38}
39
40/* declarations for highmem.c */
41extern unsigned long highstart_pfn, highend_pfn;
42
43extern pte_t *pkmap_page_table;
44
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000045extern 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
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000052extern void *kmap_atomic_pfn(unsigned long pfn);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000053#endif
54
55#endif