Linux 4.16-rc2
[linux-2.6-block.git] / arch / metag / include / asm / highmem.h
CommitLineData
b2441318 1/* SPDX-License-Identifier: GPL-2.0 */
bbc17704
JH
2#ifndef _ASM_HIGHMEM_H
3#define _ASM_HIGHMEM_H
4
5#include <asm/cacheflush.h>
6#include <asm/kmap_types.h>
7#include <asm/fixmap.h>
8
9/*
10 * Right now we initialize only a single pte table. It can be extended
11 * easily, subsequent pte tables have to be allocated in one physical
12 * chunk of RAM.
13 */
14/*
15 * Ordering is (from lower to higher memory addresses):
16 *
17 * high_memory
18 * Persistent kmap area
19 * PKMAP_BASE
20 * fixed_addresses
21 * FIXADDR_START
22 * FIXADDR_TOP
23 * Vmalloc area
24 * VMALLOC_START
25 * VMALLOC_END
26 */
27#define PKMAP_BASE (FIXADDR_START - PMD_SIZE)
28#define LAST_PKMAP PTRS_PER_PTE
29#define LAST_PKMAP_MASK (LAST_PKMAP - 1)
30#define PKMAP_NR(virt) (((virt) - PKMAP_BASE) >> PAGE_SHIFT)
31#define PKMAP_ADDR(nr) (PKMAP_BASE + ((nr) << PAGE_SHIFT))
32
33#define kmap_prot PAGE_KERNEL
34
35static inline void flush_cache_kmaps(void)
36{
37 flush_cache_all();
38}
39
40/* declarations for highmem.c */
41extern unsigned long highstart_pfn, highend_pfn;
42
43extern pte_t *pkmap_page_table;
44
45extern void *kmap_high(struct page *page);
46extern void kunmap_high(struct page *page);
47
48extern void kmap_init(void);
49
50/*
51 * The following functions are already defined by <linux/highmem.h>
52 * when CONFIG_HIGHMEM is not set.
53 */
54#ifdef CONFIG_HIGHMEM
55extern void *kmap(struct page *page);
56extern void kunmap(struct page *page);
57extern void *kmap_atomic(struct page *page);
58extern void __kunmap_atomic(void *kvaddr);
59extern void *kmap_atomic_pfn(unsigned long pfn);
bbc17704
JH
60#endif
61
62#endif