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 Terabyte 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_X86_HIGHMEM_H
208c2ecf20Sopenharmony_ci#define _ASM_X86_HIGHMEM_H
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci#ifdef __KERNEL__
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci#include <linux/interrupt.h>
258c2ecf20Sopenharmony_ci#include <linux/threads.h>
268c2ecf20Sopenharmony_ci#include <asm/kmap_types.h>
278c2ecf20Sopenharmony_ci#include <asm/tlbflush.h>
288c2ecf20Sopenharmony_ci#include <asm/paravirt.h>
298c2ecf20Sopenharmony_ci#include <asm/fixmap.h>
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci/* declarations for highmem.c */
328c2ecf20Sopenharmony_ciextern unsigned long highstart_pfn, highend_pfn;
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci/*
358c2ecf20Sopenharmony_ci * Right now we initialize only a single pte table. It can be extended
368c2ecf20Sopenharmony_ci * easily, subsequent pte tables have to be allocated in one physical
378c2ecf20Sopenharmony_ci * chunk of RAM.
388c2ecf20Sopenharmony_ci */
398c2ecf20Sopenharmony_ci/*
408c2ecf20Sopenharmony_ci * Ordering is:
418c2ecf20Sopenharmony_ci *
428c2ecf20Sopenharmony_ci * high memory on:			              high_memory off:
438c2ecf20Sopenharmony_ci *    FIXADDR_TOP                                        FIXADDR_TOP
448c2ecf20Sopenharmony_ci *        fixed addresses                                    fixed addresses
458c2ecf20Sopenharmony_ci *    FIXADDR_START                                      FIXADDR_START
468c2ecf20Sopenharmony_ci *        temp fixed addresses/persistent kmap area      VMALLOC_END
478c2ecf20Sopenharmony_ci *    PKMAP_BASE                                             temp fixed addresses/vmalloc area
488c2ecf20Sopenharmony_ci *    VMALLOC_END                                        VMALLOC_START
498c2ecf20Sopenharmony_ci *        vmalloc area                                   high_memory
508c2ecf20Sopenharmony_ci *    VMALLOC_START
518c2ecf20Sopenharmony_ci *    high_memory
528c2ecf20Sopenharmony_ci *
538c2ecf20Sopenharmony_ci * The temp fixed area is only used during boot for early_ioremap(), and
548c2ecf20Sopenharmony_ci * it is unused when the ioremap() is functional. vmalloc/pkmap area become
558c2ecf20Sopenharmony_ci * available after early boot so the temp fixed area is available for re-use.
568c2ecf20Sopenharmony_ci */
578c2ecf20Sopenharmony_ci#define LAST_PKMAP_MASK (LAST_PKMAP-1)
588c2ecf20Sopenharmony_ci#define PKMAP_NR(virt)  ((virt-PKMAP_BASE) >> PAGE_SHIFT)
598c2ecf20Sopenharmony_ci#define PKMAP_ADDR(nr)  (PKMAP_BASE + ((nr) << PAGE_SHIFT))
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_civoid *kmap_atomic_pfn(unsigned long pfn);
628c2ecf20Sopenharmony_civoid *kmap_atomic_prot_pfn(unsigned long pfn, pgprot_t prot);
638c2ecf20Sopenharmony_ci
648c2ecf20Sopenharmony_ci#define flush_cache_kmaps()	do { } while (0)
658c2ecf20Sopenharmony_ci
668c2ecf20Sopenharmony_ciextern void add_highpages_with_active_regions(int nid, unsigned long start_pfn,
678c2ecf20Sopenharmony_ci					unsigned long end_pfn);
688c2ecf20Sopenharmony_ci
698c2ecf20Sopenharmony_ci#endif /* __KERNEL__ */
708c2ecf20Sopenharmony_ci
718c2ecf20Sopenharmony_ci#endif /* _ASM_X86_HIGHMEM_H */
72