18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * highmem.h: virtual kernel memory mappings for high memory
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Used in CONFIG_HIGHMEM systems for memory pages which
68c2ecf20Sopenharmony_ci * are not addressable by direct kernel virtual addresses.
78c2ecf20Sopenharmony_ci *
88c2ecf20Sopenharmony_ci * Copyright (C) 1999 Gerhard Wichert, Siemens AG
98c2ecf20Sopenharmony_ci *		      Gerhard.Wichert@pdb.siemens.de
108c2ecf20Sopenharmony_ci *
118c2ecf20Sopenharmony_ci *
128c2ecf20Sopenharmony_ci * Redesigned the x86 32-bit VM architecture to deal with
138c2ecf20Sopenharmony_ci * up to 16 Terrabyte physical memory. With current x86 CPUs
148c2ecf20Sopenharmony_ci * we now support up to 64 Gigabytes physical RAM.
158c2ecf20Sopenharmony_ci *
168c2ecf20Sopenharmony_ci * Copyright (C) 1999 Ingo Molnar <mingo@redhat.com>
178c2ecf20Sopenharmony_ci */
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci#ifndef _ASM_HIGHMEM_H
208c2ecf20Sopenharmony_ci#define _ASM_HIGHMEM_H
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci#ifdef __KERNEL__
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci#include <linux/interrupt.h>
258c2ecf20Sopenharmony_ci#include <linux/pgtable.h>
268c2ecf20Sopenharmony_ci#include <asm/vaddrs.h>
278c2ecf20Sopenharmony_ci#include <asm/kmap_types.h>
288c2ecf20Sopenharmony_ci#include <asm/pgtsrmmu.h>
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ci/* declarations for highmem.c */
318c2ecf20Sopenharmony_ciextern unsigned long highstart_pfn, highend_pfn;
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ci#define kmap_prot __pgprot(SRMMU_ET_PTE | SRMMU_PRIV | SRMMU_CACHE)
348c2ecf20Sopenharmony_ciextern pte_t *pkmap_page_table;
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_civoid kmap_init(void) __init;
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ci/*
398c2ecf20Sopenharmony_ci * Right now we initialize only a single pte table. It can be extended
408c2ecf20Sopenharmony_ci * easily, subsequent pte tables have to be allocated in one physical
418c2ecf20Sopenharmony_ci * chunk of RAM.  Currently the simplest way to do this is to align the
428c2ecf20Sopenharmony_ci * pkmap region on a pagetable boundary (4MB).
438c2ecf20Sopenharmony_ci */
448c2ecf20Sopenharmony_ci#define LAST_PKMAP 1024
458c2ecf20Sopenharmony_ci#define PKMAP_SIZE (LAST_PKMAP << PAGE_SHIFT)
468c2ecf20Sopenharmony_ci#define PKMAP_BASE PMD_ALIGN(SRMMU_NOCACHE_VADDR + (SRMMU_MAX_NOCACHE_PAGES << PAGE_SHIFT))
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_ci#define LAST_PKMAP_MASK (LAST_PKMAP - 1)
498c2ecf20Sopenharmony_ci#define PKMAP_NR(virt)  ((virt - PKMAP_BASE) >> PAGE_SHIFT)
508c2ecf20Sopenharmony_ci#define PKMAP_ADDR(nr)  (PKMAP_BASE + ((nr) << PAGE_SHIFT))
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_ci#define PKMAP_END (PKMAP_ADDR(LAST_PKMAP))
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_ci#define flush_cache_kmaps()	flush_cache_all()
558c2ecf20Sopenharmony_ci
568c2ecf20Sopenharmony_ci#endif /* __KERNEL__ */
578c2ecf20Sopenharmony_ci
588c2ecf20Sopenharmony_ci#endif /* _ASM_HIGHMEM_H */
59