^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * highmem.h: virtual kernel memory mappings for high memory
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Used in CONFIG_HIGHMEM systems for memory pages which
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * are not addressable by direct kernel virtual addresses.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) * Copyright (C) 1999 Gerhard Wichert, Siemens AG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) * Gerhard.Wichert@pdb.siemens.de
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) * Redesigned the x86 32-bit VM architecture to deal with
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) * up to 16 Terrabyte physical memory. With current x86 CPUs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) * we now support up to 64 Gigabytes physical RAM.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) * Copyright (C) 1999 Ingo Molnar <mingo@redhat.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #ifndef _ASM_HIGHMEM_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #define _ASM_HIGHMEM_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) #ifdef __KERNEL__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) #include <linux/interrupt.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) #include <linux/pgtable.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) #include <asm/vaddrs.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) #include <asm/kmap_types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) #include <asm/pgtsrmmu.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) /* declarations for highmem.c */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) extern unsigned long highstart_pfn, highend_pfn;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) #define kmap_prot __pgprot(SRMMU_ET_PTE | SRMMU_PRIV | SRMMU_CACHE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) extern pte_t *pkmap_page_table;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) void kmap_init(void) __init;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) * Right now we initialize only a single pte table. It can be extended
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) * easily, subsequent pte tables have to be allocated in one physical
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) * chunk of RAM. Currently the simplest way to do this is to align the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) * pkmap region on a pagetable boundary (4MB).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) #define LAST_PKMAP 1024
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) #define PKMAP_SIZE (LAST_PKMAP << PAGE_SHIFT)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) #define PKMAP_BASE PMD_ALIGN(SRMMU_NOCACHE_VADDR + (SRMMU_MAX_NOCACHE_PAGES << PAGE_SHIFT))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) #define LAST_PKMAP_MASK (LAST_PKMAP - 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) #define PKMAP_NR(virt) ((virt - PKMAP_BASE) >> PAGE_SHIFT)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) #define PKMAP_ADDR(nr) (PKMAP_BASE + ((nr) << PAGE_SHIFT))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) #define PKMAP_END (PKMAP_ADDR(LAST_PKMAP))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) #define flush_cache_kmaps() flush_cache_all()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) #endif /* __KERNEL__ */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) #endif /* _ASM_HIGHMEM_H */